Skip to contentSkip to conversation

Makefile: don't try to construct CLEAN_FILES based on config

PATCH New Thomas Hebb 3 participants 7 messages Nov 10, 2019 – Dec 4, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Makefile: don't try to construct CLEAN_FILES based on config

All of the clean targets (clean, dist-clean, mrproper) are run without loading a configuration. That means that any conditional modification of CLEAN_FILES will either always apply or never apply and so shouldn't be in a conditional in the first place.

Since CLEAN_FILES is allowed to list nonexistent files, just add everything to it unconditionally to fix the issue.

---
 Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index 5c8c4c971f..1186a1d34c 100644
@@ -1286,7 +1286,6 @@ MKIMAGEFLAGS_u-boot-ivt.img = -A $(ARCH) -T firmware_ivt -C none -O u-boot \
 	-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
 	-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
 u-boot-ivt.img: MKIMAGEOUTPUT = u-boot-ivt.img.log
-CLEAN_FILES += u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log
 endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
@@ -1386,7 +1385,6 @@ lpc32xx-boot-1.bin: lpc32xx-spl.img FORCE
 lpc32xx-full.bin: lpc32xx-boot-0.bin lpc32xx-boot-1.bin u-boot.img FORCE
 	$(call if_changed,cat)
 
-CLEAN_FILES += lpc32xx-*
 endif
 
 OBJCOPYFLAGS_u-boot-with-tpl.bin = -I binary -O binary \
@@ -1900,7 +1898,9 @@ CLEAN_DIRS  += $(MODVERDIR) \
 			$(filter-out include, $(shell ls -1 $d 2>/dev/null))))
 
 CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
-	       boot* u-boot* MLO* SPL System.map fit-dtb.blob*
+	       boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
+	       u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
+	       lpc32xx-*
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/3 Makefile: consolidate hardcoded lists of files to clean

Currently, we have two places where we list files that should always be cleaned if they exist. One, the CLEAN_FILES variable, is from the Linux build system and is the proper place to list files.

The other, a set of extra arguments passed in the xargs template used to remove files with certain extensions, was introduced by 8f06f0cee3d3 ("Makefile: clean image.map") and is clearly wrong: by extending the xargs template, we attempt to remove the files once for each batch of arguments that xargs produces and we reduce the number of files from stdin that xargs can include in each of its rm commands.

To fix this, put all hardcoded files into CLEAN_FILES.

---
 Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Makefile +2 -3
index 1186a1d34c..4ac722cd44 100644
@@ -1900,7 +1900,7 @@ CLEAN_DIRS  += $(MODVERDIR) \
 CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
 	       boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
 	       u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
-	       lpc32xx-*
+	       lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin*
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
@@ -1934,8 +1934,7 @@ clean: $(clean-dirs)
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
 		-o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
-		-type f -print | xargs rm -f \
-		bl31.c bl31.elf bl31_*.bin image.map tispl.bin*
+		-type f -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
 #
Signature · 1 line
2.23.0
#2 lore raw

PATCH 2/3 Makefile: consolidate hardcoded lists of files to clean

Quoted 11 lines · Thomas Hebb

Currently, we have two places where we list files that should always be cleaned if they exist. One, the CLEAN_FILES variable, is from the Linux build system and is the proper place to list files.

The other, a set of extra arguments passed in the xargs template used to remove files with certain extensions, was introduced by 8f06f0cee3d3 ("Makefile: clean image.map") and is clearly wrong: by extending the xargs template, we attempt to remove the files once for each batch of arguments that xargs produces and we reduce the number of files from stdin that xargs can include in each of its rm commands.

Quoted 3 lines

To fix this, put all hardcoded files into CLEAN_FILES.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/644178dd/attachment.sig>
#3 lore raw

PATCH 3/3 Makefile: add Rockchip idbloader.img to CLEAN_FILES

In reply to Thomas Hebb

This file is generated in the root during Rockchip builds and so should be cleaned up.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
index 4ac722cd44..2d172b29ef 100644
@@ -1900,7 +1900,8 @@ CLEAN_DIRS  += $(MODVERDIR) \
 CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
 	       boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
 	       u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
-	       lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin*
+	       lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
+	       idbloader.img
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
Signature · 1 line
2.23.0
#4 lore raw

PATCH 3/3 Makefile: add Rockchip idbloader.img to CLEAN_FILES

Quoted 14 lines · Thomas Hebb

This file is generated in the root during Rockchip builds and so should be cleaned up.

---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +0 -0
index 4ac722cd44..2d172b29ef 100644

Makefile CLEAN_DIRS += $(MODVERDIR) \

Quoted 10 lines
Makefile +2 -2
@@ -1900,7 +1900,8 @@ CLEAN_DIRS  += $(MODVERDIR) \
 CLEAN_FILES += include/bmp_logo.h include/bmp_logo_data.h tools/version.h \
               boot* u-boot* MLO* SPL System.map fit-dtb.blob* \
               u-boot-ivt.img.log u-boot-dtb.imx.log SPL.log u-boot.imx.log \
-              lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin*
+              lpc32xx-* bl31.c bl31.elf bl31_*.bin image.map tispl.bin* \
+              idbloader.img
 
 # Directories & files removed with 'make mrproper'
 MRPROPER_DIRS  += include/config include/generated spl tpl \
--
Quoted 6 lines

2.23.0

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 4 lines
| Michael Nazzareno Trimarchi                     Amarula Solutions BV |
| COO  -  Founder                                      Cruquiuskade 47 |
| +31(0)851119172                                 Amsterdam 1018 AM NL |
|                  [`as] http://www.amarulasolutions.com               |
#5 lore raw

PATCH 3/3 Makefile: add Rockchip idbloader.img to CLEAN_FILES

In reply to Thomas Hebb
Quoted 5 lines · Thomas Hebb

This file is generated in the root during Rockchip builds and so should be cleaned up.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/7350edb1/attachment.sig>
#6 lore raw

PATCH 1/3 Makefile: don't try to construct CLEAN_FILES based on config

In reply to Thomas Hebb
Quoted 9 lines · Thomas Hebb

All of the clean targets (clean, dist-clean, mrproper) are run without loading a configuration. That means that any conditional modification of CLEAN_FILES will either always apply or never apply and so shouldn't be in a conditional in the first place.

Since CLEAN_FILES is allowed to list nonexistent files, just add everything to it unconditionally to fix the issue.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20191203/d6836889/attachment.sig>