summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2013-09-18 05:11:10 +0200
committerHaru <haru@dotalux.com>2013-09-18 16:29:18 +0200
commitbabdf60b0339ac4249072a4ba13d27052e0b2fc5 (patch)
treeadfc85bbae73830081098ae7dc56325448b8cfc7 /src/common
parent78c7c6bf04a6c96d92524ae37ad165e65f599eb8 (diff)
downloadhercules-babdf60b0339ac4249072a4ba13d27052e0b2fc5.tar.gz
hercules-babdf60b0339ac4249072a4ba13d27052e0b2fc5.tar.bz2
hercules-babdf60b0339ac4249072a4ba13d27052e0b2fc5.tar.xz
hercules-babdf60b0339ac4249072a4ba13d27052e0b2fc5.zip
Makefiles improvements and cleanup
This should resolve #138 (please reopen or comment on it if it's not the case). Special thanks to Takkun for helping to reproduce the issue. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/Makefile.in65
1 files changed, 35 insertions, 30 deletions
diff --git a/src/common/Makefile.in b/src/common/Makefile.in
index 313db8ccc..7efad9e45 100644
--- a/src/common/Makefile.in
+++ b/src/common/Makefile.in
@@ -1,30 +1,32 @@
-COMMON_OBJ = obj_all/core.o obj_all/socket.o obj_all/timer.o obj_all/db.o obj_all/HPM.o \
- obj_all/nullpo.o obj_all/malloc.o obj_all/showmsg.o obj_all/strlib.o obj_all/utils.o \
- obj_all/grfio.o obj_all/mapindex.o obj_all/ers.o obj_all/md5calc.o \
- obj_all/minicore.o obj_all/minisocket.o obj_all/minimalloc.o obj_all/random.o obj_all/des.o \
- obj_all/conf.o obj_all/thread.o obj_all/mutex.o obj_all/raconf.o obj_all/mempool.o obj_all/console.o \
- obj_all/miniconsole.o
-
-COMMON_H = $(shell ls ../common/*.h)
+MT19937AR_D = ../../3rdparty/mt19937ar
+MT19937AR_OBJ = $(MT19937AR_D)/mt19937ar.o
+MT19937AR_H = $(MT19937AR_D)/mt19937ar.h
+MT19937AR_INCLUDE = -I$(MT19937AR_D)
+
+LIBCONFIG_D = ../../3rdparty/libconfig
+LIBCONFIG_OBJ = $(addprefix $(LIBCONFIG_D)/, libconfig.o grammar.o scanctx.o \
+ scanner.o strbuf.o)
+LIBCONFIG_H = $(addprefix $(LIBCONFIG_D)/, libconfig.h grammar.h parsectx.h \
+ scanctx.h scanner.h strbuf.h wincompat.h)
+LIBCONFIG_INCLUDE = -I$(LIBCONFIG_D)
+
+COMMON_OBJ = $(addprefix obj_all/, conf.o console.o core.o db.o des.o ers.o \
+ grfio.o HPM.o malloc.o mapindex.o md5calc.o mempool.o \
+ miniconsole.o minicore.o minimalloc.o minisocket.o mutex.o \
+ nullpo.o raconf.o random.o showmsg.o socket.o strlib.o thread.o \
+ timer.o utils.o)
+COMMON_H = atomic.h cbasetypes.h conf.h console.h core.h db.h des.h ers.h \
+ evdp.h grfio.h HPM.h HPMi.h malloc.h mapindex.h md5calc.h \
+ mempool.h mmo.h mutex.h netbuffer.h network.h nullpo.h raconf.h \
+ random.h showmsg.h socket.h spinlock.h sql.h strlib.h thread.h \
+ timer.h utils.h winapi.h
COMMON_SQL_OBJ = obj_sql/sql.o
COMMON_SQL_H = sql.h
-MT19937AR_OBJ = ../../3rdparty/mt19937ar/mt19937ar.o
-MT19937AR_H = ../../3rdparty/mt19937ar/mt19937ar.h
-MT19937AR_INCLUDE = -I../../3rdparty/mt19937ar
-
-LIBCONFIG_OBJ = ../../3rdparty/libconfig/libconfig.o ../../3rdparty/libconfig/grammar.o \
- ../../3rdparty/libconfig/scanctx.o ../../3rdparty/libconfig/scanner.o ../../3rdparty/libconfig/strbuf.o
-LIBCONFIG_H = ../../3rdparty/libconfig/libconfig.h ../../3rdparty/libconfig/grammar.h \
- ../../3rdparty/libconfig/parsectx.h ../../3rdparty/libconfig/scanctx.h ../../3rdparty/libconfig/scanner.h \
- ../../3rdparty/libconfig/strbuf.h ../../3rdparty/libconfig/wincompat.h
-LIBCONFIG_INCLUDE = -I../../3rdparty/libconfig
-
HAVE_MYSQL=@HAVE_MYSQL@
ifeq ($(HAVE_MYSQL),yes)
- ALL_DEPENDS=sql
SQL_DEPENDS=common common_sql
else
SQL_DEPENDS=needs_mysql
@@ -36,9 +38,9 @@ CC = @CC@
export CC
#####################################################################
-.PHONY : all sql clean help
+.PHONY: all sql common common_sql clean help
-all: $(ALL_DEPENDS)
+all: sql
sql: $(SQL_DEPENDS)
@@ -59,6 +61,8 @@ needs_mysql:
@echo "MySQL not found or disabled by the configure script"
@exit 1
+# object directories
+
obj_all:
@echo " MKDIR obj_all"
@-mkdir obj_all
@@ -74,28 +78,29 @@ obj_all/common.a: $(COMMON_OBJ)
obj_sql/common_sql.a: $(COMMON_SQL_OBJ)
@echo " AR $@"
@@AR@ rcs obj_sql/common_sql.a $(COMMON_SQL_OBJ)
-
-common: obj_all $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a
+common: $(COMMON_OBJ) $(MT19937AR_OBJ) $(LIBCONFIG_OBJ) obj_all/common.a
-common_sql: obj_sql $(COMMON_SQL_OBJ) obj_sql/common_sql.a
+common_sql: $(COMMON_SQL_OBJ) obj_sql/common_sql.a
-obj_all/%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_all/%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
-obj_all/mini%.o: %.c $(COMMON_H) $(MT19937AR_H) $(LIBCONFIG_H)
+obj_all/mini%.o: %.c $(COMMON_H) $(CONFIG_H) $(MT19937AR_H) $(LIBCONFIG_H) | obj_all
@echo " CC $<"
@$(CC) @CFLAGS@ $(MT19937AR_INCLUDE) $(LIBCONFIG_INCLUDE) -DMINICORE @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
-obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(LIBCONFIG_H)
+obj_sql/%.o: %.c $(COMMON_H) $(COMMON_SQL_H) $(CONFIG_H) $(LIBCONFIG_H) | obj_sql
@echo " CC $<"
@$(CC) @CFLAGS@ $(LIBCONFIG_INCLUDE) @MYSQL_CFLAGS@ @CPPFLAGS@ -c $(OUTPUT_OPTION) $<
# missing object files
$(MT19937AR_OBJ):
- @$(MAKE) -C ../../3rdparty/mt19937ar
+ @echo " MAKE $@"
+ @$(MAKE) -C $(MT19937AR_D)
$(LIBCONFIG_OBJ):
- @$(MAKE) -C ../../3rdparty/libconfig
+ @echo " MAKE $@"
+ @$(MAKE) -C $(LIBCONFIG_D)