0001-src-Makefile-add-ENABLE_SHARED-boolean-to-allow-stat.patch 1.6 KB

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