diff mbox series

Makefile: Improve generated_defconfig file handling

Message ID 20240308033822.28727-1-semen.protsenko@linaro.org
State Accepted
Commit 56041aa545df550134a97aa172645bd718e4e586
Headers show
Series Makefile: Improve generated_defconfig file handling | expand

Commit Message

Sam Protsenko March 8, 2024, 3:38 a.m. UTC
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.

Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
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(-)

Comments

Andrew Davis March 8, 2024, 1:33 p.m. UTC | #1
On 3/7/24 9:38 PM, Sam Protsenko wrote:
> 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,

Acked-by: Andrew Davis <afd@ti.com>

> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> 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(-)
> 
> diff --git a/.gitignore b/.gitignore
> index 330148119264..d9a64d742fd7 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -63,6 +63,7 @@ fit-dtb.blob*
>   /spl/
>   /tpl/
>   /defconfig
> +/generated_defconfig
>   
>   #
>   # Generated include files
> diff --git a/Makefile b/Makefile
> index a2bc9d590329..6fd0e92c7d5a 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -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
>   
> diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
> index 5ce5845e8247..079add4d5dab 100644
> --- a/scripts/kconfig/Makefile
> +++ b/scripts/kconfig/Makefile
> @@ -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)
Tom Rini March 14, 2024, 12:40 a.m. UTC | #2
On Thu, Mar 07, 2024 at 09:38:22PM -0600, Sam Protsenko wrote:

> 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.
> 
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> Fixes: 2027e99e61aa ("Makefile: Run defconfig files through the C preprocessor")
> Acked-by: Andrew Davis <afd@ti.com>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index 330148119264..d9a64d742fd7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -63,6 +63,7 @@  fit-dtb.blob*
 /spl/
 /tpl/
 /defconfig
+/generated_defconfig
 
 #
 # Generated include files
diff --git a/Makefile b/Makefile
index a2bc9d590329..6fd0e92c7d5a 100644
--- a/Makefile
+++ b/Makefile
@@ -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
 
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 5ce5845e8247..079add4d5dab 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -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)