From f791f9ffefa212e514dd7e8e5e14461d93b85be0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= <uni@thorsten-wissmann.de>
Date: Sat, 25 Jan 2014 11:13:07 +0100
Subject: [PATCH] Add more dependencies to Makefile

---
 GMLMIP-0.1/makefile        | 29 ++++++++++++++++-------------
 GMLMIP-0.1/parser/makefile |  8 +++++++-
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/GMLMIP-0.1/makefile b/GMLMIP-0.1/makefile
index 2493ce4..41b0b34 100644
--- a/GMLMIP-0.1/makefile
+++ b/GMLMIP-0.1/makefile
@@ -4,20 +4,26 @@ GCCFLAGS = -Wall -Wno-deprecated
 POBJS = ./parser/lex.yy.o ./parser/mlf-parser.tab.o ./parser/mlf-driver.o
 FOBJS = ./formulas/formula.o ./formulas/GML_formula.o ./formulas/PML_formula.o ./formulas/rational.o ./formulas/satisfyingassignment.o
 ROBJS = ./rules/premise.o ./rules/GML_premise.o ./rules/PML_premise.o ./rules/valuation.o ./rules/setofconclusions.o ./rules/sizefunctions.o ./rules/radixtree.o
-SUBDIRS = parser formulas rules
+
+HEADERS = parser/mlf-parser.tab.h \
+parser/mlf-driver.h     \
+formulas/formula.h      \
+formulas/satisfyingassignment.h \
+parser/lex.yy.h
 
 .PHONY: all clean parser formulas rules
 
 all: main onestep
 
-parser:
-	make -C parser
+parser/%:
+	make -C parser/ $(@:parser/%=%)
+
+formulas/%:
+	make -C formulas/ $(@:formulas/%=%)
 
-formulas:
-	make -C formulas
+rules/%:
+	make -C rules/ $(@:rules/%=%)
 
-rules:
-	make -C rules
 
 main: main.o $(POBJS) $(FOBJS) $(ROBJS)
 	$(GCC) $(GCCFLAGS) $(POBJS) $(FOBJS) $(ROBJS) -lbdd -lm -lglpk $< -o $@
@@ -26,14 +32,11 @@ onestep: onestep.o $(POBJS) $(FOBJS) $(ROBJS)
 	$(GCC) $(GCCFLAGS) $(POBJS) $(FOBJS) $(ROBJS) -lbdd -lm -lglpk $< -o $@
 
 
-main.o: main.cpp ./parser/mlf-driver.h ./formulas/formula.h ./formulas/satisfyingassignment.h $(SUBDIRS)
+main.o: main.cpp $(HEADERS)
 	$(GCC) $(GCCFLAGS) -c $< -o $@
 
-onestep.o: onestep.cpp ./parser/mlf-driver.h ./formulas/formula.h ./formulas/satisfyingassignment.h $(SUBDIRS)
+onestep.o: onestep.cpp $(HEADERS)
 	$(GCC) $(GCCFLAGS) -c $<
 
-clean:
+clean: parser/clean formulas/clean rules/clean
 	rm -rf *.o main
-	make -C parser clean
-	make -C formulas clean
-	make -C rules clean
diff --git a/GMLMIP-0.1/parser/makefile b/GMLMIP-0.1/parser/makefile
index f39e8ee..0f9ca94 100644
--- a/GMLMIP-0.1/parser/makefile
+++ b/GMLMIP-0.1/parser/makefile
@@ -4,12 +4,18 @@ GCC = g++
 
 GCCFLAGS = -Wall -Wno-deprecated
 
+.PHONY: all clean
+
 all: parser lex.yy.o mlf-parser.tab.o mlf-driver.o
 
+
+../formulas/%:
+	make -C ../formulas/ $(@:../formulas/%=%)
+
 lex.yy.o: lex.yy.h lex.yy.c
 	$(GCC) $(GCCFLAGS) -c lex.yy.c
 	
-mlf-parser.tab.o: mlf-parser.tab.h mlf-parser.tab.cc ../formulas/GML_formula.h ../formulas/PML_formula.h
+mlf-parser.tab.o: mlf-parser.tab.h mlf-parser.tab.cc ../formulas/GML_formula.h ../formulas/PML_formula.h lex.yy.h
 	$(GCC) $(GCCFLAGS) -c mlf-parser.tab.cc
 
 mlf-driver.o: mlf-driver.h mlf-driver.cpp mlf-parser.tab.h lex.yy.h ../formulas/formula.h
-- 
GitLab