Re: i2c-tools: lib/Module.mk: fixing LIB_LINKS dependency

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

 



Hi Angelo,

On Mon, 11 Dec 2017 18:00:24 +0100, Angelo Compagnucci wrote:
> LIB_LINKS should be added as a dependency only when
> BUILD_DYNAMIC_LIB is enabled
> 
> Signed-off-by: Angelo Compagnucci <angelo@xxxxxxxxxxxxxxxxxxxx>
> ---
>  lib/Module.mk | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/Module.mk b/lib/Module.mk
> index 8a58f5b..de189a2 100644
> --- a/lib/Module.mk
> +++ b/lib/Module.mk
> @@ -27,10 +27,9 @@ LIB_SHSONAME	:= $(LIB_SHBASENAME).$(LIB_MAINVER)
>  LIB_SHLIBNAME	:= $(LIB_SHBASENAME).$(LIB_VER)
>  LIB_STLIBNAME	:= libi2c.a
>  
> -LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
> -
>  LIB_TARGETS	:=
>  ifeq ($(BUILD_DYNAMIC_LIB),1)
> +LIB_LINKS	:= $(LIB_SHSONAME) $(LIB_SHBASENAME)
>  LIB_TARGETS	+= $(LIB_SHLIBNAME)
>  endif
>  ifeq ($(BUILD_STATIC_LIB),1)

This is correct, good catch. I'll commit it. In fact I thought about it
when reviewing your previous patch, but (wrongly) assumed it did not
matter. After adding all the missing dependencies, it clearly does.

I have noticed another problem. While "make BUILD_STATIC_LIB=0"
actually prevents the static flavor of the library from being built,
"make BUILD_DYNAMIC_LIB=0" does not prevent the dynamic flavor of the
library from being built. The reason is that USE_STATIC_LIB is not set,
so tools depend on the dynamic library, which in turn gets built as a
dependency.

I suppose that BUILD_DYNAMIC_LIB=0 should imply USE_STATIC_LIB=1.
Something like:

--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,8 @@ endif
 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)
+else
+USE_STATIC_LIB := 1
 endif
 endif

What do you think?

Thanks,
-- 
Jean Delvare
SUSE L3 Support



[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