gen_makefile: provide overall 'clean' target

Change-Id: I746234eb458da41b86fe9571915a2e942daa26ee
diff --git a/gen_makefile.py b/gen_makefile.py
index 05db443..7b87151 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -164,6 +164,13 @@
 	@echo "\n\n\n===== $@\n"
 	$(MAKE) -C {build_proj} install
 	touch $@
+
+.PHONY: {proj}-clean
+{proj}-clean:
+	@echo "\n\n\n===== $@\n"
+	-chmod -R ug+w {build_proj}
+	-rm -rf {build_proj}
+	-rm -rf .make.{proj}.*
 '''.format(
     url=url,
     proj=proj,
@@ -224,6 +231,9 @@
   # convenience target: clone all repositories first
   out.write('clone: \\\n\t' + ' \\\n\t'.join([ '.make.%s.clone' % p for p, d in projects_deps ]) + '\n\n')
 
+  # convenience target: clean all
+  out.write('clean: \\\n\t' + ' \\\n\t'.join([ '%s-clean' % p for p, d in projects_deps ]) + '\n\n')
+
   # now the actual useful build rules
   out.write('all: \\\n\tclone \\\n\t' + ' \\\n\t'.join([ '.make.%s.detect_edits .make.%s.install' % (p,p) for p, d in projects_deps ]) + '\n\n')