Makefile.in 5.5 KB

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