From 4095d5726ebabc663a6d5397d003773ee652818a Mon Sep 17 00:00:00 2001
From: Ben Longbons <b.r.longbons@gmail.com>
Date: Sat, 2 Apr 2011 22:00:46 -0700
Subject: Rewrite make system to be optimal

---
 src/char/GNUmakefile         |  7 ++++++
 src/char/Makefile            | 16 --------------
 src/common/GNUmakefile       |  7 ++++++
 src/common/Makefile          | 15 -------------
 src/ladmin/GNUmakefile       |  7 ++++++
 src/ladmin/Makefile          | 12 -----------
 src/login/GNUmakefile        |  7 ++++++
 src/login/Makefile           | 12 -----------
 src/map/GNUmakefile          |  7 ++++++
 src/map/Makefile             | 51 --------------------------------------------
 src/tool/GNUmakefile         |  7 ++++++
 src/tool/Makefile            | 15 -------------
 src/tool/moneycount/Makefile | 14 ------------
 src/webserver/GNUmakefile    |  7 ++++++
 src/webserver/Makefile       | 15 -------------
 15 files changed, 49 insertions(+), 150 deletions(-)
 create mode 100644 src/char/GNUmakefile
 delete mode 100644 src/char/Makefile
 create mode 100644 src/common/GNUmakefile
 delete mode 100644 src/common/Makefile
 create mode 100644 src/ladmin/GNUmakefile
 delete mode 100644 src/ladmin/Makefile
 create mode 100644 src/login/GNUmakefile
 delete mode 100644 src/login/Makefile
 create mode 100644 src/map/GNUmakefile
 delete mode 100644 src/map/Makefile
 create mode 100644 src/tool/GNUmakefile
 delete mode 100644 src/tool/Makefile
 delete mode 100644 src/tool/moneycount/Makefile
 create mode 100644 src/webserver/GNUmakefile
 delete mode 100644 src/webserver/Makefile

(limited to 'src')

diff --git a/src/char/GNUmakefile b/src/char/GNUmakefile
new file mode 100644
index 0000000..cd7ad57
--- /dev/null
+++ b/src/char/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. char-server
+clean:
+	rm -r ../../obj/char/
+%::
+	make -C ../.. obj/char/$@
diff --git a/src/char/Makefile b/src/char/Makefile
deleted file mode 100644
index c448627..0000000
--- a/src/char/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-include ../../make.defs
-
-all: char
-
-COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/mt_rand.o
-COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/timer.h ../common/mt_rand.h
-char: char.o inter.o int_party.o int_guild.o int_storage.o $(COMMON_OBJ)
-
-char.o: char.c char.h inter.h $(COMMON_H) ../common/version.h
-inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h char.h $(COMMON_H)
-int_party.o: int_party.c int_party.h inter.h char.h $(COMMON_H)
-int_guild.o: int_guild.c int_guild.h int_storage.h inter.h char.h $(COMMON_H)
-int_storage.o: int_storage.c int_storage.h int_guild.h inter.h char.h $(COMMON_H)
-
-clean:
-	rm -f *.o char
diff --git a/src/common/GNUmakefile b/src/common/GNUmakefile
new file mode 100644
index 0000000..555f81e
--- /dev/null
+++ b/src/common/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. common
+clean:
+	rm -r ../../obj/common/
+%::
+	make -C ../.. obj/common/$@
diff --git a/src/common/Makefile b/src/common/Makefile
deleted file mode 100644
index 43552dc..0000000
--- a/src/common/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-include ../../make.defs
-all: core.o socket.o timer.o grfio.o db.o lock.o nullpo.o mt_rand.o md5calc.o
-
-core.o: core.c core.h
-socket.o: socket.c socket.h mmo.h
-timer.o: timer.c timer.h
-grfio.o: grfio.c grfio.h
-db.o: db.c db.h
-lock.o: lock.c lock.h
-nullpo.o: nullpo.c nullpo.h
-mt_rand.o: mt_rand.c mt_rand.h
-md5calc.o: md5calc.c md5calc.h
-
-clean:
-	rm -f *.o
diff --git a/src/ladmin/GNUmakefile b/src/ladmin/GNUmakefile
new file mode 100644
index 0000000..1461bcf
--- /dev/null
+++ b/src/ladmin/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. ladmin
+clean:
+	rm -r ../../obj/ladmin/
+%::
+	make -C ../.. obj/ladmin/$@
diff --git a/src/ladmin/Makefile b/src/ladmin/Makefile
deleted file mode 100644
index 4b4d2ec..0000000
--- a/src/ladmin/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-include ../../make.defs
-
-all: ladmin
-
-COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/mt_rand.o
-COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/mt_rand.h
-
-ladmin: ladmin.o ../common/md5calc.o $(COMMON_OBJ)
-ladmin.o: ladmin.c ladmin.h ../common/md5calc.h $(COMMON_H)
-
-clean:
-	rm -f *.o ladmin
diff --git a/src/login/GNUmakefile b/src/login/GNUmakefile
new file mode 100644
index 0000000..912127d
--- /dev/null
+++ b/src/login/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. login-server
+clean:
+	rm -r ../../obj/login/
+%::
+	make -C ../.. obj/login/$@
diff --git a/src/login/Makefile b/src/login/Makefile
deleted file mode 100644
index bc1e7c0..0000000
--- a/src/login/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-include ../../make.defs
-
-all: login
-
-COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/mt_rand.o ../common/md5calc.o
-COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/lock.h ../common/mt_rand.h ../common/md5calc.h
-
-login: $(COMMON_OBJ)
-login.o: login.c login.h $(COMMON_H)
-
-clean:
-	rm -f *.o login
diff --git a/src/map/GNUmakefile b/src/map/GNUmakefile
new file mode 100644
index 0000000..a02deda
--- /dev/null
+++ b/src/map/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. map-server
+clean:
+	rm -r ../../obj/map/
+%::
+	make -C ../.. obj/map/$@
diff --git a/src/map/Makefile b/src/map/Makefile
deleted file mode 100644
index d340015..0000000
--- a/src/map/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-include ../../make.defs
-
-all: map
-
-obj:
-	mkdir obj
-
-COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/mt_rand.o ../common/md5calc.o
-LDLIBS = -lm
-
-map: obj/tmw.o obj/magic-interpreter-lexer.o obj/magic-interpreter-parser.o obj/magic-interpreter-base.o obj/magic-expr.o obj/magic-stmt.o obj/magic.o obj/map.o obj/chrif.o obj/clif.o obj/pc.o obj/npc.o obj/chat.o obj/path.o obj/itemdb.o obj/mob.o obj/script.o obj/storage.o obj/skill.o obj/skill-pools.o obj/atcommand.o obj/battle.o obj/intif.o obj/trade.o obj/party.o obj/guild.o $(COMMON_OBJ)
-	${LINK.c} $^ ${LDLIBS} -o $@
-obj/%.o: %.c | obj
-	${COMPILE.c} $< -o $@
-
-magic-interpreter-lexer.c: magic-interpreter-lexer.l
-magic-interpreter-parser.c magic-interpreter-parser.h: magic-interpreter-parser.y
-#The builtin yacc rule is insufficient, (but yacc can be used in place of bison)
-	${YACC} $^ -d -o magic-interpreter-parser.c
-
-obj/magic-interpreter-lexer.o: magic-interpreter-lexer.c magic-interpreter-parser.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/magic-interpreter-parser.o: magic-interpreter-parser.c magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/magic-interpreter-base.o: magic-interpreter-base.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/magic-expr.o: magic-expr.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/magic-stmt.o: magic-stmt.c magic-expr-eval.h magic-interpreter-aux.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/magic.o: magic.c magic.h magic-expr.h magic-interpreter.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb.h storage.h party.h atcommand.h ../common/core.h ../common/timer.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h
-obj/clif.o: magic.h clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h atcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h tmw.h
-obj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h trade.h storage.h chat.h ../common/timer.h ../common/mmo.h ../common/db.h
-obj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h
-obj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h
-obj/path.o: path.c map.h battle.h ../common/mmo.h
-obj/itemdb.o: itemdb.c map.h battle.h itemdb.h ../common/db.h ../common/grfio.h ../common/mmo.h
-obj/mob.o: mob.c map.h clif.h intif.h pc.h mob.h skill.h battle.h npc.h itemdb.h ../common/timer.h ../common/socket.h ../common/mmo.h
-obj/script.o: script.c itemdb.h map.h pc.h mob.h clif.h intif.h npc.h script.h storage.h skill.h battle.h ../common/timer.h ../common/socket.h ../common/db.h ../common/mmo.h ../common/lock.h
-obj/storage.o: storage.c itemdb.h pc.h clif.h intif.h storage.h guild.h ../common/mmo.h ../common/db.h
-obj/skill.o: skill.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h
-obj/skill-pools.o: skill-pools.c skill.h map.h clif.h pc.h mob.h battle.h itemdb.h script.h ../common/timer.h ../common/mmo.h
-obj/atcommand.o: atcommand.c atcommand.h itemdb.h pc.h map.h skill.h clif.h mob.h intif.h battle.h storage.h guild.h ../common/socket.h ../common/timer.h ../common/mmo.h
-obj/battle.o: battle.c battle.h skill.h map.h mob.h pc.h guild.h ../common/timer.h ../common/mmo.h
-obj/intif.o: intif.c intif.h chrif.h clif.h party.h guild.h storage.h map.h battle.h ../common/socket.h ../common/mmo.h
-obj/trade.o: trade.c trade.h clif.h itemdb.h map.h pc.h npc.h ../common/mmo.h
-obj/party.o: party.c party.h clif.h intif.h pc.h map.h battle.h ../common/db.h ../common/socket.h ../common/timer.h ../common/mmo.h
-obj/tmw.o: tmw.c tmw.h map.h clif.h
-obj/guild.o: guild.c guild.h storage.h ../common/mmo.h ../common/utils.h \
- ../common/mt_rand.h ../common/timer.h ../common/socket.h \
- ../common/nullpo.h battle.h npc.h pc.h map.h mob.h intif.h clif.h tmw.h
-
-clean:
-	rm -rf *.o map obj magic-interpreter-parser.c magic-interpreter-parser.h magic-interpreter-lexer.c
diff --git a/src/tool/GNUmakefile b/src/tool/GNUmakefile
new file mode 100644
index 0000000..2efc93b
--- /dev/null
+++ b/src/tool/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. tools
+clean:
+	rm -r ../../obj/tool/
+%::
+	make -C ../.. obj/tool/$@
diff --git a/src/tool/Makefile b/src/tool/Makefile
deleted file mode 100644
index 8d51c25..0000000
--- a/src/tool/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-include ../../make.defs
-
-OBJS =../common/timer.o ../common/socket.o ../common/db.o ../common/lock.o ../char/inter.o ../char/int_guild.o ../char/int_party.o ../char/int_storage.o
-all:	adduser itemfrob mapfrob marriage-info eathena-monitor
-adduser: adduser.o ../common/socket.o
-
-itemfrob: itemfrob.o ${OBJS}
-mapfrob: mapfrob.o ${OBJS}
-marriage-info: marriage-info.o ${OBJS}
-eathena-monitor: eathena-monitor.c
-
-clean:
-	rm -f adduser itemfrob mapfrob marriage-info eathena-monitor
-	rm -f *.exe
-	rm -f *.o
diff --git a/src/tool/moneycount/Makefile b/src/tool/moneycount/Makefile
deleted file mode 100644
index e7b7022..0000000
--- a/src/tool/moneycount/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-all: moneycount
-
-OBJECTS = main.o athena_text.o inf.o portability_fixes.o
-CPP = g++
-
-moneycount: $(OBJECTS)
-	$(CPP) -o $@ $(OBJECTS) $(COMMON_OBJS) $(LIBS)
-main.o: main.cpp
-athena_text.o: athena_text.cpp athena_text.h
-inf.o: inf.cpp inf.hpp
-portability_fixes.o: portability_fixes.cpp portability_fixes.hpp portability_exceptions.hpp
-
-clean:
-	rm -f *.o moneycount
diff --git a/src/webserver/GNUmakefile b/src/webserver/GNUmakefile
new file mode 100644
index 0000000..9635381
--- /dev/null
+++ b/src/webserver/GNUmakefile
@@ -0,0 +1,7 @@
+.SUFFIXES:
+all:
+	make -C ../.. webserver
+clean:
+	rm -r ../../obj/webserver/
+%::
+	make -C ../.. obj/webserver/$@
diff --git a/src/webserver/Makefile b/src/webserver/Makefile
deleted file mode 100644
index 5bfa83f..0000000
--- a/src/webserver/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-include ../../make.defs
-
-OBJ = main.o parse.o generate.o htmlstyle.o logs.o pages/about.o pages/sample.o pages/notdone.o
-all: webserver
-webserver: ${OBJ}
-	${CC} ${CFLAGS} -o $@ ${OBJ}
-	
-
-
-
-clean:
-	rm -f *.o
-	rm -f pages/*.o
-	rm -f webserver
-	
-- 
cgit v1.2.3-70-g09d2