summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-06-17 20:28:11 +0000
committerkhali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0>2015-06-17 20:28:11 +0000
commit5c601942898b2e0ce733f7fd5ac1db50a0b9e1aa (patch)
treef0ecf8fd7ecbb92cbd8765ad8aa7f4641c1e2019
parente5cfe7c4807a23edb2ff27bed7a6ffd67d81e8f1 (diff)
downloadi2c-tools-5c601942898b2e0ce733f7fd5ac1db50a0b9e1aa.tar.gz
Enable static use of libi2c
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. git-svn-id: http://lm-sensors.org/svn/i2c-tools/trunk@6289 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r--Makefile4
-rw-r--r--tools/Module.mk4
2 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 252a126..3b49bd4 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,11 @@ CFLAGS ?= -O2
CFLAGS += -Wall
SOCFLAGS := -fpic -D_REENTRANT $(CFLAGS)
+USE_STATIC_LIB ?= 0
BUILD_STATIC_LIB ?= 1
+ifeq ($(USE_STATIC_LIB),1)
+BUILD_STATIC_LIB := 1
+endif
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