linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Subject: [PATCH v2] i2c-tools: enable static use of libi2c
Date: Wed, 17 Jun 2015 21:26:45 +0200	[thread overview]
Message-ID: <1434569205-30635-1-git-send-email-wsa@the-dreams.de> (raw)

From: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>

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-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>
---
 Makefile        | 4 ++++
 tools/Module.mk | 4 ++++
 2 files changed, 8 insertions(+)

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
 
-- 
2.1.4

             reply	other threads:[~2015-06-17 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 19:26 Wolfram Sang [this message]
     [not found] ` <1434569205-30635-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-06-17 20:28   ` [PATCH v2] i2c-tools: enable static use of libi2c Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434569205-30635-1-git-send-email-wsa@the-dreams.de \
    --to=wsa-z923lk4zbo2bacvfa/9k2g@public.gmane.org \
    --cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).