diff options
author | Haru <haru@dotalux.com> | 2013-09-21 20:03:52 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-09-21 20:17:52 +0200 |
commit | beaf3a26a60d5b0429a577b7d58232957d4483e7 (patch) | |
tree | c760824c93ccc58cbdbb21bf820a4b72cc1e32dc | |
parent | 0d12201adecaf21fccfee8e62a2d2a5582535ae3 (diff) | |
download | hercules-beaf3a26a60d5b0429a577b7d58232957d4483e7.tar.gz hercules-beaf3a26a60d5b0429a577b7d58232957d4483e7.tar.bz2 hercules-beaf3a26a60d5b0429a577b7d58232957d4483e7.tar.xz hercules-beaf3a26a60d5b0429a577b7d58232957d4483e7.zip |
Added Makefile.in change detection (and auto-rebuild) capabilities
- If a Makefile.in is changed, ./config.status (or ./configure in case
it's not available) will be automatically run to update the Makefiles.
- Special thanks to Yommy for the idea.
Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r-- | 3rdparty/libconfig/Makefile.in | 5 | ||||
-rw-r--r-- | 3rdparty/mt19937ar/Makefile.in | 4 | ||||
-rw-r--r-- | Makefile.in | 52 | ||||
-rw-r--r-- | src/char/Makefile.in | 5 | ||||
-rw-r--r-- | src/common/Makefile.in | 15 | ||||
-rw-r--r-- | src/login/Makefile.in | 5 | ||||
-rw-r--r-- | src/map/Makefile.in | 5 | ||||
-rw-r--r-- | src/plugins/Makefile.in | 5 | ||||
-rw-r--r-- | src/test/Makefile.in | 7 | ||||
-rw-r--r-- | src/tool/Makefile.in | 7 |
10 files changed, 78 insertions, 32 deletions
diff --git a/3rdparty/libconfig/Makefile.in b/3rdparty/libconfig/Makefile.in index d6714e50e..048a1b3b7 100644 --- a/3rdparty/libconfig/Makefile.in +++ b/3rdparty/libconfig/Makefile.in @@ -24,6 +24,9 @@ help: ##################################################################### -%.o: %.c $(LIBCONFIG_H) +Makefile: Makefile.in + @$(MAKE) -C ../.. 3rdparty/libconfig/Makefile + +%.o: %.c $(LIBCONFIG_H) Makefile @echo " CC $<" @$(CC) @CFLAGS@ @DEFS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< diff --git a/3rdparty/mt19937ar/Makefile.in b/3rdparty/mt19937ar/Makefile.in index 7891bbd2d..c48848c8d 100644 --- a/3rdparty/mt19937ar/Makefile.in +++ b/3rdparty/mt19937ar/Makefile.in @@ -24,6 +24,10 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. 3rdparty/mt19937ar/Makefile + +%.o: %.c $(LIBCONFIG_H) Makefile %.o: %.c $(MT19937AR_H) @echo " CC $<" @$(CC) @CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $< diff --git a/Makefile.in b/Makefile.in index d78aa631d..7dfb138f9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,6 +27,10 @@ else PLUGIN_DEPENDS=no_plugins endif +MF_TARGETS = Makefile $(addsuffix /Makefile, src/common 3rdparty/mt19937ar \ + 3rdparty/libconfig src/char src/login src/map src/plugins \ + src/tool src/test) + CC = @CC@ export CC @@ -41,56 +45,73 @@ export CC plugins \ import \ test \ - clean help + clean \ + help all: $(ALL_DEPENDS) sql: $(SQL_DEPENDS) -common_sql: $(COMMON_SQL_DEPENDS) +$(MF_TARGETS): %: %.in + @echo " CONFIGURE" + @if [ -x config.status ]; then \ + echo "Reconfiguring with options: $$(./config.status --config)"; \ + ./config.status; \ + else \ + echo "Unable to find a previous config.status. ./configure will be re-run with the default options."; \ + echo "If you want to use custom options, please press CTRL-C and run ./configure yourself"; \ + for i in 1 2 3 4 5 6 7 8 9 10; do \ + printf "\a. "; \ + sleep 1; \ + done; \ + echo ""; \ + ./configure; \ + fi; + +common_sql: $(COMMON_SQL_DEPENDS) src/common/Makefile @echo " MAKE $@" @$(MAKE) -C src/common sql -mt19937ar: +mt19937ar: 3rdparty/mt19937ar/Makefile @echo " MAKE $@" @$(MAKE) -C 3rdparty/mt19937ar -libconfig: +libconfig: 3rdparty/libconfig/Makefile @echo " MAKE $@" @$(MAKE) -C 3rdparty/libconfig -login_sql: $(LOGIN_SQL_DEPENDS) +login_sql: $(LOGIN_SQL_DEPENDS) src/login/Makefile @echo " MAKE $@" @$(MAKE) -C src/login sql -char_sql: $(CHAR_SQL_DEPENDS) +char_sql: $(CHAR_SQL_DEPENDS) src/char/Makefile @echo " MAKE $@" @$(MAKE) -C src/char -map_sql: $(MAP_SQL_DEPENDS) +map_sql: $(MAP_SQL_DEPENDS) src/map/Makefile @echo " MAKE $@" @$(MAKE) -C src/map sql -tools: $(TOOLS_DEPENDS) +tools: $(TOOLS_DEPENDS) src/tool/Makefile @echo " MAKE $@" @$(MAKE) -C src/tool -test: +test: src/test/Makefile @echo " MAKE $@" @$(MAKE) -C src/test -plugins: $(PLUGIN_DEPENDS) +plugins: $(PLUGIN_DEPENDS) src/plugins/Makefile @echo " MAKE $@" @$(MAKE) -C src/plugins -import: +import: Makefile @# 1) create conf/import folder @# 2) add missing files @echo "building conf/import folder..." @if test ! -d conf/import ; then mkdir conf/import ; fi @for f in $$(ls conf/import-tmpl) ; do if test ! -e conf/import/$$f ; then cp conf/import-tmpl/$$f conf/import ; fi ; done -clean: +clean: $(MF_TARGETS) @$(MAKE) -C src/common $@ @$(MAKE) -C 3rdparty/mt19937ar $@ @$(MAKE) -C 3rdparty/libconfig $@ @@ -102,12 +123,9 @@ clean: @$(MAKE) -C src/test $@ distclean: clean - @-rm -f Makefile src/common/Makefile 3rdparty/mt19937ar/Makefile \ - 3rdparty/libconfig/Makefile src/char/Makefile src/login/Makefile \ - src/map/Makefile src/plugins/Makefile src/tool/Makefile \ - src/test/Makefile + @-rm -f $(MF_TARGETS) config.status config.log -help: +help: Makefile @echo "most common targets are 'all' 'sql' 'clean' 'plugins' 'help'" @echo "possible targets are:" @echo "'common_sql' - builds object files used in SQL servers" diff --git a/src/char/Makefile.in b/src/char/Makefile.in index b2cee3f88..e22d3f5a5 100644 --- a/src/char/Makefile.in +++ b/src/char/Makefile.in @@ -57,6 +57,9 @@ needs_mysql: @echo "MySQL not found or disabled by the configure script" @exit 1 +Makefile: Makefile.in + @$(MAKE) -C ../.. src/char/Makefile + # object directories obj_sql: @@ -65,7 +68,7 @@ obj_sql: # executables -char-server: $(CHAR_SERVER_SQL_DEPENDS) +char-server: $(CHAR_SERVER_SQL_DEPENDS) Makefile @echo " LD $@" @$(CC) @LDFLAGS@ -o ../../char-server@EXEEXT@ $(CHAR_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ diff --git a/src/common/Makefile.in b/src/common/Makefile.in index 00d63dd5e..78f9cd0d1 100644 --- a/src/common/Makefile.in +++ b/src/common/Makefile.in @@ -59,6 +59,9 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/common/Makefile + needs_mysql: @echo "MySQL not found or disabled by the configure script" @exit 1 @@ -73,23 +76,23 @@ obj_sql: @echo " MKDIR obj_sql" @-mkdir obj_sql -obj_all/common.a: $(COMMON_OBJ) +obj_all/common.a: $(COMMON_OBJ) Makefile @echo " AR $@" @@AR@ rcs obj_all/common.a $(COMMON_OBJ) -obj_all/common_mini.a: $(COMMON_MINI_OBJ) +obj_all/common_mini.a: $(COMMON_MINI_OBJ) Makefile @echo " AR $@" @@AR@ rcs obj_all/common_mini.a $(COMMON_MINI_OBJ) -obj_sql/common_sql.a: $(COMMON_SQL_OBJ) +obj_sql/common_sql.a: $(COMMON_SQL_OBJ) Makefile @echo " AR $@" @@AR@ rcs obj_sql/common_sql.a $(COMMON_SQL_OBJ) -common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a +common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a Makefile -common_mini: $(COMMON_MINI_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common_mini.a +common_mini: $(COMMON_MINI_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common_mini.a Makefile -common_sql: $(COMMON_SQL_OBJ) obj_sql/common_sql.a +common_sql: $(COMMON_SQL_OBJ) obj_sql/common_sql.a Makefile obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_all @echo " CC $<" diff --git a/src/login/Makefile.in b/src/login/Makefile.in index 125f4fb7a..681eb5e6f 100644 --- a/src/login/Makefile.in +++ b/src/login/Makefile.in @@ -50,6 +50,9 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/login/Makefile + needs_mysql: @echo "MySQL not found or disabled by the configure script" @exit 1 @@ -62,7 +65,7 @@ obj_sql: # executables -login-server: $(LOGIN_SERVER_SQL_DEPENDS) +login-server: $(LOGIN_SERVER_SQL_DEPENDS) Makefile @echo " LD $@" @$(CC) @LDFLAGS@ -o ../../login-server@EXEEXT@ $(LOGIN_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ diff --git a/src/map/Makefile.in b/src/map/Makefile.in index ed1b9a79d..f7e178667 100644 --- a/src/map/Makefile.in +++ b/src/map/Makefile.in @@ -66,6 +66,9 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/map/Makefile + needs_mysql: @echo "MySQL not found or disabled by the configure script" @exit 1 @@ -78,7 +81,7 @@ obj_sql: # executables -map-server: $(MAP_SERVER_SQL_DEPENDS) +map-server: $(MAP_SERVER_SQL_DEPENDS) Makefile @echo " LD $@" @$(CC) @LDFLAGS@ -o ../../map-server@EXEEXT@ $(MAP_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @PCRE_LIBS@ @MYSQL_LIBS@ diff --git a/src/plugins/Makefile.in b/src/plugins/Makefile.in index 5ed421abf..ff7d5b2e2 100644 --- a/src/plugins/Makefile.in +++ b/src/plugins/Makefile.in @@ -11,7 +11,7 @@ export CC ##################################################################### .PHONY: all $(PLUGINS) sample db2sql clean help -all: $(PLUGINS) +all: $(PLUGINS) Makefile sample: sample@DLLEXT@ @@ -28,6 +28,9 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/plugins/Makefile + %@DLLEXT@: %.c $(COMMON_H) @echo " CC $<" @$(CC) @DEFS@ @CFLAGS@ @CPPFLAGS@ @LDFLAGS@ @SOFLAGS@ -o ../../plugins/$@ $< diff --git a/src/test/Makefile.in b/src/test/Makefile.in index f17c43202..cb99e7004 100644 --- a/src/test/Makefile.in +++ b/src/test/Makefile.in @@ -26,7 +26,7 @@ export CC ##################################################################### .PHONY: all test_spinlock -all: test_spinlock +all: test_spinlock Makefile clean: @echo " CLEAN test" @@ -34,6 +34,9 @@ clean: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/test/Makefile + # object directories obj: @@ -42,7 +45,7 @@ obj: #executables -test_spinlock: $(TEST_SPINLOCK_DEPENDS) +test_spinlock: $(TEST_SPINLOCK_DEPENDS) Makefile @echo " LD $@" @$(CC) @LDFLAGS@ -o ../../test_spinlock@EXEEXT@ $(TEST_SPINLOCK_OBJ) ../common/obj_sql/common_sql.a ../common/obj_all/common.a $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @MYSQL_LIBS@ diff --git a/src/tool/Makefile.in b/src/tool/Makefile.in index 4fa527ffc..4f9dc7590 100644 --- a/src/tool/Makefile.in +++ b/src/tool/Makefile.in @@ -24,9 +24,9 @@ export CC ##################################################################### .PHONY: all mapcache clean help -all: mapcache +all: mapcache Makefile -mapcache: $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) +mapcache: $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) Makefile @echo " LD $@" @$(CC) @LDFLAGS@ $(LIBCONFIG_INCLUDE) -o ../../mapcache@EXEEXT@ $(MAPCACHE_OBJ) $(COMMON_OBJ) $(LIBCONFIG_OBJ) @LIBS@ @@ -43,6 +43,9 @@ help: ##################################################################### +Makefile: Makefile.in + @$(MAKE) -C ../.. src/tool/Makefile + obj_all: @echo " MKDIR obj_all" @-mkdir obj_all |