All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-16  2:01 ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-16  2:01 UTC (permalink / raw)
  To: linux-i2c, Jean Delvare; +Cc: linux-sh, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

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@sang-engineering.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-16  2:01 ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-16  2:01 UTC (permalink / raw)
  To: linux-i2c, Jean Delvare; +Cc: linux-sh, Wolfram Sang

From: Wolfram Sang <wsa+renesas@sang-engineering.com>

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@sang-engineering.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
       [not found] ` <1434420079-3029-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2015-06-17  9:06     ` Jean Delvare
  0 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2015-06-17  9:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA

Hallo Wolfram,

On Tue, 16 Jun 2015 04:01:19 +0200, Wolfram Sang wrote:
> 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.

Fine with me.

> Signed-off-by: Wolfram Sang <wsa+renesas-jBu1N2QxHDJrcw3mvpCnnVaTQe2KTcn/@public.gmane.org>
> ---
>  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

Any reason for not using ?= as above, with the default being unset?
That way BUILD_STATIC_LIB and USE_STATIC_LIB can both be controlled
using the same mechanism, and can be changed from their default value
on the command line (without patching the Makefile.)

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

Unrelated to your patch, but shouldn't this -Llib rather been written
-L$(LIB_DIR)?

Also it might make sense to check if USE_STATIC_LIB is set when
BUILD_STATIC_LIB isn't and complain about it?

>  
>  TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget
>  


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-17  9:06     ` Jean Delvare
  0 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2015-06-17  9:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA

Hallo Wolfram,

On Tue, 16 Jun 2015 04:01:19 +0200, Wolfram Sang wrote:
> From: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> 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.

Fine with me.

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  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

Any reason for not using ?= as above, with the default being unset?
That way BUILD_STATIC_LIB and USE_STATIC_LIB can both be controlled
using the same mechanism, and can be changed from their default value
on the command line (without patching the Makefile.)

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

Unrelated to your patch, but shouldn't this -Llib rather been written
-L$(LIB_DIR)?

Also it might make sense to check if USE_STATIC_LIB is set when
BUILD_STATIC_LIB isn't and complain about it?

>  
>  TOOLS_TARGETS	:= i2cdetect i2cdump i2cset i2cget
>  


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
  2015-06-17  9:06     ` Jean Delvare
@ 2015-06-17 10:53       ` Wolfram Sang
  -1 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-17 10:53 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c, linux-sh

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

Hi Jean,

> > 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.
> 
> Fine with me.

Hooray!

> >  BUILD_STATIC_LIB ?= 1
> > +# Uncomment to use static libi2c
> > +#USE_STATIC_LIB := 1
> 
> Any reason for not using ?= as above, with the default being unset?

Agreed.

> Unrelated to your patch, but shouldn't this -Llib rather been written
> -L$(LIB_DIR)?

Yes, makes sense.

> Also it might make sense to check if USE_STATIC_LIB is set when
> BUILD_STATIC_LIB isn't and complain about it?

For easier usage, I'd rather enforce BUILD_STATIC_LIB in that case.

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-17 10:53       ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-17 10:53 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-i2c, linux-sh

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]

Hi Jean,

> > 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.
> 
> Fine with me.

Hooray!

> >  BUILD_STATIC_LIB ?= 1
> > +# Uncomment to use static libi2c
> > +#USE_STATIC_LIB := 1
> 
> Any reason for not using ?= as above, with the default being unset?

Agreed.

> Unrelated to your patch, but shouldn't this -Llib rather been written
> -L$(LIB_DIR)?

Yes, makes sense.

> Also it might make sense to check if USE_STATIC_LIB is set when
> BUILD_STATIC_LIB isn't and complain about it?

For easier usage, I'd rather enforce BUILD_STATIC_LIB in that case.

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
  2015-06-17 10:53       ` Wolfram Sang
@ 2015-06-17 13:10         ` Jean Delvare
  -1 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2015-06-17 13:10 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-sh

On Wed, 17 Jun 2015 12:53:09 +0200, Wolfram Sang wrote:
> Hi Jean,
> 
> > > 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.
> > 
> > Fine with me.
> 
> Hooray!
> 
> > >  BUILD_STATIC_LIB ?= 1
> > > +# Uncomment to use static libi2c
> > > +#USE_STATIC_LIB := 1
> > 
> > Any reason for not using ?= as above, with the default being unset?
> 
> Agreed.
> 
> > Unrelated to your patch, but shouldn't this -Llib rather been written
> > -L$(LIB_DIR)?
> 
> Yes, makes sense.

OK, I'll fix it after applying your updated patch.

> > Also it might make sense to check if USE_STATIC_LIB is set when
> > BUILD_STATIC_LIB isn't and complain about it?
> 
> For easier usage, I'd rather enforce BUILD_STATIC_LIB in that case.

You mean that USE_STATIC_LIB = 1 would silently imply
BUILD_STATIC_LIB = 1? Yes, that's much better than my proposal.

I'm wondering if we should make it even more flexible, but I'm not sure
if it's worth the effort... Are you calling "make install" after that?
I guess not.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-17 13:10         ` Jean Delvare
  0 siblings, 0 replies; 10+ messages in thread
From: Jean Delvare @ 2015-06-17 13:10 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-sh

On Wed, 17 Jun 2015 12:53:09 +0200, Wolfram Sang wrote:
> Hi Jean,
> 
> > > 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.
> > 
> > Fine with me.
> 
> Hooray!
> 
> > >  BUILD_STATIC_LIB ?= 1
> > > +# Uncomment to use static libi2c
> > > +#USE_STATIC_LIB := 1
> > 
> > Any reason for not using ?= as above, with the default being unset?
> 
> Agreed.
> 
> > Unrelated to your patch, but shouldn't this -Llib rather been written
> > -L$(LIB_DIR)?
> 
> Yes, makes sense.

OK, I'll fix it after applying your updated patch.

> > Also it might make sense to check if USE_STATIC_LIB is set when
> > BUILD_STATIC_LIB isn't and complain about it?
> 
> For easier usage, I'd rather enforce BUILD_STATIC_LIB in that case.

You mean that USE_STATIC_LIB = 1 would silently imply
BUILD_STATIC_LIB = 1? Yes, that's much better than my proposal.

I'm wondering if we should make it even more flexible, but I'm not sure
if it's worth the effort... Are you calling "make install" after that?
I guess not.

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
       [not found]         ` <20150617151025.1353abe3-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
@ 2015-06-17 13:20             ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-17 13:20 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]


> You mean that USE_STATIC_LIB = 1 would silently imply
> BUILD_STATIC_LIB = 1? Yes, that's much better than my proposal.

Yes, I meant that.

> I'm wondering if we should make it even more flexible, but I'm not sure
> if it's worth the effort... Are you calling "make install" after that?
> I guess not.

No, I am not. I just copy the file to the TFTP dir.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] i2c-tools: enable static use of libi2c
@ 2015-06-17 13:20             ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2015-06-17 13:20 UTC (permalink / raw)
  To: Jean Delvare
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-sh-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 360 bytes --]


> You mean that USE_STATIC_LIB = 1 would silently imply
> BUILD_STATIC_LIB = 1? Yes, that's much better than my proposal.

Yes, I meant that.

> I'm wondering if we should make it even more flexible, but I'm not sure
> if it's worth the effort... Are you calling "make install" after that?
> I guess not.

No, I am not. I just copy the file to the TFTP dir.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-06-17 13:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-16  2:01 [PATCH] i2c-tools: enable static use of libi2c Wolfram Sang
2015-06-16  2:01 ` Wolfram Sang
     [not found] ` <1434420079-3029-1-git-send-email-wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2015-06-17  9:06   ` Jean Delvare
2015-06-17  9:06     ` Jean Delvare
2015-06-17 10:53     ` Wolfram Sang
2015-06-17 10:53       ` Wolfram Sang
2015-06-17 13:10       ` Jean Delvare
2015-06-17 13:10         ` Jean Delvare
     [not found]         ` <20150617151025.1353abe3-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-06-17 13:20           ` Wolfram Sang
2015-06-17 13:20             ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.