Makefile.in 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. # This file is part of Hercules.
  2. # http://herc.ws - http://github.com/HerculesWS/Hercules
  3. #
  4. # Copyright (C) 2012-2015 Hercules Dev Team
  5. # Copyright (C) Athena Dev Teams
  6. #
  7. # Hercules is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. # @configure_input@
  20. @SET_MAKE@
  21. HAVE_MYSQL=@HAVE_MYSQL@
  22. ifeq ($(HAVE_MYSQL),yes)
  23. ALL_DEPENDS=common_sql login_sql char_sql map_sql sysinfo | import
  24. SQL_DEPENDS=common_sql login_sql char_sql map_sql sysinfo | import
  25. COMMON_SQL_DEPENDS=mt19937ar libconfig sysinfo
  26. LOGIN_SQL_DEPENDS=mt19937ar libconfig common_sql sysinfo
  27. CHAR_SQL_DEPENDS=mt19937ar libconfig common_sql sysinfo
  28. MAP_SQL_DEPENDS=mt19937ar libconfig common_sql sysinfo
  29. TOOLS_DEPENDS=mt19937ar libconfig common_sql sysinfo
  30. else
  31. ALL_DEPENDS=needs_mysql
  32. SQL_DEPENDS=needs_mysql
  33. COMMON_SQL_DEPENDS=needs_mysql
  34. LOGIN_SQL_DEPENDS=needs_mysql
  35. CHAR_SQL_DEPENDS=needs_mysql
  36. MAP_SQL_DEPENDS=needs_mysql
  37. TOOLS_DEPENDS=needs_mysql
  38. endif
  39. WITH_PLUGINS=@WITH_PLUGINS@
  40. ifeq ($(WITH_PLUGINS),yes)
  41. ALL_DEPENDS+=plugins
  42. PLUGIN_DEPENDS=common_sql
  43. else
  44. PLUGIN_DEPENDS=no_plugins
  45. endif
  46. HAVE_PERL=@HAVE_PERL@
  47. HAVE_DOXYGEN=@HAVE_DOXYGEN@
  48. MF_TARGETS = Makefile $(addsuffix /Makefile, src/common 3rdparty/mt19937ar \
  49. 3rdparty/libconfig src/char src/login src/map src/plugins \
  50. src/test tools/HPMHookGen tools/doxygen)
  51. CC = @CC@
  52. export CC
  53. #####################################################################
  54. .PHONY: sql \
  55. common_sql \
  56. mt19937ar \
  57. login_sql \
  58. char_sql \
  59. map_sql \
  60. plugins \
  61. import \
  62. test \
  63. clean \
  64. buildclean \
  65. distclean \
  66. sysinfo \
  67. hooks \
  68. help
  69. all: $(ALL_DEPENDS)
  70. sql: $(SQL_DEPENDS)
  71. $(MF_TARGETS): %: %.in config.status
  72. @echo " CONFIGURE"
  73. @if [ -x config.status ]; then \
  74. echo "Reconfiguring with options: $$(./config.status --config)"; \
  75. ./config.status; \
  76. else \
  77. echo "Unable to find a previous config.status. ./configure will be re-run with the default options."; \
  78. echo "If you want to use custom options, please press CTRL-C and run ./configure yourself"; \
  79. for i in 1 2 3 4 5 6 7 8 9 10; do \
  80. printf "\a. "; \
  81. sleep 1; \
  82. done; \
  83. echo ""; \
  84. ./configure; \
  85. fi;
  86. common_sql: $(COMMON_SQL_DEPENDS) src/common/Makefile
  87. @echo " MAKE $@"
  88. @$(MAKE) -C src/common sql
  89. mt19937ar: 3rdparty/mt19937ar/Makefile
  90. @echo " MAKE $@"
  91. @$(MAKE) -C 3rdparty/mt19937ar
  92. libconfig: 3rdparty/libconfig/Makefile
  93. @echo " MAKE $@"
  94. @$(MAKE) -C 3rdparty/libconfig
  95. login_sql: $(LOGIN_SQL_DEPENDS) src/login/Makefile
  96. @echo " MAKE $@"
  97. @$(MAKE) -C src/login sql
  98. char_sql: $(CHAR_SQL_DEPENDS) src/char/Makefile
  99. @echo " MAKE $@"
  100. @$(MAKE) -C src/char
  101. map_sql: $(MAP_SQL_DEPENDS) src/map/Makefile
  102. @echo " MAKE $@"
  103. @$(MAKE) -C src/map sql
  104. test: src/test/Makefile
  105. @echo " MAKE $@"
  106. @$(MAKE) -C src/test
  107. plugins: $(PLUGIN_DEPENDS) src/plugins/Makefile
  108. @echo " MAKE $@"
  109. @$(MAKE) -C src/plugins
  110. plugin.%: $(PLUGIN_DEPENDS) src/plugins/Makefile
  111. @echo " MAKE $@"
  112. @$(MAKE) -C src/plugins $(patsubst plugin.%,%,$@)
  113. hooks: tools/HPMHookGen/Makefile
  114. @echo " MAKE $@"
  115. @$(MAKE) -C tools/HPMHookGen
  116. docs: tools/doxygen/Makefile
  117. @echo " MAKE $@"
  118. @$(MAKE) -C tools/doxygen
  119. import: Makefile
  120. # @# 1) create conf/import folder
  121. # @# 2) add missing files
  122. # @echo "building conf/import folder..."
  123. # @if test ! -d conf/import ; then mkdir conf/import ; fi
  124. # @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
  125. clean buildclean: $(MF_TARGETS)
  126. @$(MAKE) -C src/common $@
  127. @$(MAKE) -C 3rdparty/mt19937ar $@
  128. @$(MAKE) -C 3rdparty/libconfig $@
  129. @$(MAKE) -C src/login $@
  130. @$(MAKE) -C src/char $@
  131. @$(MAKE) -C src/map $@
  132. @$(MAKE) -C src/plugins $@
  133. @$(MAKE) -C src/test $@
  134. @$(MAKE) -C tools/HPMHookGen $@
  135. @$(MAKE) -C tools/doxygen $@
  136. distclean: clean
  137. @-rm -f $(MF_TARGETS) config.status config.log
  138. sysinfo: config.status
  139. @./sysinfogen.sh src/common/sysinfo_new.inc @CFLAGS@ @CPPFLAGS@
  140. @if cmp -s src/common/sysinfo.inc src/common/sysinfo_new.inc; then \
  141. rm src/common/sysinfo_new.inc ; \
  142. else \
  143. mv src/common/sysinfo_new.inc src/common/sysinfo.inc ; \
  144. fi
  145. config.status: configure
  146. @echo " RECONFIGURE"
  147. @./config.status --recheck && ./config.status
  148. help: Makefile
  149. @echo "most common targets are 'all' 'sql' 'clean' 'plugins' 'help'"
  150. @echo "possible targets are:"
  151. @echo "'common_sql' - builds object files used in SQL servers"
  152. @echo "'mt19937ar' - builds object file of Mersenne Twister MT19937"
  153. @echo "'libconfig' - builds object files of libconfig"
  154. @echo "'login_sql' - builds login server"
  155. @echo "'char_sql' - builds char server"
  156. @echo "'map_sql' - builds map server"
  157. @echo "'import' - builds conf/import folder from the template conf/import-tmpl"
  158. @echo "'all' - builds all the above targets"
  159. @echo "'sql' - builds sql servers (targets 'common_sql' 'login_sql' 'char_sql'"
  160. @echo " 'map_sql' and 'import')"
  161. @echo "'plugins' - builds all available plugins"
  162. @echo "'plugin.Name' - builds plugin named 'Name'"
  163. @echo "'test' - builds tests"
  164. @echo "'clean' - cleans executables and objects"
  165. @echo "'buildclean' - cleans build temporary (object) files, without deleting the"
  166. @echo " executables"
  167. @echo "'distclean' - cleans files generated by ./configure"
  168. @echo "'sysinfo' - re-generates the System Info include"
  169. ifeq ($(HAVE_DOXYGEN),yes)
  170. @echo "'docs' - Generate the Doxygen source code documentation"
  171. ifeq ($(HAVE_PERL),yes)
  172. @echo "'hooks' - re-generates the definitions for the HPM"
  173. endif
  174. endif
  175. @echo "'help' - outputs this message"
  176. #####################################################################
  177. needs_mysql:
  178. @echo "MySQL not found or disabled by the configure script"
  179. @exit 1
  180. no_plugins:
  181. @echo "Plugins disabled by the configure script"
  182. @exit 1
  183. install: all
  184. cp -f char-server ../server-data/
  185. cp -f login-server ../server-data/
  186. cp -f map-server ../server-data/
  187. mkdir ../server-data/plugins/ || true
  188. cp -f plugins/*@DLLEXT@ ../server-data/plugins/