Makefile.in 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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 ladmin 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 ladmin 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 common common_sql login login_sql char char_sql map map_sql \
  22. ladmin tools converters plugins addons import save clean help depend
  23. all: $(ALL_DEPENDS)
  24. txt: common login char map import save
  25. sql: $(SQL_DEPENDS)
  26. common:
  27. @$(MAKE) -C src/common txt
  28. common_sql: $(COMMON_SQL_DEPENDS)
  29. @$(MAKE) -C src/common sql
  30. login: common
  31. @$(MAKE) -C src/login
  32. login_sql: $(LOGIN_SQL_DEPENDS)
  33. @$(MAKE) -C src/login_sql
  34. char: common
  35. @$(MAKE) -C src/char
  36. char_sql: $(CHAR_SQL_DEPENDS)
  37. @$(MAKE) -C src/char_sql
  38. map: common
  39. @$(MAKE) -C src/map txt
  40. map_sql: $(MAP_SQL_DEPENDS)
  41. @$(MAKE) -C src/map sql
  42. ladmin: common
  43. @$(MAKE) -C src/ladmin
  44. tools:
  45. @$(MAKE) -C src/tool
  46. converters: $(CONVERTERS_DEPENDS)
  47. @$(MAKE) -C src/txt-converter
  48. plugins addons: common
  49. @$(MAKE) -C src/plugins
  50. import:
  51. # 1) create conf/import folder
  52. # 2) add missing files
  53. # 3) remove remaining .svn folder
  54. @echo "building conf/import folder..."
  55. @if test ! -d conf/import ; then mkdir conf/import ; fi
  56. @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done
  57. @rm -rf conf/import/.svn
  58. save:
  59. # 1) create save folder
  60. # 2) add missing files
  61. # 3) remove remaining .svn folder
  62. @echo "building save folder..."
  63. @if test ! -d save ; then mkdir save ; fi
  64. @for f in $$(ls save-tmpl) ; do if test ! -e save/$$f ; then cp save-tmpl/$$f save ; fi ; done
  65. @rm -rf save/.svn
  66. clean:
  67. @$(MAKE) -C src/common $@
  68. @$(MAKE) -C src/login $@
  69. @$(MAKE) -C src/login_sql $@
  70. @$(MAKE) -C src/char $@
  71. @$(MAKE) -C src/char_sql $@
  72. @$(MAKE) -C src/map $@
  73. @$(MAKE) -C src/ladmin $@
  74. @$(MAKE) -C src/plugins $@
  75. @$(MAKE) -C src/tool $@
  76. @$(MAKE) -C src/txt-converter $@
  77. help:
  78. @echo "most common targets are 'all' 'txt' 'sql' 'clean' 'help'"
  79. @echo "possible targets are:"
  80. @echo "'common' - builds object files used in TXT servers"
  81. @echo "'common_sql' - builds object files used in SQL servers"
  82. @echo "'login' - builds login server (TXT version)"
  83. @echo "'login_sql' - builds login server (SQL version)"
  84. @echo "'char' - builds char server (TXT version)"
  85. @echo "'char_sql' - builds char server (SQL version)"
  86. @echo "'map' - builds map server (TXT version)"
  87. @echo "'map_sql' - builds map server (SQL version)"
  88. @echo "'ladmin' - builds remote administration tool"
  89. @echo "'tools' - builds all the tools in src/tools"
  90. @echo "'converters' - builds the login/char converters"
  91. @echo "'plugins' - builds all the plugins in src/plugins"
  92. @echo "'addons'"
  93. @echo "'import' - builds conf/import folder from the template conf/import-tmpl"
  94. @echo "'save' - builds save folder from the template save-tmpl"
  95. @echo "'all' - builds all the above targets"
  96. @echo "'txt' - builds txt servers (targets 'common' 'login' 'char' 'map'"
  97. @echo " 'import' and 'save')"
  98. @echo "'sql' - builds sql servers (targets 'common_sql' 'login_sql' 'char_sql'"
  99. @echo " 'map_sql' 'import' and 'save')"
  100. @echo "'clean' - cleans builds and objects"
  101. @echo "'help' - outputs this message"
  102. #####################################################################
  103. needs_mysql:
  104. @echo "MySQL not found or disabled by the configure script"
  105. @exit 1
  106. #####################################################################
  107. # TODO
  108. # Server Packet Protocol version (also defined in src/common/mmo.h)
  109. # CFLAGS += -DPACKETVER=8
  110. # Makes map-wide script variables be saved to SQL instead of TXT files.
  111. # CFLAGS += -DMAPREGSQL
  112. # OPT += -DGCOLLECT
  113. # LIBS += -lgc
  114. # OPT += -DMEMWATCH
  115. # OPT += -DDMALLOC -DDMALLOC_FUNC_CHECK
  116. # LIBS += -ldmalloc
  117. # OPT += -DBCHECK
  118. install: conf/%.conf conf/%.txt
  119. $(shell mkdir -p /opt/eathena/bin/)
  120. $(shell mkdir -p /opt/eathena/etc/eathena/)
  121. $(shell mkdir -p /opt/eathena/var/log/eathena/)
  122. $(shell mv save /opt/eathena/etc/eathena/save)
  123. $(shell mv db /opt/eathena/etc/eathena/db)
  124. $(shell mv conf /opt/eathena/etc/eathena/conf)
  125. $(shell mv npc /opt/eathena/etc/eathena/npc)
  126. $(shell mv log/* /opt/eathena/var/log/eathena/)
  127. $(shell cp *-server* /opt/eathena/bin/)
  128. $(shell cp ladmin /opt/eathena/bin/)
  129. $(shell ln -s /opt/eathena/etc/eathena/save/ /opt/eathena/bin/)
  130. $(shell ln -s /opt/eathena/etc/eathena/db/ /opt/eathena/bin/)
  131. $(shell ln -s /opt/eathena/etc/eathena/conf/ /opt/eathena/bin/)
  132. $(shell ln -s /opt/eathena/etc/eathena/npc/ /opt/eathena/bin/)
  133. $(shell ln -s /opt/eathena/var/log/eathena/ /opt/eathena/bin/log)
  134. bin-clean:
  135. $(shell rm /opt/eathena/bin/login-server*)
  136. $(shell rm /opt/eathena/bin/char-server*)
  137. $(shell rm /opt/eathena/bin/map-server*)
  138. $(shell rm /opt/eathena/bin/ladmin)
  139. uninstall:
  140. bin-clean
  141. $(shell rm /opt/eathena/bin/save)
  142. $(shell rm /opt/eathena/bin/db)
  143. $(shell rm /opt/eathena/bin/conf)
  144. $(shell rm /opt/eathena/bin/npc)
  145. $(shell rm /opt/eathena/bin/log)
  146. $(shell rm -rf /opt/eathena/etc/eathena)
  147. $(shell rm -rf /opt/eathena/var/log/eathena)