1 From 9906b2ecb6aec02d6348d6237b784135e6930d0b Mon Sep 17 00:00:00 2001
2 From: Angelo Compagnucci <angelo@amarulasolutions.com>
3 Date: Wed, 6 Dec 2017 10:12:07 +0100
4 Subject: Makefile: Add flag to disable dynamic library
6 In such cases where you need to disable entirely the dynamic
7 library compilation, now you can use the BUILD_DYNAMIC_LIB=0
10 Signed-off-by: Angelo Compagnucci <angelo@amarulasolutions.com>
11 Signed-off-by: Jean Delvare <jdelvare@suse.de>
13 Makefile | 10 +++++++++-
14 lib/Module.mk | 6 +++++-
15 2 files changed, 14 insertions(+), 2 deletions(-)
17 diff --git a/Makefile b/Makefile
18 index c85317c..1bb5572 100644
21 @@ -32,12 +32,20 @@ CFLAGS ?= -O2
23 SOCFLAGS := -fpic -D_REENTRANT $(CFLAGS)
26 +BUILD_DYNAMIC_LIB ?= 1
30 ifeq ($(USE_STATIC_LIB),1)
34 +ifeq ($(BUILD_DYNAMIC_LIB),0)
35 +ifeq ($(BUILD_STATIC_LIB),0)
36 +$(error BUILD_DYNAMIC_LIB and BUILD_STATIC_LIB cannot be disabled at the same time)
40 KERNELVERSION := $(shell uname -r)
42 .PHONY: all strip clean install uninstall
43 diff --git a/lib/Module.mk b/lib/Module.mk
44 index fd2c8c4..44fa938 100644
47 @@ -27,9 +27,13 @@ LIB_SHSONAME := $(LIB_SHBASENAME).$(LIB_MAINVER)
48 LIB_SHLIBNAME := $(LIB_SHBASENAME).$(LIB_VER)
49 LIB_STLIBNAME := libi2c.a
51 -LIB_TARGETS := $(LIB_SHLIBNAME)
52 LIB_LINKS := $(LIB_SHSONAME) $(LIB_SHBASENAME)
53 LIB_OBJECTS := smbus.o
56 +ifeq ($(BUILD_DYNAMIC_LIB),1)
57 +LIB_TARGETS += $(LIB_SHLIBNAME)
59 ifeq ($(BUILD_STATIC_LIB),1)
60 LIB_TARGETS += $(LIB_STLIBNAME)
61 LIB_OBJECTS += smbus.ao