Skip to contentSkip to conversation

Makefile: Improve generated_defconfig file handling

PATCH In review Sam Protsenko 3 participants 3 messages Mar 8, 2024 – Mar 14, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Improve generated_defconfig file handling

Commit 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor") adds generated_defconfig' file, but fails to clean that up. It might be useful to have that file around after make' is done, but it's better to clean that up on make clean'. Also we probably want to hide it in git status' list. This patch makes the described changes, and also adds -P' parameter to the CPP command that produces the generated_defconfig' to avoid generating linemarkers.

Fixes 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor")
---
 .gitignore               | 1 +
 Makefile                 | 1 +
 scripts/kconfig/Makefile | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)
.gitignore +1 -0
index 330148119264..d9a64d742fd7 100644
@@ -63,6 +63,7 @@ fit-dtb.blob*
 /spl/
 /tpl/
 /defconfig
+/generated_defconfig
 
 #
 # Generated include files
Makefile +1 -0
index a2bc9d590329..6fd0e92c7d5a 100644
@@ -2205,6 +2205,7 @@ clean: $(clean-dirs)
 		-o -name modules.builtin -o -name '.tmp_*.o.*' \
 		-o -name 'dsdt_generated.aml' -o -name 'dsdt_generated.asl.tmp' \
 		-o -name 'dsdt_generated.c' \
+		-o -name 'generated_defconfig' \
 		-o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
 		-type f -print | xargs rm -f
 
scripts/kconfig/Makefile +1 -1
index 5ce5845e8247..079add4d5dab 100644
@@ -93,7 +93,7 @@ endif
 endif
 
 %_defconfig: $(obj)/conf
-	$(Q)$(CPP) -nostdinc -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
+	$(Q)$(CPP) -nostdinc -P -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
 	$(Q)$< $(silent) --defconfig=generated_defconfig $(Kconfig)
 
 # Added for U-Boot (backward compatibility)
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Sam Protsenko

Commit 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor") adds generated_defconfig' file, but fails to clean that up. It might be useful to have that file around after make' is done, but it's better to clean that up on make clean'. Also we probably want to hide it in git status' list. This patch makes the described changes, and also adds -P' parameter to the CPP command that produces the generated_defconfig' to avoid generating linemarkers.

All look like sensible improvements to me,

Quoted 45 lines
Fixes 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor")
---
  .gitignore               | 1 +
  Makefile                 | 1 +
  scripts/kconfig/Makefile | 2 +-
  3 files changed, 3 insertions(+), 1 deletion(-)
.gitignore +1 -0
index 330148119264..d9a64d742fd7 100644
@@ -63,6 +63,7 @@ fit-dtb.blob*
  /spl/
  /tpl/
  /defconfig
+/generated_defconfig
 
  #
  # Generated include files
Makefile +1 -0
index a2bc9d590329..6fd0e92c7d5a 100644
@@ -2205,6 +2205,7 @@ clean: $(clean-dirs)
  		-o -name modules.builtin -o -name '.tmp_*.o.*' \
  		-o -name 'dsdt_generated.aml' -o -name 'dsdt_generated.asl.tmp' \
  		-o -name 'dsdt_generated.c' \
+		-o -name 'generated_defconfig' \
  		-o -name '*.efi' -o -name '*.gcno' -o -name '*.so' \) \
  		-type f -print | xargs rm -f
 
scripts/kconfig/Makefile +1 -1
index 5ce5845e8247..079add4d5dab 100644
@@ -93,7 +93,7 @@ endif
  endif
 
  %_defconfig: $(obj)/conf
-	$(Q)$(CPP) -nostdinc -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
+	$(Q)$(CPP) -nostdinc -P -I $(srctree) -undef -x assembler-with-cpp $(srctree)/arch/$(SRCARCH)/configs/$@ -o generated_defconfig
  	$(Q)$< $(silent) --defconfig=generated_defconfig $(Kconfig)
 
  # Added for U-Boot (backward compatibility)
#2 lore raw
In reply to Sam Protsenko
Quoted 11 lines · Sam Protsenko

Commit 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor") adds generated_defconfig' file, but fails to clean that up. It might be useful to have that file around after make' is done, but it's better to clean that up on make clean'. Also we probably want to hide it in git status' list. This patch makes the described changes, and also adds -P' parameter to the CPP command that produces the generated_defconfig' to avoid generating linemarkers.

Fixes 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor")

Applied to u-boot/next, thanks!

Signature · 1 line
Tom