From 5ae76995d2e8d412f565481505e4c7bc37260bb1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 29 May 2017 01:33:59 -0400 Subject: [PATCH] Simplify build: nested makefiles considered harmful. --- Makefile | 21 ++++++++++++--------- actions1.c | 2 +- database/adventure.text => adventure.text | 0 database/compile.c => compile.c | 0 database/Makefile | 17 ----------------- funcs.h | 2 +- init.c | 2 +- main.c | 2 +- misc.c | 2 +- score.c | 2 +- 10 files changed, 18 insertions(+), 32 deletions(-) rename database/adventure.text => adventure.text (100%) rename database/compile.c => compile.c (100%) delete mode 100644 database/Makefile diff --git a/Makefile b/Makefile index 435adc4..5eab9d5 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,34 @@ # Makefile for the open-source release of adventure 2.5 LIBS=-lrt -OBJS=main.o init.o actions1.o actions2.o score.o misc.o database/database.o +OBJS=main.o init.o actions1.o actions2.o score.o misc.o database.o SOURCES=$(OBJS:.o=.c) COPYING NEWS README TODO advent.text control .c.o: gcc -O $(DBX) -c $< -advent: $(OBJS) database +advent: $(OBJS) gcc -Wall -std=c99 -O $(DBX) -o advent $(OBJS) $(LIBS) -main.o: main.h misc.h funcs.h database/database.h +main.o: main.h misc.h funcs.h database.h -init.o: misc.h main.h share.h funcs.h database/database.h +init.o: misc.h main.h share.h funcs.h database.h -actions1.o: misc.h main.h share.h funcs.h database/database.h +actions1.o: misc.h main.h share.h funcs.h database.h actions2.o: misc.h main.h share.h funcs.h -score.o: misc.h main.h share.h database/database.h +score.o: misc.h main.h share.h database.h -misc.o: misc.h main.h database/database.h +misc.o: misc.h main.h database.h + +database.c database.h: compile + ./compile + gcc $(OPTIONS) -O $(DBX) -c database.c clean: - rm -f *.o advent advent.html advent.6 adventure.data + rm -f *.o advent advent.html advent.6 database.[ch] cd tests; $(MAKE) --quiet clean - cd database; $(MAKE) clean check: advent cd tests; $(MAKE) --quiet diff --git a/actions1.c b/actions1.c index 802a130..0cf8e97 100644 --- a/actions1.c +++ b/actions1.c @@ -4,7 +4,7 @@ #include "main.h" #include "share.h" #include "funcs.h" -#include "database/database.h" +#include "database.h" /* This stuff was broken off as part of an effort to get the main program * to compile without running out of memory. We're called with a number diff --git a/database/adventure.text b/adventure.text similarity index 100% rename from database/adventure.text rename to adventure.text diff --git a/database/compile.c b/compile.c similarity index 100% rename from database/compile.c rename to compile.c diff --git a/database/Makefile b/database/Makefile deleted file mode 100644 index 18795ed..0000000 --- a/database/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# Makefile for the open-adventure database - -OBJS=compile.o -SOURCES=$(OBJS:.o=.c) adventure.text -OPTIONS=-ggdb -Wall -std=c99 - -.c.o: - gcc $(OPTIONS) -O $(DBX) -c $< - -database: compile - ./compile - gcc $(OPTIONS) -O $(DBX) -c database.c - -compile: $(OBJS) - -clean: - rm -f $(OBJS) compile database.c database.h diff --git a/funcs.h b/funcs.h index 468bc3f..34f69cd 100644 --- a/funcs.h +++ b/funcs.h @@ -1,5 +1,5 @@ #include -#include "database/database.h" +#include "database.h" /* Statement functions * diff --git a/init.c b/init.c index 36c82b1..69901c1 100644 --- a/init.c +++ b/init.c @@ -7,7 +7,7 @@ #include "main.h" #include "share.h" #include "funcs.h" -#include "database/database.h" +#include "database.h" /* * Initialisation diff --git a/main.c b/main.c index 53aff69..e2c24e5 100644 --- a/main.c +++ b/main.c @@ -9,7 +9,7 @@ #include #include #include "main.h" -#include "database/database.h" +#include "database.h" #include "misc.h" long ABB[186], ATLOC[186], BLKLIN = true, DFLAG, diff --git a/misc.c b/misc.c index 40bb1b9..111848e 100644 --- a/misc.c +++ b/misc.c @@ -6,7 +6,7 @@ #include "share.h" /* for SETUP */ #include "misc.h" #include "funcs.h" -#include "database/database.h" +#include "database.h" /* hack to ignore GCC Unused Result */ #define IGNORE(r) do{if(r){}}while(0) diff --git a/score.c b/score.c index 9bfca64..4ef68ad 100644 --- a/score.c +++ b/score.c @@ -2,7 +2,7 @@ #include "misc.h" #include "main.h" #include "share.h" -#include "database/database.h" +#include "database.h" /* * scoring and wrap-up -- 2.31.1