Skip to contentSkip to conversation

Allow top-level distclean target to descend to board Makefiles.

PATCH New Jon Loeliger 2 participants 5 messages Jan 9, 2006 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow top-level distclean target to descend to board Makefiles.

Only applies to boards where it has been explicitly enabled. So far, that is 83xx and 85xx boards.

---

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

Makefile +19 -1
index 9305cab..e73d618 100644
@@ -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 .. ; \
board/cds/mpc8541cds/Makefile +3 -0
index 0d4abbd..1161532 100644
@@ -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
 
 #########################################################################
board/cds/mpc8548cds/Makefile +3 -0
index 0d4abbd..1161532 100644
@@ -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
 
 #########################################################################
board/cds/mpc8555cds/Makefile +3 -0
index 0d4abbd..1161532 100644
@@ -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
 
 #########################################################################
board/mpc8349ads/Makefile +3 -0
index 4327b0d..4e89e21 100644
@@ -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
 
 #########################################################################
board/mpc8540ads/Makefile +3 -1
index 5d8ea34..af4c293 100644
@@ -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
 
 #########################################################################
board/mpc8540eval/Makefile +3 -0
index 6f1995e..bb37c73 100644
@@ -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
 
 #########################################################################
board/mpc8560ads/Makefile +3 -1
index 5d8ea34..eb45dcd 100644
@@ -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 
 
 #########################################################################
board/pm854/Makefile +3 -0
index 7828166..43022ff 100644
@@ -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
 
 #########################################################################
board/pm856/Makefile +3 -0
index 5d8ea34..3cccb58 100644
@@ -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
 
 #########################################################################
board/sbc8560/Makefile +3 -0
index da295fb..20c4439 100644
@@ -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
 
 #########################################################################
board/stxgp3/Makefile +3 -0
index d150df8..b7b562e 100644
@@ -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
 
 #########################################################################
board/tqm834x/Makefile +3 -0
index 3ecc7d0..6b5b0c5 100644
@@ -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
 
 #########################################################################
board/tqm85xx/Makefile +3 -0
index 3933d46..446b102 100644
@@ -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
 
 #########################################################################
Signature · 1 line
0.99.9n
#1 lore raw

PATCH 1/1 Allow top-level distclean target to descend to board Makefiles.

Quoted 2 lines · In message <[email protected]> you wrote:

Soon, 85xx and 83xx boards will have generated files in

So, they will? Who says so?

Would you mind to elucidate?

Quoted 5 lines

their board directories that will need to be cleaned out. This patch provides the infrastructure to do so in one generic patch.

Quoted 15 lines
 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(-)

CHANGELOG entry missing.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A woman should have compassion.
	-- Kirk, "Catspaw", stardate 3018.2
#2 lore raw

PATCH 1/1 Allow top-level distclean target to descend to board Makefiles.

Quoted 7 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:

Soon, 85xx and 83xx boards will have generated files in

So, they will? Who says so?

Would you mind to elucidate?

Sure. I can't generate _all_ my patches at once. :-)

The next set has generated flat device tree binary gunk derived from a "DTS" source file. To clean up distcleanly, those .dtb and a temporary oftree.c file need to be removed.

I'm hitting up the 85XX ADS and CDS boards. Kumar will be doing the same for the 8349 ADS board.

Thanks!
jdl

#3 lore raw

PATCH 1/1 Allow top-level distclean target to descend to board Makefiles.

Quoted 2 lines · In message <[email protected]> you wrote:

Sure. I can't generate _all_ my patches at once. :-)

Don't. But don't post patches which hang in the free air either. Please see the README - "If one logical set of modifications affects or creates several files, all these changes shall be submitted in a SINGLE patch file."

Quoted 6 lines

The next set has generated flat device tree binary gunk derived from a "DTS" source file. To clean up distcleanly, those .dtb and a temporary oftree.c file need to be removed.

I'm hitting up the 85XX ADS and CDS boards. Kumar will be doing the same for the 8349 ADS board.

But the patch touched a lot of other Makefiles, too.

You don't explain what you're trying to fix, or why you think that all this magic in the top level Makefile is necessary.

Best regards,

Wolfgang Denk

Signature · 3 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Go to Heaven for the climate, Hell for the company."    - Mark Twain