summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2018-08-14 21:17:13 +0000
committerJeff Moyer <jmoyer@redhat.com>2018-10-22 14:41:18 -0400
commit970196192771eeda39fabcc59a5dae9613e871a8 (patch)
tree3a8b45bf03a183041260355cc9df3f98adc06ec2
parentd35f3c3cd77ba59ee64cb7a5cc4650258cf2e05c (diff)
downloadlibaio-970196192771eeda39fabcc59a5dae9613e871a8.tar.gz
src/Makefile: add ENABLE_SHARED boolean to allow static-only build
Currently, the libaio build 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> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
-rw-r--r--src/Makefile9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index f5a57d3..b437945 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