Skip to contentSkip to conversation

Makefile: Fix for 'make CFLAGS=...'

PATCH In review Phil Sutter 2 participants 3 messages Sep 8, 2025 – Sep 9, 2025

Subsystems (2)
lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 Makefile: Fix for 'make CFLAGS=...'

Appending to CFLAGS from configure.ac like this was too naive, passing custom CFLAGS in make arguments overwrites it. Extend AM_CFLAGS instead.

Fixes 64c07e38f0494 ("table: Embed creating nft version into userdata")
---
 Makefile.am  | 2 ++
 configure.ac | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
Makefile.am +2 -0
index 5190a49ae69f1..3e3f1e61092bb 100644
@@ -156,6 +156,8 @@ AM_CFLAGS = \
 	\
 	$(GCC_FVISIBILITY_HIDDEN) \
 	\
+	-DMAKE_STAMP=$(MAKE_STAMP) \
+	\
 	$(NULL)
 
 AM_YFLAGS = -d -Wno-yacc
configure.ac +0 -1
index da16a6e257c91..3517ea041f7ea 100644
@@ -153,7 +153,6 @@ AC_CONFIG_COMMANDS([nftversion.h], [
 # Current date should be fetched exactly once per build,
 # so have 'make' call date and pass the value to every 'gcc' call
 AC_SUBST([MAKE_STAMP], ["\$(shell date +%s)"])
-CFLAGS="${CFLAGS} -DMAKE_STAMP=\${MAKE_STAMP}"
 
 AC_CONFIG_FILES([					\
 		Makefile				\
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Phil Sutter

Appending to CFLAGS from configure.ac like this was too naive, passing custom CFLAGS in make arguments overwrites it. Extend AM_CFLAGS instead.

Fixes 64c07e38f0494 ("table: Embed creating nft version into userdata")

Thanks for fixing this.

Quoted 33 lines
---
 Makefile.am  | 2 ++
 configure.ac | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
Makefile.am +2 -0
index 5190a49ae69f1..3e3f1e61092bb 100644
@@ -156,6 +156,8 @@ AM_CFLAGS = \
 	\
 	$(GCC_FVISIBILITY_HIDDEN) \
 	\
+	-DMAKE_STAMP=$(MAKE_STAMP) \
+	\
 	$(NULL)
 
 AM_YFLAGS = -d -Wno-yacc
configure.ac +0 -1
index da16a6e257c91..3517ea041f7ea 100644
@@ -153,7 +153,6 @@ AC_CONFIG_COMMANDS([nftversion.h], [
 # Current date should be fetched exactly once per build,
 # so have 'make' call date and pass the value to every 'gcc' call
 AC_SUBST([MAKE_STAMP], ["\$(shell date +%s)"])
-CFLAGS="${CFLAGS} -DMAKE_STAMP=\${MAKE_STAMP}"
 
 AC_CONFIG_FILES([					\
 		Makefile				\
Signature · 1 line
2.51.0
author reviewer
#2 lore raw
Quoted 10 lines · Pablo Neira Ayuso
Quoted 5 lines · Phil Sutter

Appending to CFLAGS from configure.ac like this was too naive, passing custom CFLAGS in make arguments overwrites it. Extend AM_CFLAGS instead.

Fixes 64c07e38f0494 ("table: Embed creating nft version into userdata")

Thanks for fixing this.

Patch applied, sorry for breaking your use-case in the first place!