From 7a24cf7bec76bf2dd0753ef752738aa257122318 Mon Sep 17 00:00:00 2001 From: Martin Read Date: Mon, 28 Feb 2011 10:51:10 +0000 Subject: [PATCH] Updated Makefile to include stlfgets and stlprintf in the library --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index bbda91f..f682fbe 100644 --- a/Makefile +++ b/Makefile @@ -6,18 +6,29 @@ include version.mk OBJ_BUILDDIR=obj LIB_BUILDDIR=lib +# LIB_REALNAME = exact name of the library +# LIB_SONAME = name of the library from the linker's point of view +# LIB_SHORTNAME = unversioned name of the library LIB_REALNAME=libmormegil.so.$(MAJOR_VER).$(MINOR_VER).$(COMPAT_DEPTH) LIB_SONAME=libmormegil.so.$(MAJOR_VER) +LIB_SHORTNAME=libmormegil.so LIBMORMEGIL_BUILT=$(LIB_BUILDDIR)/$(LIB_REALNAME) -LIBOBJS=$(OBJ_BUILDDIR)/dice.o +LIBOBJS=$(OBJ_BUILDDIR)/dice.o $(OBJ_BUILDDIR)/stlprintf.o $(OBJ_BUILDDIR)/stlfgets.o LIBS=$(LIB_BUILDDIR)/$(LIB_REALNAME) MANPAGES=man/dice.3 SRCARCH_NAME=libmormegil-$(MAJOR_VER).$(MINOR_VER).$(COMPAT_DEPTH) # GCC flags -COMMON_FLAGS=-fPIC -I./include +# 1. This is a shared library, so we need -fPIC (position-independent code) +# when building each of the modules. +# 2. We need THIS version's headers to take precedence over the system +# headers. +COMMON_FLAGS=-fPIC -I./include -DLIBMORMEGIL_MAJVER=$(MAJOR_VER) -DLIBMORMEGIL_MINVER=$(MINOR_VER) -DLIBMORMEGIL_COMPAT_DEPTH=$(COMPAT_DEPTH) CXXFLAGS=$(COMMON_FLAGS) +# 3. For linking, we have to specify that the output should be a shared +# object and, as before, that we want position-independent code. LINKSTEP_FLAGS=-shared -fPIC +CFLAGS=$(COMMON_FLAGS) .PHONY: all clean install install-headers srcarchive @@ -30,7 +41,7 @@ $(OBJ_BUILDDIR)/%.o: src/%.cc $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $(LIBMORMEGIL_BUILT): $(LIBOBJS) - gcc $(LINKSTEP_FLAGS) $< -o $@ + gcc $(LINKSTEP_FLAGS) $^ -o $@ clean: -rm -f $(LIBS) $(LIBOBJS) @@ -38,7 +49,7 @@ clean: install: install-headers cp $(LIBMORMEGIL_BUILT) $(DESTDIR)$(libdir)/$(LIB_REALNAME) - (cd $(DESTDIR)$(libdir) && ln -sf $(LIB_REALNAME) $(LIB_SONAME) ) + (cd $(DESTDIR)$(libdir) && ln -sf $(LIB_REALNAME) $(LIB_SONAME) && ln -sf $(LIB_SONAME) $(LIB_SHORTNAME) ) srcarchive: clean mkdir $(SRCARCH_NAME) @@ -57,4 +68,4 @@ install-headers: cp include/libmormegil/* $(DESTDIR)$(includedir)/libmormegil endif -# vim:noexpandtab:format=cq +# vim:noexpandtab:fo=c -- 2.11.0