hc
2023-02-14 0cc9b7c44253c93447ddf73e206fbdbb3d9f16b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From 14dee5707716629b1bc8d06b93cdfe9ea1a3b813 Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Mon, 29 Aug 2016 22:14:26 +0200
Subject: [PATCH] src/Makefile: add ENABLE_SHARED boolean to allow static-only
 build
 
Currently, the libaio builds sytem builds a shared library
unconditionally. In some environments, this is not possible or
desirable. This commit adds a new Makefile variable, ENABLE_SHARED,
which defaults to "1" (i.e shared library enabled) and that allows to
override this behavior, and therefore to disable the build and
installation of the shared library.
 
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 src/Makefile | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
 
diff --git a/src/Makefile b/src/Makefile
index eadb336..cfab240 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,12 +8,17 @@ SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
 LINK_FLAGS=
 LINK_FLAGS+=$(LDFLAGS)
+ENABLE_SHARED ?= 1
 
 soname=libaio.so.1
 minor=0
 micro=1
 libname=$(soname).$(minor).$(micro)
-all_targets += libaio.a $(libname)
+all_targets += libaio.a
+
+ifeq ($(ENABLE_SHARED),1)
+all_targets += $(libname)
+endif
 
 all: $(all_targets)
 
@@ -55,9 +60,11 @@ $(libname): $(libaio_sobjs) libaio.map
 install: $(all_targets)
     install -D -m 644 libaio.h $(includedir)/libaio.h
     install -D -m 644 libaio.a $(libdir)/libaio.a
+ifeq ($(ENABLE_SHARED),1)
     install -D -m 755 $(libname) $(libdir)/$(libname)
     ln -sf $(libname) $(libdir)/$(soname)
     ln -sf $(libname) $(libdir)/libaio.so
+endif
 
 $(libaio_objs): libaio.h
 
-- 
2.7.4