Skip to contentSkip to conversation

allow to preset custom CFLAGS and LDFLAGS

PATCH Applied Wolfram Sang 1 participant 2 messages Aug 7, 2020 – Aug 10, 2020

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

PATCH v2 1/1 allow to preset custom CFLAGS and LDFLAGS

Sometimes I need to add some flags (like -static for the linker), so allow this for all CFLAGS and LDFLAGS used in this project.

---

Changes since v1:
* update all Module.mk, not just tools
* add entry to CHANGES

 CHANGES          | 1 +
 eeprog/Module.mk | 6 +++---
 lib/Module.mk    | 2 +-
 tools/Module.mk  | 6 +++---
 4 files changed, 8 insertions(+), 7 deletions(-)
CHANGES +1 -0
index e3ff3a0..f5c7d33 100644
@@ -2,6 +2,7 @@ i2c-tools CHANGES
 -----------------
 
 master
+  Makefile: allow to preset all CFLAGS and LDFLAGS variables
   tools: Consistently use snprintf instead of sprintf
          Restrict addresses 0x03-0x07, too (defined by I2C standard)
   decode-dimms: Print SPD revision for DDR3 too
eeprog/Module.mk +3 -3
index ac3a368..3f442aa 100644
@@ -7,11 +7,11 @@
 
 EEPROG_DIR	:= eeprog
 
-EEPROG_CFLAGS	:= -Iinclude
+EEPROG_CFLAGS	+= -Iinclude
 ifeq ($(USE_STATIC_LIB),1)
-EEPROG_LDFLAGS	:= $(LIB_DIR)/$(LIB_STLIBNAME)
+EEPROG_LDFLAGS	+= $(LIB_DIR)/$(LIB_STLIBNAME)
 else
-EEPROG_LDFLAGS	:= -L$(LIB_DIR) -li2c
+EEPROG_LDFLAGS	+= -L$(LIB_DIR) -li2c
 endif
 
 EEPROG_TARGETS	:= eeprog
lib/Module.mk +1 -1
index 46a1c91..6727de7 100644
@@ -9,7 +9,7 @@
 
 LIB_DIR		:= lib
 
-LIB_CFLAGS	:= -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
+LIB_CFLAGS	+= -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
 		   -Wcast-align -Wwrite-strings -Wnested-externs -Winline \
 		   -W -Wundef -Wmissing-prototypes -Iinclude
 
tools/Module.mk +3 -3
index 693102f..f5b133d 100644
@@ -9,13 +9,13 @@
 
 TOOLS_DIR	:= tools
 
-TOOLS_CFLAGS	:= -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
+TOOLS_CFLAGS	+= -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \
 		   -Wcast-align -Wwrite-strings -Wnested-externs -Winline \
 		   -W -Wundef -Wmissing-prototypes -Iinclude
 ifeq ($(USE_STATIC_LIB),1)
-TOOLS_LDFLAGS	:= $(LIB_DIR)/$(LIB_STLIBNAME)
+TOOLS_LDFLAGS	+= $(LIB_DIR)/$(LIB_STLIBNAME)
 else
-TOOLS_LDFLAGS	:= -L$(LIB_DIR) -li2c
+TOOLS_LDFLAGS	+= -L$(LIB_DIR) -li2c
 endif
 
 TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget i2ctransfer
Signature · 1 line
2.27.0
author Applied
#1 lore raw
Quoted 4 lines · Wolfram Sang

Sometimes I need to add some flags (like -static for the linker), so allow this for all CFLAGS and LDFLAGS used in this project.

Applied to master.