#! /usr/bin/make -f
# Makefile - makefile for building libmormegil.so
+include dirs.mk
include version.mk
-LIBDIR=$(DESTDIR)lib
-OBJDIR=$(DESTDIR)obj
-MANDIR=$(DESTDIR)man
-INCDIR=./include
-LIBMORMEGIL=$(LIBDIR)/libmormegil.so.$(MAJOR_VER).$(MINOR_VER).$(COMPAT_DEPTH)
-LIBOBJS=$(OBJDIR)/dice.o
-MANPAGES=$(MANDIR)/dice.3
+OBJ_BUILDDIR=obj
+LIB_BUILDDIR=lib
+LIB_REALNAME=libmormegil.so.$(MAJOR_VER).$(MINOR_VER).$(COMPAT_DEPTH)
+LIB_SONAME=libmormegil.so.$(MAJOR_VER)
+LIBMORMEGIL=$(LIB_BUILDDIR)/$(LIB_REALNAME)
+LIBOBJS=$(OBJ_BUILDDIR)/dice.o
+LIBS=$(LIB_BUILDDIR)/$(LIB_REALNAME)
+MANPAGES=man/dice.3
# GCC flags
-COMMON_FLAGS=-fPIC -I$(INCDIR)
+COMMON_FLAGS=-fPIC -I./include
CXXFLAGS=$(COMMON_FLAGS)
LINKSTEP_FLAGS=-shared -fPIC
-all: libs demos
+.PHONY: all clean install install-headers
-libs: $(LIBMORMEGIL)
+all: $(LIBS)
-$(OBJDIR)/%.o: src/%.c
+$(OBJ_BUILDDIR)/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
-$(OBJDIR)/%.o: src/%.cc
+$(OBJ_BUILDDIR)/%.o: src/%.cc
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
$(LIBMORMEGIL): $(LIBOBJS)
gcc $(LINKSTEP_FLAGS) $< -o $@
clean:
- -rm -f $(LIBMORMEGIL) $(OBJDIR)/*.o
+ -rm -f $(LIBS) $(LIBOBJS)
+
+install: install-headers
+ cp $(LIBMORMEGIL_BUILT) $(DESTDIR)$(libdir)/$(LIB_REALNAME)
+ (cd $(DESTDIR)$(libdir) && ln -s $(LIB_REALNAME) $(LIB_SONAME) )
+
+ifeq ($(oldincludedir),"")
+install-headers:
+ mkdir -p $(DESTDIR)$(oldincludedir)/libmormegil
+ cp $(INCDIR)/libmormegil/* $(DESTDIR)$(oldincludedir)/libmormegil
+ mkdir -p $(DESTDIR)$(includedir)/libmormegil
+ cp $(INCDIR)/libmormegil/* $(DESTDIR)$(includedir)/libmormegil
+else
+install-headers:
+ mkdir -p $(DESTDIR)$(includedir)/libmormegil
+ cp $(INCDIR)/libmormegil/* $(DESTDIR)$(includedir)/libmormegil
+endif
# vim:noexpandtab:format=cq
== INSTALLATION
-Some elements of libmormegil are self-contained single-header C++ classes
-which you can safely copy directly into your own projects if you want. Others
-are intended to be installed as system-wide shared libraries.
+If you want to set up a system-wide installation,
+
+ ./configure && make all && sudo make install
+
+should do the trick. If it doesn't, let me know what platform you're on and
+how to fix the issue.
== ACKNOWLEDGEMENTS
Contributions are accepted only under the terms of the BSD licence used on the
existing code.
+
+== DO NOT REQUEST
+
+Things not to submit:
+
+* Patches that depend on recursive make. '''Everything''' is built using
+ the top-level Makefile.
+
+* Patches that depend on GNU autotools.
+
+Things not to request (but feel free to submit patches to provide, on the
+understanding that if they break, I'm not going to fix them):
+
+* Support for building under Your Favourite GUI Tool
+