diff --git a/Makefile b/Makefile
index 8b55332b1f146658d5920e135bd666658cd428e9..4bb6ec7b1bcf9e5e219371316585b9831341a4cf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,34 @@
+SUBDIRS=compiler lib examples test
 export LABCOMM_JAR=$(shell pwd)/compiler/labComm.jar
 export LABCOMM=java -jar $(LABCOMM_JAR) 
 
-all: compiler
-	$(MAKE) -C lib 
-	$(MAKE) -C lib/c run-test
+all: $(SUBDIRS:%=make-%)
 
-.PHONY: compiler
-compiler:
+.PHONY: make-compiler
+make-compiler:
 	cd compiler ; ant jar
 
+.PHONY: make-%
+make-%:
+	$(MAKE) -C $* -e 
 
 .PHONY: test
-test:
-	$(MAKE) -C test -e
+test: $(SUBDIRS:%=test-%)
+
+.PHONY: test-compiler
+test-compiler:
+
+.PHONY: test-%
+test-%:
+	$(MAKE) -C $* -e test
+
+.PHONY: clean
+clean: $(SUBDIRS:%=clean-%)
+
+.PHONY: clean-compiler
+clean-compiler:
+	cd compiler ; ant clean
+
+.PHONY: clean-%
+clean-%:
+	$(MAKE) -C $* -e clean
diff --git a/examples/Makefile b/examples/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a8a26d7dd99993d446149dab8756252e8db4ff9d
--- /dev/null
+++ b/examples/Makefile
@@ -0,0 +1,8 @@
+all:
+	echo To be done...
+
+test:
+	echo To be done...
+
+clean:
+	echo To be done...
diff --git a/lib/Makefile b/lib/Makefile
index 3fa0e1f182f70488ea3546e0c17598bc9d0466c9..fd00fcf6f108866a57bf3e55ee7e95d9a1483adb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -3,6 +3,9 @@ all:
 	cd csharp ; make
 	cd java ; make
 
+test:
+	$(MAKE) -C c -e run-test
+
 clean:
 	cd c ; make clean
 	cd csharp ; make clean
diff --git a/lib/csharp/Makefile b/lib/csharp/Makefile
index 5ea79f98c87c04df0e09d6d72fac9822ceeb71de..9a7d581e2594e79c0480ca0b9d26b9138e295187 100644
--- a/lib/csharp/Makefile
+++ b/lib/csharp/Makefile
@@ -16,4 +16,4 @@ labcomm.dll: $(MODULES:%=se/lth/control/labcomm/%.cs) Makefile
 	mcs -out:$@ -target:library $(filter %.cs, $^)
 
 clean:
-	rm labcomm.dll
+	rm -f labcomm.dll
diff --git a/test/Makefile b/test/Makefile
index 3ada01961e7442ca7ed518db79d9e1e3220db34d..cc1248f5eee581573bcb25ed88946326b105030f 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -2,7 +2,9 @@ TESTS=basic simple nested
 LABCOMM_JAR=../compiler/labComm.jar
 LABCOMM=java -jar $(LABCOMM_JAR) 
 
-all:	$(TESTS:%=test_%)
+all:	
+
+test: $(TESTS:%=test_%)
 #	PYTHONPATH=../lib/python \
 #		./test_encoder_decoder.py --labcomm="$(LABCOMM)" basic.lc