Makefile.in 5.3 KB

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