diff mbox series

[v3,1/1] Makefile: pass -undef option to cmd_gen_envp

Message ID 20240223114206.21720-1-sebastien.szymanski@armadeus.com
State Accepted
Commit ff3bcb17f43631e5637a67df56aec6e8b8733ec4
Delegated to: Tom Rini
Headers show
Series [v3,1/1] Makefile: pass -undef option to cmd_gen_envp | expand

Commit Message

Sébastien Szymanski Feb. 23, 2024, 11:42 a.m. UTC
Without the '-undef' option, the 'linux' string in .env files is
replaced with the string '1 '.
For example, in the board/armadeus/opos6uldev/opos6uldev.env file,

kernelimg=opos6ul-linux.bin

becomes

kernelimg=opos6ul-1 .bin

in the include/generated/env.in file.

That's because 'linux' is a System-specific Predefined Macros. [1]

Pass the '-undef' option to fix this issue.

[1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/cpp/System-specific-Predefined-Macros.html

Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
---

Changes for v3:
 - use -undef instead of ansi. With -undef, there is no need to modify
   iot2050.env and smegw01.env files anymore.

Changes for v2:
 - explain the change of iot2050.env and smegw01.env in the commit log

 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tom Rini Feb. 23, 2024, 8:38 p.m. UTC | #1
On Fri, Feb 23, 2024 at 12:42:06PM +0100, Sébastien Szymanski wrote:

> Without the '-undef' option, the 'linux' string in .env files is
> replaced with the string '1 '.
> For example, in the board/armadeus/opos6uldev/opos6uldev.env file,
> 
> kernelimg=opos6ul-linux.bin
> 
> becomes
> 
> kernelimg=opos6ul-1 .bin
> 
> in the include/generated/env.in file.
> 
> That's because 'linux' is a System-specific Predefined Macros. [1]
> 
> Pass the '-undef' option to fix this issue.
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/cpp/System-specific-Predefined-Macros.html
> 
> Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini March 4, 2024, 3:29 p.m. UTC | #2
On Fri, Feb 23, 2024 at 12:42:06PM +0100, Sébastien Szymanski wrote:

> Without the '-undef' option, the 'linux' string in .env files is
> replaced with the string '1 '.
> For example, in the board/armadeus/opos6uldev/opos6uldev.env file,
> 
> kernelimg=opos6ul-linux.bin
> 
> becomes
> 
> kernelimg=opos6ul-1 .bin
> 
> in the include/generated/env.in file.
> 
> That's because 'linux' is a System-specific Predefined Macros. [1]
> 
> Pass the '-undef' option to fix this issue.
> 
> [1] https://gcc.gnu.org/onlinedocs/gcc-13.2.0/cpp/System-specific-Predefined-Macros.html
> 
> Signed-off-by: Sébastien Szymanski <sebastien.szymanski@armadeus.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

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

Patch

diff --git a/Makefile b/Makefile
index 3b5db90df6f9..63b006e0e0f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1804,7 +1804,8 @@  ENV_FILE := $(if $(ENV_SOURCE_FILE),$(ENV_FILE_CFG),$(wildcard $(ENV_FILE_BOARD)
 quiet_cmd_gen_envp = ENVP    $@
       cmd_gen_envp = \
 	if [ -s "$(ENV_FILE)" ]; then \
-		$(CPP) -P $(CFLAGS) -x assembler-with-cpp -D__ASSEMBLY__ \
+		$(CPP) -P $(CFLAGS) -x assembler-with-cpp -undef \
+			-D__ASSEMBLY__ \
 			-D__UBOOT_CONFIG__ \
 			-I . -I include -I $(srctree)/include \
 			-include linux/kconfig.h -include include/config.h \