
Only applies to boards where it has been explicitly enabled. So far, that is 83xx and 85xx boards.
Signed-off-by: Jon Loeliger jdl@freescale.com
---
Soon, 85xx and 83xx boards will have generated files in their board directories that will need to be cleaned out. This patch provides the infrastructure to do so in one generic patch.
Makefile | 20 +++++++++++++++++++- board/cds/mpc8541cds/Makefile | 3 +++ board/cds/mpc8548cds/Makefile | 3 +++ board/cds/mpc8555cds/Makefile | 3 +++ board/mpc8349ads/Makefile | 3 +++ board/mpc8540ads/Makefile | 4 +++- board/mpc8540eval/Makefile | 3 +++ board/mpc8560ads/Makefile | 4 +++- board/pm854/Makefile | 3 +++ board/pm856/Makefile | 3 +++ board/sbc8560/Makefile | 3 +++ board/stxgp3/Makefile | 3 +++ board/tqm834x/Makefile | 3 +++ board/tqm85xx/Makefile | 3 +++ 14 files changed, 58 insertions(+), 3 deletions(-)
996e2c2225222c1a016d14faf13b8bf2e325bae6 diff --git a/Makefile b/Makefile index 9305cab..e73d618 100644 --- a/Makefile +++ b/Makefile @@ -135,6 +135,14 @@ SUBDIRS = tools \ post/cpu .PHONY : $(SUBDIRS)
+# Subdirectories that will be "clean" and "distclean". +# Not all board Makefiles have "clean" and "distclean" yet, +# so only add those that support it to this list. +ifneq ($(filter $(CPU),mpc85xx mpc83xx),) +CLEANDIRS = board/$(BOARDDIR) +endif + + ######################################################################### #########################################################################
@@ -1846,7 +1854,17 @@ clobber: clean rm -f include/asm/proc include/asm/arch include/asm
mrproper \ -distclean: clobber unconfig +distclean: cleansubdirs clobber unconfig + + +.PHONY: cleansubdirs +cleansubdirs: +ifneq ($(strip $(CLEANDIRS)),) + @for dir in $(CLEANDIRS) ; do \ + $(MAKE) -C $$dir distclean; \ + done +endif +
backup: F=`basename $(TOPDIR)` ; cd .. ; \ diff --git a/board/cds/mpc8541cds/Makefile b/board/cds/mpc8541cds/Makefile index 0d4abbd..1161532 100644 --- a/board/cds/mpc8541cds/Makefile +++ b/board/cds/mpc8541cds/Makefile @@ -38,6 +38,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -46,6 +47,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/cds/mpc8548cds/Makefile b/board/cds/mpc8548cds/Makefile index 0d4abbd..1161532 100644 --- a/board/cds/mpc8548cds/Makefile +++ b/board/cds/mpc8548cds/Makefile @@ -38,6 +38,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -46,6 +47,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/cds/mpc8555cds/Makefile b/board/cds/mpc8555cds/Makefile index 0d4abbd..1161532 100644 --- a/board/cds/mpc8555cds/Makefile +++ b/board/cds/mpc8555cds/Makefile @@ -38,6 +38,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -46,6 +47,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/mpc8349ads/Makefile b/board/mpc8349ads/Makefile index 4327b0d..4e89e21 100644 --- a/board/mpc8349ads/Makefile +++ b/board/mpc8349ads/Makefile @@ -32,6 +32,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(SOBJS) $(OBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -40,6 +41,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/mpc8540ads/Makefile b/board/mpc8540ads/Makefile index 5d8ea34..af4c293 100644 --- a/board/mpc8540ads/Makefile +++ b/board/mpc8540ads/Makefile @@ -27,7 +27,6 @@ LIB = lib$(BOARD).a
OBJS := $(BOARD).o SOBJS := init.o -#SOBJS :=
$(LIB): $(OBJS) $(SOBJS) $(AR) crv $@ $(OBJS) @@ -35,6 +34,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +43,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/mpc8540eval/Makefile b/board/mpc8540eval/Makefile index 6f1995e..bb37c73 100644 --- a/board/mpc8540eval/Makefile +++ b/board/mpc8540eval/Makefile @@ -36,6 +36,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -44,6 +45,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/mpc8560ads/Makefile b/board/mpc8560ads/Makefile index 5d8ea34..eb45dcd 100644 --- a/board/mpc8560ads/Makefile +++ b/board/mpc8560ads/Makefile @@ -27,7 +27,6 @@ LIB = lib$(BOARD).a
OBJS := $(BOARD).o SOBJS := init.o -#SOBJS :=
$(LIB): $(OBJS) $(SOBJS) $(AR) crv $@ $(OBJS) @@ -35,6 +34,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +43,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/pm854/Makefile b/board/pm854/Makefile index 7828166..43022ff 100644 --- a/board/pm854/Makefile +++ b/board/pm854/Makefile @@ -35,6 +35,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +44,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/pm856/Makefile b/board/pm856/Makefile index 5d8ea34..3cccb58 100644 --- a/board/pm856/Makefile +++ b/board/pm856/Makefile @@ -35,6 +35,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +44,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/sbc8560/Makefile b/board/sbc8560/Makefile index da295fb..20c4439 100644 --- a/board/sbc8560/Makefile +++ b/board/sbc8560/Makefile @@ -38,6 +38,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -46,6 +47,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/stxgp3/Makefile b/board/stxgp3/Makefile index d150df8..b7b562e 100644 --- a/board/stxgp3/Makefile +++ b/board/stxgp3/Makefile @@ -35,6 +35,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +44,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/tqm834x/Makefile b/board/tqm834x/Makefile index 3ecc7d0..6b5b0c5 100644 --- a/board/tqm834x/Makefile +++ b/board/tqm834x/Makefile @@ -32,6 +32,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(SOBJS) $(OBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -40,6 +41,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
######################################################################### diff --git a/board/tqm85xx/Makefile b/board/tqm85xx/Makefile index 3933d46..446b102 100644 --- a/board/tqm85xx/Makefile +++ b/board/tqm85xx/Makefile @@ -35,6 +35,7 @@ $(LIB): $(OBJS) $(SOBJS) clean: rm -f $(OBJS) $(SOBJS)
+.PHONY: distclean distclean: clean rm -f $(LIB) core *.bak .depend
@@ -43,6 +44,8 @@ distclean: clean .depend: Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c) $(CC) -M $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+ifeq ($(filter distclean,$(MAKECMDGOALS)),) -include .depend +endif
#########################################################################