summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-10-30 21:02:52 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-10-30 21:25:33 +0200
commitf2579c4984615609847759cbd5883b8db821b1ba (patch)
tree5742349e661a4c4e55f4e1540b052d5f3482965b
parent1b87863a75e6992a39f86a2f1c6c080364d37ef6 (diff)
Makefile: soversion symlinks and pkg-config
-rw-r--r--Makefile23
-rw-r--r--alsa.pc.in9
2 files changed, 27 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 3d31d75..25f9ca6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
PREFIX ?= /usr/local
libdir ?= /lib
includedir ?= /include
+pkgconfigdir ?= /lib/pkgconfig
MAKEFLAGS += --no-builtin-rules
@@ -12,26 +13,38 @@ override CFLAGS += -std=c11 $(WARNINGS)
override CPPFLAGS += -Iinclude
libs = libasound.so
+libsymlinks = libasound.so.2 libasound.so.2.0.0
+pkgconfigs = alsa.pc
all: $(libs)
%.so:
- $(LINK.c) $(filter %.c,$^) $(LDLIBS) -fPIC -shared -o $@
+ $(LINK.c) $(filter %.c,$^) $(LDLIBS) -fPIC -shared -Wl,-soname,$@.$(soabi).$(sompatch) -o $@.$(soabi).$(sompatch)
+ ln -fs $@.$(soabi).$(sompatch) $@.$(soabi)
+ ln -fs $@.$(soabi).$(sompatch) $@
+%.pc: %.pc.in
+ m4 -DINCLUDEDIR="$(PREFIX)$(includedir)" -DLIBDIR="$(PREFIX)$(libdir)" $^ > $@
+
+libasound.so: private override soabi=2
+libasound.so: private override sompatch=0.0
libasound.so: private override CPPFLAGS += -D_POSIX_SOURCE
libasound.so: private override CFLAGS += -Wno-unused-parameter -Wno-deprecated-declarations
libasound.so: private override LDFLAGS += -Wl,--version-script=libasound.map
libasound.so: private override LDLIBS += -lsndio
-libasound.so: libasound.c libasound.map stubs.h symversioning-hell.h
+libasound.so: libasound.c libasound.map stubs.h symversioning-hell.h alsa.pc
-install-lib: $(libs)
+install-lib: $(libs) $(libsymlinks)
install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(libdir)"
+install-pkgconfig: $(pkgconfigs)
+ install -Dm755 $^ -t "$(DESTDIR)$(PREFIX)$(pkgconfigdir)"
+
install-include:
install -Dm755 -d include/alsa "$(DESTDIR)$(PREFIX)$(includedir)"
-install: install-lib install-include
+install: install-lib install-pkgconfig install-include
clean:
- $(RM) $(libs)
+ $(RM) $(libs) $(libsymlinks) $(pkgconfigs)
.PHONY: all clean install
diff --git a/alsa.pc.in b/alsa.pc.in
new file mode 100644
index 0000000..46faff6
--- /dev/null
+++ b/alsa.pc.in
@@ -0,0 +1,9 @@
+libdir=LIBDIR/lib
+includedir=INCLUDEDIR/include
+
+Name: alsa
+Description: Advanced Linux Sound Architecture (ALSA) - Library
+Version: 1.1.7
+Requires:
+Libs: -L${libdir} -lasound
+Cflags: -I${includedir}