Makefile.in 4.3 KB

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