diff --git a/Makefile b/Makefile
index bf8eb7b2e5545fb1db4e47161806372e1dfab565..fd5f2268c85bcbb505c943244e2456247ec2798d 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 3ca1e03bb8159d6b02c4b3383ebeafa16585cbd7..c275249f5b118f369e6b1cda15a01300be2b121d 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 1a18f3b93c64c0d8db5ca055693e00bf10effcc5..7dfb2de341bb094c32d1e1f63c06af0ed6aa7aaa 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 d9c94902d568f1d2c058b2c4daa3518eefebc715..27029d5986fd799329f7c692730d22b1dc47a65f 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 52022dde18e2646191216a34b6760601f405e724..6832e7887fe121e6bae3c2e8b84085a2fd47b858 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 {} \;