aboutsummaryrefslogtreecommitdiffstats
path: root/mk
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-25 22:10:28 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-25 22:10:28 +0200
commitae1a58a29788f88926d59c40aac036ba6444ddb3 (patch)
treecb2fdee7d879ca7403be5b95c718a03fe8119c40 /mk
parentm (diff)
downloadmds-ae1a58a29788f88926d59c40aac036ba6444ddb3.tar.gz
mds-ae1a58a29788f88926d59c40aac036ba6444ddb3.tar.bz2
mds-ae1a58a29788f88926d59c40aac036ba6444ddb3.tar.xz
add pkg-config files and soname to libs and versioned so files
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'mk')
-rw-r--r--mk/build.mk43
-rw-r--r--mk/config.mk17
2 files changed, 54 insertions, 6 deletions
diff --git a/mk/build.mk b/mk/build.mk
index e1e61b1..3792966 100644
--- a/mk/build.mk
+++ b/mk/build.mk
@@ -8,10 +8,10 @@
libraries: libmdsserver libmdsclient
.PHONY: libmdsserver
-libmdsserver: bin/libmdsserver.so
+libmdsserver: $(foreach EXT,so so.$(LIBMDSSERVER_MAJOR) so.$(LIBMDSSERVER_VERSION) pc,bin/libmdsserver.$(EXT))
.PHONY: libmdsclient
-libmdsclient: bin/libmdsclient.so
+libmdsclient: $(foreach EXT,so so.$(LIBMDSCLIENT_MAJOR) so.$(LIBMDSCLIENT_VERSION) pc,bin/libmdsclient.$(EXT))
.PHONY: servers
servers: $(foreach S,$(SERVERS),bin/$(S))
@@ -116,9 +116,15 @@ endif
# Build libmdsserver.
-bin/libmdsserver.so: $(foreach O,$(SERVEROBJ),obj/libmdsserver/$(O).o)
+bin/libmdsserver.so.$(LIBMDSSERVER_VERSION): $(foreach O,$(SERVEROBJ),obj/libmdsserver/$(O).o)
mkdir -p $(shell dirname $@)
- $(CC) $(C_FLAGS) -shared -o $@ $^
+ $(CC) $(C_FLAGS) -shared -Wl,-soname,libmdsclient.so.$(LIBMDSSERVER_MAJOR) -o $@ $^
+
+bin/libmdsserver.so.$(LIBMDSSERVER_MAJOR): bin/libmdsserver.so.$(LIBMDSSERVER_VERSION)
+ ln -sf libmdsserver.so.$(LIBMDSSERVER_VERSION) $@
+
+bin/libmdsserver.so: bin/libmdsserver.so.$(LIBMDSSERVER_VERSION)
+ ln -sf libmdsserver.so.$(LIBMDSSERVER_VERSION) $@
obj/libmdsserver/%.o: src/libmdsserver/%.c src/libmdsserver/*.h $(SEDED)
mkdir -p $(shell dirname $@)
@@ -154,13 +160,38 @@ src/libmdsserver/config.h: src/libmdsserver/config.h.in
sed -i 's:@MDS_STORAGE_ROOT_DIRECTORY@:$(MDS_STORAGE_ROOT_DIRECTORY):g' $@
endif
+bin/libmdsserver.pc: src/libmdsserver/libmdsserver.pc.in
+ mkdir -p $(shell dirname $@)
+ cp $< $@
+ sed -i 's:@LIBDIR@:$(LIBDIR):g' $@
+ sed -i 's:@INCLUDEDIR@:$(INCLUDEDIR):g' $@
+ sed -i 's:@VERSION@:$(LIBMDSSERVER_VERSION):g' $@
+ sed -i 's:@LIBS@:$(LIBMDSSERVER_LIBS):g' $@
+ sed -i 's:@CFLAGS@:$(LIBMDSSERVER_CFLAGS):g' $@
+
# Build libmdsclient.
-bin/libmdsclient.so: $(foreach O,$(CLIENTOBJ),obj/libmdsclient/$(O).o)
+bin/libmdsclient.so.$(LIBMDSCLIENT_VERSION): $(foreach O,$(CLIENTOBJ),obj/libmdsclient/$(O).o)
mkdir -p $(shell dirname $@)
- $(CC) $(C_FLAGS) -shared -o $@ $^
+ $(CC) $(C_FLAGS) -shared -Wl,-soname,libmdsclient.so.$(LIBMDSCLIENT_MAJOR) -o $@ $^
+
+bin/libmdsclient.so.$(LIBMDSCLIENT_MAJOR): bin/libmdsclient.so.$(LIBMDSCLIENT_VERSION)
+ ln -sf libmdsclient.so.$(LIBMDSCLIENT_VERSION) $@
+
+bin/libmdsclient.so: bin/libmdsclient.so.$(LIBMDSCLIENT_VERSION)
+ ln -sf libmdsclient.so.$(LIBMDSCLIENT_VERSION) $@
obj/libmdsclient/%.o: src/libmdsclient/%.c src/libmdsclient/*.h $(SEDED)
mkdir -p $(shell dirname $@)
$(CC) $(C_FLAGS) -fPIC -c -o $@ $<
+
+bin/libmdsclient.pc: src/libmdsclient/libmdsclient.pc.in
+ mkdir -p $(shell dirname $@)
+ cp $< $@
+ sed -i 's:@LIBDIR@:$(LIBDIR):g' $@
+ sed -i 's:@INCLUDEDIR@:$(INCLUDEDIR):g' $@
+ sed -i 's:@VERSION@:$(LIBMDSCLIENT_VERSION):g' $@
+ sed -i 's:@LIBS@:$(LIBMDSCLIENT_LIBS):g' $@
+ sed -i 's:@CFLAGS@:$(LIBMDSCLIENT_CFLAGS):g' $@
+
diff --git a/mk/config.mk b/mk/config.mk
index d824b73..1802c9a 100644
--- a/mk/config.mk
+++ b/mk/config.mk
@@ -12,6 +12,8 @@ BIN ?= /bin
LIB ?= /lib
# The executable library path excluding prefix.
LIBEXEC ?= /libexec
+# The header-file path excluding prefix.
+INCLUDE ?= /include
# The resource path excluding prefix.
DATA ?= /share
# The command path including prefix.
@@ -20,6 +22,8 @@ BINDIR ?= $(PREFIX)$(BIN)
LIBDIR ?= $(PREFIX)$(LIB)
# The executable library path including prefix.
LIBEXECDIR ?= $(PREFIX)$(LIBEXEC)
+# The header-file path including prefix.
+INCLUDEDIR ?= $(PREFIX)$(INCLUDE)
# The resource path including prefix.
DATADIR ?= $(PREFIX)$(DATA)
# The generic documentation path including prefix.
@@ -127,3 +131,16 @@ C_FLAGS = $(OPTIMISE) $(WARN) -std=$(STD) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
# Flags to pass into the manual compilers.
TEXIFLAGS = #--force
+
+# Linking flags for libraries required by libmdsserver.
+LIBMDSSERVER_LIBS =
+
+# C flags for libraries required by libmdsserver.
+LIBMDSSERVER_CFLAGS =
+
+# Linking flags for libraries required by libmdsclient.
+LIBMDSCLIENT_LIBS = -pthread
+
+# C flags for libraries required by libmdsclient.
+LIBMDSCLIENT_CFLAGS =
+