diff options
author | Angelo Compagnucci <angelo@amarulasolutions.com> | 2017-12-06 10:12:07 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2017-12-06 10:12:07 +0100 |
commit | 9906b2ecb6aec02d6348d6237b784135e6930d0b (patch) | |
tree | 0e97c9f59a3e475220277c45bc3536d03173b8a4 | |
parent | a6a59693066fd8da81f7107479df3e32a129247d (diff) | |
download | i2c-tools-9906b2ecb6aec02d6348d6237b784135e6930d0b.tar.gz |
Makefile: Add flag to disable dynamic library
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>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | lib/Module.mk | 6 |
2 files changed, 14 insertions, 2 deletions
@@ -32,12 +32,20 @@ CFLAGS ?= -O2 CFLAGS += -Wall SOCFLAGS := -fpic -D_REENTRANT $(CFLAGS) -USE_STATIC_LIB ?= 0 +BUILD_DYNAMIC_LIB ?= 1 BUILD_STATIC_LIB ?= 1 +USE_STATIC_LIB ?= 0 + ifeq ($(USE_STATIC_LIB),1) BUILD_STATIC_LIB := 1 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) +endif +endif + KERNELVERSION := $(shell uname -r) .PHONY: all strip clean install uninstall diff --git a/lib/Module.mk b/lib/Module.mk index fd2c8c4..44fa938 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 |