From 47c7d7204e5005cb0c2e59b639940e463230f1d5 Mon Sep 17 00:00:00 2001
From: Anders Blomdell <anders.blomdell@control.lth.se>
Date: Fri, 20 Feb 2015 09:51:00 +0100
Subject: [PATCH] Some Makefile cleanups.

---
 Makefile            |  9 +++++----
 lib/Makefile        | 38 ++++++++++++++++++++++----------------
 lib/csharp/Makefile |  6 ++++++
 lib/java/Makefile   |  4 ++++
 lib/python/Makefile |  6 ++++++
 5 files changed, 43 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index bf8eb7b..fd5f226 100644
--- a/Makefile
+++ b/Makefile
@@ -2,29 +2,30 @@ SUBDIRS=compiler lib test examples
 export LABCOMM_JAR=$(shell pwd)/compiler/labcomm_compiler.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
+.PHONY: all
 all: $(SUBDIRS:%=make-%)
 
 .PHONY: make-%
 make-%:
-	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* -e 
+	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $*
 
 .PHONY: test
 test: $(SUBDIRS:%=test-%)
 
 .PHONY: test-%
 test-%:
-	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* -e test
+	LD_LIBRARY_PATH=`pwd`/lib/c $(MAKE) -C $* test
 
 .PHONY: clean
 clean: $(SUBDIRS:%=clean-%)
 
 .PHONY: clean-%
 clean-%:
-	$(MAKE) -C $* -e clean
+	$(MAKE) -C $* clean
 
 .PHONY: distclean
 distclean: clean $(SUBDIRS:%=distclean-%)
 
 .PHONY: distclean-%
 distclean-%:
-	$(MAKE) -C $* -e distclean
+	$(MAKE) -C $* distclean
diff --git a/lib/Makefile b/lib/Makefile
index 3ca1e03..c275249 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,23 +1,29 @@
+SUBDIRS=c csharp java python
+
 .PHONY: all
-all:
-	cd c ; make
-	cd csharp ; make
-	cd java ; make
+all: $(SUBDIRS:%=make-%)
+
+.PHONY: make-%
+make-%:
+	$(MAKE) -C $*
 
 .PHONY: test
-test:
-	$(MAKE) -C c test
+test: $(SUBDIRS:%=test-%)
+
+.PHONY: test-%
+test-%:
+	$(MAKE) -C $* test
 
 .PHONY: clean
-clean:
-	$(MAKE) -C c clean
-	$(MAKE) -C csharp clean
-	$(MAKE) -C java clean
-	$(MAKE) -C python clean
+clean: $(SUBDIRS:%=clean-%)
+
+.PHONY: clean-%
+clean-%:
+	$(MAKE) -C $* clean
 
 .PHONY: distclean
-distclean:
-	$(MAKE) -C c distclean
-	$(MAKE) -C csharp distclean
-	$(MAKE) -C java  distclean
-	$(MAKE) -C python distclean
+distclean: clean $(SUBDIRS:%=distclean-%)
+
+.PHONY: distclean-%
+distclean-%:
+	$(MAKE) -C $* distclean
diff --git a/lib/csharp/Makefile b/lib/csharp/Makefile
index 1a18f3b..7dfb2de 100644
--- a/lib/csharp/Makefile
+++ b/lib/csharp/Makefile
@@ -10,12 +10,18 @@ MODULES=Constant\
 	SampleHandler \
 	SampleType 
 
+.PHONY: all
 all: labcomm.dll
 
 labcomm.dll: $(MODULES:%=se/lth/control/labcomm/%.cs) Makefile
 	mcs -out:$@ -target:library $(filter %.cs, $^)
 
+.PHONY: test
+test:
+
+.PHONY: clean
 clean:
 
+.PHONY: distclean
 distclean:
 	rm -f labcomm.dll
diff --git a/lib/java/Makefile b/lib/java/Makefile
index d9c9490..27029d5 100644
--- a/lib/java/Makefile
+++ b/lib/java/Makefile
@@ -18,6 +18,7 @@ MODULES=Constant \
 	Writer \
 	WriterWrapper
 
+.PHONY: all
 all: labcomm.jar labcomm2014.jar labcomm2006.jar
 
 labcomm.jar: gen/JAVAC
@@ -45,6 +46,9 @@ gen/JAVAC: $(MODULES:%=se/lth/control/labcomm/%.java) \
 	touch $@
 
 
+.PHONY: test
+test:
+
 .PHONY: clean
 clean:
 	rm -rf gen
diff --git a/lib/python/Makefile b/lib/python/Makefile
index 52022dd..6832e78 100644
--- a/lib/python/Makefile
+++ b/lib/python/Makefile
@@ -1,3 +1,9 @@
+.PHONY: all
+all:
+
+.PHONY: test
+test:
+
 .PHONY: clean
 clean:
 	find . -name '*.pyc' -exec rm {} \;
-- 
GitLab