linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Makefile: add flag to disable dynamic libraries
@ 2017-11-30  8:12 Angelo Compagnucci
  2017-11-30  8:12 ` [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB Angelo Compagnucci
  2017-12-06  9:48 ` [PATCH 1/2] Makefile: add flag to disable dynamic libraries Jean Delvare
  0 siblings, 2 replies; 4+ messages in thread
From: Angelo Compagnucci @ 2017-11-30  8:12 UTC (permalink / raw)
  To: linux-i2c; +Cc: jdelvare, Angelo Compagnucci

In such cases where you need to disable entirely the dynamic
library compilation, now you can use the BUILD_DYNAMIC_LIB=0
flag.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 Makefile      | 8 ++++++++
 lib/Module.mk | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index c85317c..a9ab4a2 100644
--- a/Makefile
+++ b/Makefile
@@ -38,6 +38,14 @@ ifeq ($(USE_STATIC_LIB),1)
 BUILD_STATIC_LIB := 1
 endif
 
+BUILD_DYNAMIC_LIB ?= 1
+
+ifeq ($(BUILD_DYNAMIC_LIB),0)
+ifeq ($(BUILD_STATIC_LIB),0)
+$(error BUILD_DYNAMIC_LIB and BUILD_STATIC_LIB cannot be disabled at the same time)
+endif
+endif
+
 KERNELVERSION	:= $(shell uname -r)
 
 .PHONY: all strip clean install uninstall
diff --git a/lib/Module.mk b/lib/Module.mk
index 432a051..9dc2642 100644
--- a/lib/Module.mk
+++ b/lib/Module.mk
@@ -27,9 +27,13 @@ LIB_SHSONAME	:= $(LIB_SHBASENAME).$(LIB_MAINVER)
 LIB_SHLIBNAME	:= $(LIB_SHBASENAME).$(LIB_VER)
 LIB_STLIBNAME	:= libi2c.a
 
-LIB_TARGETS	:= $(LIB_SHLIBNAME)
 LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
 LIB_OBJECTS	:= smbus.o
+
+LIB_TARGETS :=
+ifeq ($(BUILD_DYNAMIC_LIB),1)
+LIB_TARGETS	+= $(LIB_SHLIBNAME)
+endif
 ifeq ($(BUILD_STATIC_LIB),1)
 LIB_TARGETS	+= $(LIB_STLIBNAME)
 LIB_OBJECTS	+= smbus.ao
-- 
2.7.4

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

* [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB
  2017-11-30  8:12 [PATCH 1/2] Makefile: add flag to disable dynamic libraries Angelo Compagnucci
@ 2017-11-30  8:12 ` Angelo Compagnucci
  2017-12-06  9:48   ` Jean Delvare
  2017-12-06  9:48 ` [PATCH 1/2] Makefile: add flag to disable dynamic libraries Jean Delvare
  1 sibling, 1 reply; 4+ messages in thread
From: Angelo Compagnucci @ 2017-11-30  8:12 UTC (permalink / raw)
  To: linux-i2c; +Cc: jdelvare, Angelo Compagnucci

This patch adds the documentation for the newly introduced
BUILD_DYNAMIC_LIB flag and clarify the use of the other
variables USE_STATIC_LIB and BUILD_STATIC_LIB.

Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
---
 README | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/README b/README
index 4ccdf5b..d127f25 100644
--- a/README
+++ b/README
@@ -66,6 +66,15 @@ setting prefix to wherever you want. You may change the C compiler and the
 compilation flags as well, and also decide whether to build the static
 library or not.
 
+In cases where you need to compile only the static or dynamic variant of
+the library, you can use BUILD_STATIC_LIB and BUILD_DYNAMIC_LIB at compile time:
+  $ make BUILD_DYNAMIC_LIB=1 BUILD_STATIC_LIB=0
+If you disable both, the compilation will abort with an error message.
+
+If you want to compile against the static version of the library
+you can do:
+  $ make USE_STATIC_LIB=1
+
 Optionally, you can run "make strip" prior to "make install" if you want
 smaller binaries. However, be aware that this will prevent any further
 attempt to debug the library and tools.
-- 
2.7.4

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

* Re: [PATCH 1/2] Makefile: add flag to disable dynamic libraries
  2017-11-30  8:12 [PATCH 1/2] Makefile: add flag to disable dynamic libraries Angelo Compagnucci
  2017-11-30  8:12 ` [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB Angelo Compagnucci
@ 2017-12-06  9:48 ` Jean Delvare
  1 sibling, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2017-12-06  9:48 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: linux-i2c

On Thu, 30 Nov 2017 09:12:26 +0100, Angelo Compagnucci wrote:
> In such cases where you need to disable entirely the dynamic
> library compilation, now you can use the BUILD_DYNAMIC_LIB=0
> flag.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  Makefile      | 8 ++++++++
>  lib/Module.mk | 6 +++++-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> (...)

Applied with some line reordering, thanks.

-- 
Jean Delvare
SUSE L3 Support

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

* Re: [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB
  2017-11-30  8:12 ` [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB Angelo Compagnucci
@ 2017-12-06  9:48   ` Jean Delvare
  0 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2017-12-06  9:48 UTC (permalink / raw)
  To: Angelo Compagnucci; +Cc: linux-i2c

On Thu, 30 Nov 2017 09:12:27 +0100, Angelo Compagnucci wrote:
> This patch adds the documentation for the newly introduced
> BUILD_DYNAMIC_LIB flag and clarify the use of the other
> variables USE_STATIC_LIB and BUILD_STATIC_LIB.
> 
> Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
> ---
>  README | 9 +++++++++
>  1 file changed, 9 insertions(+)
> (...)

Applied with minor editions, thanks.

-- 
Jean Delvare
SUSE L3 Support

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

end of thread, other threads:[~2017-12-06  9:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-30  8:12 [PATCH 1/2] Makefile: add flag to disable dynamic libraries Angelo Compagnucci
2017-11-30  8:12 ` [PATCH 2/2] README: adding documentation for BUILD_DYNAMIC_LIB Angelo Compagnucci
2017-12-06  9:48   ` Jean Delvare
2017-12-06  9:48 ` [PATCH 1/2] Makefile: add flag to disable dynamic libraries Jean Delvare

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