Makefile.in 5.9 KB

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