Makefile.in 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. @SET_MAKE@
  2. HAVE_MYSQL=@HAVE_MYSQL@
  3. ifeq ($(HAVE_MYSQL),yes)
  4. ALL_DEPENDS=common_sql login_sql char_sql map_sql tools import
  5. SQL_DEPENDS=common_sql login_sql char_sql map_sql import
  6. COMMON_SQL_DEPENDS=mt19937ar libconfig
  7. LOGIN_SQL_DEPENDS=mt19937ar libconfig common_sql
  8. CHAR_SQL_DEPENDS=mt19937ar libconfig common_sql
  9. MAP_SQL_DEPENDS=mt19937ar libconfig common_sql
  10. CONVERTERS_DEPENDS=common_sql
  11. else
  12. ALL_DEPENDS=needs_mysql
  13. SQL_DEPENDS=needs_mysql
  14. COMMON_SQL_DEPENDS=needs_mysql
  15. LOGIN_SQL_DEPENDS=needs_mysql
  16. CHAR_SQL_DEPENDS=needs_mysql
  17. MAP_SQL_DEPENDS=needs_mysql
  18. endif
  19. WITH_PLUGINS=@WITH_PLUGINS@
  20. ifeq ($(WITH_PLUGINS),yes)
  21. ALL_DEPENDS+=plugins
  22. PLUGIN_DEPENDS=common_sql
  23. else
  24. PLUGIN_DEPENDS=no_plugins
  25. endif
  26. #####################################################################
  27. .PHONY: sql \
  28. common_sql \
  29. mt19937ar \
  30. login_sql \
  31. char_sql \
  32. map_sql \
  33. tools plugins addons \
  34. import \
  35. clean help
  36. all: $(ALL_DEPENDS)
  37. sql: $(SQL_DEPENDS)
  38. common_sql: $(COMMON_SQL_DEPENDS)
  39. @$(MAKE) -C src/common sql
  40. mt19937ar:
  41. @$(MAKE) -C 3rdparty/mt19937ar
  42. libconfig:
  43. @$(MAKE) -C 3rdparty/libconfig
  44. login_sql: $(LOGIN_SQL_DEPENDS)
  45. @$(MAKE) -C src/login sql
  46. char_sql: $(CHAR_SQL_DEPENDS)
  47. @$(MAKE) -C src/char
  48. map_sql: $(MAP_SQL_DEPENDS)
  49. @$(MAKE) -C src/map sql
  50. tools:
  51. @$(MAKE) -C src/tool
  52. plugins addons: $(PLUGIN_DEPENDS)
  53. @$(MAKE) -C src/plugins
  54. import:
  55. # 1) create conf/import folder
  56. # 2) add missing files
  57. # 3) remove remaining .svn folder
  58. @echo "building conf/import folder..."
  59. @if test ! -d conf/import ; then mkdir conf/import ; fi
  60. @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
  61. @rm -rf conf/import/.svn
  62. clean:
  63. @$(MAKE) -C src/common $@
  64. @$(MAKE) -C 3rdparty/mt19937ar $@
  65. @$(MAKE) -C 3rdparty/libconfig $@
  66. @$(MAKE) -C src/login $@
  67. @$(MAKE) -C src/char $@
  68. @$(MAKE) -C src/map $@
  69. @$(MAKE) -C src/plugins $@
  70. @$(MAKE) -C src/tool $@
  71. help:
  72. @echo "most common targets are 'all' 'sql' 'conf' 'clean' 'help'"
  73. @echo "possible targets are:"
  74. @echo "'common_sql' - builds object files used in SQL servers"
  75. @echo "'mt19937ar' - builds object file of Mersenne Twister MT19937"
  76. @echo "'libconfig' - builds object files of libconfig
  77. @echo "'login_sql' - builds login server (SQL version)"
  78. @echo "'char_sql' - builds char server (SQL version)"
  79. @echo "'map_sql' - builds map server (SQL version)"
  80. @echo "'tools' - builds all the tools in src/tools"
  81. @echo "'plugins' - builds all the plugins in src/plugins"
  82. @echo "'addons'"
  83. @echo "'import' - builds conf/import folder from the template conf/import-tmpl"
  84. @echo "'all' - builds all the above targets"
  85. @echo "'sql' - builds sql servers (targets 'common_sql' 'login_sql' 'char_sql'"
  86. @echo " 'map_sql' and 'import')"
  87. @echo "'clean' - cleans builds and objects"
  88. @echo "'help' - outputs this message"
  89. #####################################################################
  90. needs_mysql:
  91. @echo "MySQL not found or disabled by the configure script"
  92. @exit 1
  93. no_plugins:
  94. @echo "Plugins disabled by the configure script"
  95. @exit 1
  96. #####################################################################
  97. # TODO
  98. install: conf/%.conf conf/%.txt
  99. $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
  100. $(shell mkdir -p /opt/eathena/bin/)
  101. $(shell mkdir -p /opt/eathena/etc/eathena/)
  102. $(shell mkdir -p /opt/eathena/var/log/eathena/)
  103. $(shell mv save /opt/eathena/etc/eathena/save)
  104. $(shell mv db /opt/eathena/etc/eathena/db)
  105. $(shell mv conf /opt/eathena/etc/eathena/conf)
  106. $(shell mv npc /opt/eathena/etc/eathena/npc)
  107. $(shell mv log/* /opt/eathena/var/log/eathena/)
  108. $(shell cp *-server* /opt/eathena/bin/)
  109. $(shell ln -s /opt/eathena/etc/eathena/save/ /opt/eathena/bin/)
  110. $(shell ln -s /opt/eathena/etc/eathena/db/ /opt/eathena/bin/)
  111. $(shell ln -s /opt/eathena/etc/eathena/conf/ /opt/eathena/bin/)
  112. $(shell ln -s /opt/eathena/etc/eathena/npc/ /opt/eathena/bin/)
  113. $(shell ln -s /opt/eathena/var/log/eathena/ /opt/eathena/bin/log)
  114. bin-clean:
  115. $(shell rm /opt/eathena/bin/login-server*)
  116. $(shell rm /opt/eathena/bin/char-server*)
  117. $(shell rm /opt/eathena/bin/map-server*)
  118. uninstall:
  119. $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
  120. bin-clean
  121. $(shell rm /opt/eathena/bin/save)
  122. $(shell rm /opt/eathena/bin/db)
  123. $(shell rm /opt/eathena/bin/conf)
  124. $(shell rm /opt/eathena/bin/npc)
  125. $(shell rm /opt/eathena/bin/log)
  126. $(shell rm -rf /opt/eathena/etc/eathena)
  127. $(shell rm -rf /opt/eathena/var/log/eathena)