Build sorcery, gitignore updates, revised README
authorfluffymormegil <mpread@chiark.greenend.org.uk>
Sun, 10 Oct 2010 22:14:59 +0000 (23:14 +0100)
committerfluffymormegil <mpread@chiark.greenend.org.uk>
Sun, 10 Oct 2010 22:14:59 +0000 (23:14 +0100)
.gitignore
Makefile
README

index d169934..7066ac2 100644 (file)
@@ -5,3 +5,4 @@
 *.gz
 *.tgz
 .*.sw?
+dirs.mk
index fe51d15..5a648c3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,53 @@
 #! /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
diff --git a/README b/README
index 424944e..434c502 100644 (file)
--- a/README
+++ b/README
@@ -5,9 +5,12 @@ that the GNU LGPL has the effect I desire when applied to C++ templates").
 
 == 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
 
@@ -40,3 +43,18 @@ Copyright assignment is neither required nor desired.
 
 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
+