diff options
-rw-r--r-- | Makefile | 16 | ||||
-rw-r--r-- | TODO | 4 | ||||
-rw-r--r-- | mk/build.mk | 43 | ||||
-rw-r--r-- | mk/config.mk | 17 | ||||
-rw-r--r-- | src/libmdsclient/libmdsclient.pc.in | 9 | ||||
-rw-r--r-- | src/libmdsserver/libmdsserver.pc.in | 9 |
6 files changed, 88 insertions, 10 deletions
@@ -8,6 +8,22 @@ include mk/config.mk +# The version of the package. +MAJOR = 0 +MINOR = 1 +VERSION = $(MAJOR).$(MINOR) + +# The version of libmdsserver. +LIBMDSSERVER_MAJOR = $(MAJOR) +LIBMDSSERVER_MINOR = $(MINOR) +LIBMDSSERVER_VERSION = $(LIBMDSSERVER_MAJOR).$(LIBMDSSERVER_MINOR) + +# The version of libmdsclient. +LIBMDSCLIENT_MAJOR = $(MAJOR) +LIBMDSCLIENT_MINOR = $(MINOR) +LIBMDSCLIENT_VERSION = $(LIBMDSCLIENT_MAJOR).$(LIBMDSCLIENT_MINOR) + + # Splits of the info manual. INFOPARTS = 1 2 3 @@ -56,10 +56,6 @@ Need testing: vt colour -Makefile: - - When linking libraries, soname should be specified - Full introspection may be useful for debugging. 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 = + diff --git a/src/libmdsclient/libmdsclient.pc.in b/src/libmdsclient/libmdsclient.pc.in new file mode 100644 index 0000000..1d00c8f --- /dev/null +++ b/src/libmdsclient/libmdsclient.pc.in @@ -0,0 +1,9 @@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: libmdsclients +Description: Library for mds-clients +Version: @VERSION@ +Libs: -L${libdir} -lmdsclient @LIBS@ +Cflags: -I${includedir} @CFLAGS@ + diff --git a/src/libmdsserver/libmdsserver.pc.in b/src/libmdsserver/libmdsserver.pc.in new file mode 100644 index 0000000..4b463af --- /dev/null +++ b/src/libmdsserver/libmdsserver.pc.in @@ -0,0 +1,9 @@ +libdir=@LIBDIR@ +includedir=@INCLUDEDIR@ + +Name: libmdsserver +Description: Library for mds-servers +Version: @VERSION@ +Libs: -L${libdir} -lmdsserver @LIBS@ +Cflags: -I${includedir} @CFLAGS@ + |