diff mbox series

[i2c-tools] tools: allow to preset TOOLS_CFLAGS and TOOLS_LDFLAGS

Message ID 20200805220555.9050-1-wsa@kernel.org
State Superseded
Headers show
Series [i2c-tools] tools: allow to preset TOOLS_CFLAGS and TOOLS_LDFLAGS | expand

Commit Message

Wolfram Sang Aug. 5, 2020, 10:05 p.m. UTC
Sometimes I need to add some flags (like -static for the linker), so
allow this.

Signed-off-by: Wolfram Sang <wsa@kernel.org>
---

Jean, what do you think?

 tools/Module.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jean Delvare Aug. 7, 2020, 9:40 a.m. UTC | #1
On Thu,  6 Aug 2020 00:05:55 +0200, Wolfram Sang wrote:
> Sometimes I need to add some flags (like -static for the linker), so
> allow this.

Does USE_STATIC_LIB=1 not work for you?

> 
> Signed-off-by: Wolfram Sang <wsa@kernel.org>
> ---
> 
> Jean, what do you think?

Fine with me. However for consistency I think it would make sense to do
the same in eeprog/Module.mk and lib/Module.mk?
Wolfram Sang Aug. 7, 2020, 9:42 a.m. UTC | #2
> > Sometimes I need to add some flags (like -static for the linker), so
> > allow this.
> 
> Does USE_STATIC_LIB=1 not work for you?

For some embedded devices, I need full static because they use a libc I
don't have at hand.

> > Jean, what do you think?
> 
> Fine with me. However for consistency I think it would make sense to do
> the same in eeprog/Module.mk and lib/Module.mk?

Sure, will add it.

Thanks!
Jean Delvare Aug. 7, 2020, 2:55 p.m. UTC | #3
On Fri, 7 Aug 2020 11:42:47 +0200, Wolfram Sang wrote:
> > > Sometimes I need to add some flags (like -static for the linker), so
> > > allow this.  
> > 
> > Does USE_STATIC_LIB=1 not work for you?  
> 
> For some embedded devices, I need full static because they use a libc I
> don't have at hand.

OK, if you think there are more people interested, feel free to
introduce another Makefile variable (STATIC_BUILD=1 for example) and
use that. Whatever makes your life easier really.
diff mbox series

Patch

diff --git a/tools/Module.mk b/tools/Module.mk
index 693102f..f5b133d 100644
--- a/tools/Module.mk
+++ b/tools/Module.mk
@@ -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