[PATCH] i2c-tools: enable static use of libi2c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

When debugging embedded systems, it is often nice to simply TFTP the
desired i2ctool to the target without the hazzle of dealing with shared
libs. Using -static is overkill, too, so let's add a switch which will
only link functions from libi2c statically.

Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
---
 Makefile        | 2 ++
 tools/Module.mk | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index 252a126..6d36f2f 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,8 @@ CFLAGS		+= -Wall
 SOCFLAGS	:= -fpic -D_REENTRANT $(CFLAGS)
 
 BUILD_STATIC_LIB ?= 1
+# Uncomment to use static libi2c
+#USE_STATIC_LIB := 1
 
 KERNELVERSION	:= $(shell uname -r)
 
diff --git a/tools/Module.mk b/tools/Module.mk
index d14bb0c..8efddbb 100644
--- a/tools/Module.mk
+++ b/tools/Module.mk
@@ -12,7 +12,11 @@ TOOLS_DIR	:= tools
 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)
+else
 TOOLS_LDFLAGS	:= -Llib -li2c
+endif
 
 TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget
 
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux