Makefile.in 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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
  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=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. login_sql: $(LOGIN_SQL_DEPENDS)
  43. @$(MAKE) -C src/login sql
  44. char_sql: $(CHAR_SQL_DEPENDS)
  45. @$(MAKE) -C src/char
  46. map_sql: $(MAP_SQL_DEPENDS)
  47. @$(MAKE) -C src/map sql
  48. tools:
  49. @$(MAKE) -C src/tool
  50. plugins addons: $(PLUGIN_DEPENDS)
  51. @$(MAKE) -C src/plugins
  52. import:
  53. # 1) create conf/import folder
  54. # 2) add missing files
  55. # 3) remove remaining .svn folder
  56. @echo "building conf/import folder..."
  57. @if test ! -d conf/import ; then mkdir conf/import ; fi
  58. @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
  59. @rm -rf conf/import/.svn
  60. clean:
  61. @$(MAKE) -C src/common $@
  62. @$(MAKE) -C 3rdparty/mt19937ar $@
  63. @$(MAKE) -C src/login $@
  64. @$(MAKE) -C src/char $@
  65. @$(MAKE) -C src/map $@
  66. @$(MAKE) -C src/plugins $@
  67. @$(MAKE) -C src/tool $@
  68. help:
  69. @echo "most common targets are 'all' 'sql' 'conf' 'clean' 'help'"
  70. @echo "possible targets are:"
  71. @echo "'common_sql' - builds object files used in SQL servers"
  72. @echo "'mt19937ar' - builds object file of Mersenne Twister MT19937"
  73. @echo "'login_sql' - builds login server (SQL version)"
  74. @echo "'char_sql' - builds char server (SQL version)"
  75. @echo "'map_sql' - builds map server (SQL version)"
  76. @echo "'tools' - builds all the tools in src/tools"
  77. @echo "'plugins' - builds all the plugins in src/plugins"
  78. @echo "'addons'"
  79. @echo "'import' - builds conf/import folder from the template conf/import-tmpl"
  80. @echo "'all' - builds all the above targets"
  81. @echo "'sql' - builds sql servers (targets 'common_sql' 'login_sql' 'char_sql'"
  82. @echo " 'map_sql' and 'import')"
  83. @echo "'clean' - cleans builds and objects"
  84. @echo "'help' - outputs this message"
  85. #####################################################################
  86. needs_mysql:
  87. @echo "MySQL not found or disabled by the configure script"
  88. @exit 1
  89. no_plugins:
  90. @echo "Plugins disabled by the configure script"
  91. @exit 1
  92. #####################################################################
  93. # TODO
  94. install: conf/%.conf conf/%.txt
  95. $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
  96. $(shell mkdir -p /opt/eathena/bin/)
  97. $(shell mkdir -p /opt/eathena/etc/eathena/)
  98. $(shell mkdir -p /opt/eathena/var/log/eathena/)
  99. $(shell mv save /opt/eathena/etc/eathena/save)
  100. $(shell mv db /opt/eathena/etc/eathena/db)
  101. $(shell mv conf /opt/eathena/etc/eathena/conf)
  102. $(shell mv npc /opt/eathena/etc/eathena/npc)
  103. $(shell mv log/* /opt/eathena/var/log/eathena/)
  104. $(shell cp *-server* /opt/eathena/bin/)
  105. $(shell ln -s /opt/eathena/etc/eathena/save/ /opt/eathena/bin/)
  106. $(shell ln -s /opt/eathena/etc/eathena/db/ /opt/eathena/bin/)
  107. $(shell ln -s /opt/eathena/etc/eathena/conf/ /opt/eathena/bin/)
  108. $(shell ln -s /opt/eathena/etc/eathena/npc/ /opt/eathena/bin/)
  109. $(shell ln -s /opt/eathena/var/log/eathena/ /opt/eathena/bin/log)
  110. bin-clean:
  111. $(shell rm /opt/eathena/bin/login-server*)
  112. $(shell rm /opt/eathena/bin/char-server*)
  113. $(shell rm /opt/eathena/bin/map-server*)
  114. uninstall:
  115. $(shell read -p "WARNING: This target does not work properly yet. Press Ctrl+C to cancel or Enter to continue.")
  116. bin-clean
  117. $(shell rm /opt/eathena/bin/save)
  118. $(shell rm /opt/eathena/bin/db)
  119. $(shell rm /opt/eathena/bin/conf)
  120. $(shell rm /opt/eathena/bin/npc)
  121. $(shell rm /opt/eathena/bin/log)
  122. $(shell rm -rf /opt/eathena/etc/eathena)
  123. $(shell rm -rf /opt/eathena/var/log/eathena)