Enabled VPATH feature: changed nearly all Makefiles (149 files).
[fw/sdcc] / src / clean.mk
index b60ad6d7874bb653ed510fe58abad59afaec146d..1ff8d7481791be7991c2239e39547aa8917afea0 100644 (file)
@@ -1,11 +1,16 @@
+CLEANALLPORTS = avr ds390 ds400 hc08 izt mcs51 pic pic16 z80 xa51
+
 # Deleting all files created by building the program
 # --------------------------------------------------
 clean:
        rm -f *core *[%~] *.[oa] *.output
        rm -f .[a-z]*~ \#*
-       rm -f $(PRJDIR)/bin/sdcc sdcc
-       for port in $(PORTS) ; do\
-         $(MAKE) -C $$port -f clean.mk clean ;\
+       rm -f version.h
+       rm -f $(top_builddir)bin/sdcc$(EXEEXT) sdcc$(EXEEXT)
+       for port in $(CLEANALLPORTS) ; do\
+         if [ -f $$port/Makefile ]; then\
+           $(MAKE) -C $$port clean ;\
+         fi\
        done
 
 
@@ -13,6 +18,11 @@ clean:
 # -----------------------------------------------------------------
 distclean: clean
        rm -f Makefile *.dep
+       for port in $(CLEANALLPORTS) ; do\
+         if [ -f $$port/Makefile ]; then\
+           $(MAKE) -C $$port distclean ;\
+         fi\
+       done
 
 
 # Like clean but some files may still exist