aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-09-04 02:40:59 +0200
committerMattias Andrée <maandree@operamail.com>2014-09-04 02:40:59 +0200
commit3dd1dc81f0c64f5ce842bfc5830b7e7b4dafbc96 (patch)
tree2ef5b261d013b7d13114ad887c863ca07801e2de /Makefile
parentadd -Wshadow (diff)
downloadlibgammamm-3dd1dc81f0c64f5ce842bfc5830b7e7b4dafbc96.tar.gz
libgammamm-3dd1dc81f0c64f5ce842bfc5830b7e7b4dafbc96.tar.bz2
libgammamm-3dd1dc81f0c64f5ce842bfc5830b7e7b4dafbc96.tar.xz
add install and uninstall rules
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--Makefile74
1 files changed, 71 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 1e221d3..51ada76 100644
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,14 @@
PREFIX ?= /usr
# The library path excluding prefix
LIB ?= /lib
+# The library header path excluding prefix.
+INCLUDE ?= /include
# The resource path excluding prefix
DATA ?= /share
# The library path including prefix
LIBDIR ?= $(PREFIX)$(LIB)
+# The library header including prefix.
+INCLUDEDIR ?= $(PREFIX)$(INCLUDE)
# The resource path including prefix
DATADIR ?= $(PREFIX)$(DATA)
# The generic documentation path including prefix
@@ -90,14 +94,28 @@ CXX_FLAGS = $(foreach D,$(DEFS),-D$(D)) -std=$(STD) \
LD_FLAGS = -lgamma -std=$(STD) $(OPTIMISE) $(LDFLAGS) $(WARN)
+# Header files
+HEADERS = libgamma libgamma-error libgamma-facade libgamma-method libgamma-native
-.PHONY: all
-all: bin/libgammamm.so bin/test
-bin/libgammamm.so: obj/libgamma-error.o obj/libgamma-facade.o obj/libgamma-method.o
+
+.PHONY: all lib test
+all: lib test
+lib: bin/libgammamm.$(SO).$(LIB_VERSION)
+test: bin/test
+
+bin/libgammamm.$(SO).$(LIB_VERSION): obj/libgamma-error.o obj/libgamma-facade.o obj/libgamma-method.o
@mkdir -p bin
$(CXX) $(LD_FLAGS) $(SHARED) $(LDSO) -o $@ $^
+bin/libgammamm.$(SO).$(LIB_MAJOR):
+ @mkdir -p bin
+ ln -sf libgammamm.$(SO).$(LIB_VERSION) $@
+
+bin/libgammamm.$(SO):
+ @mkdir -p bin
+ ln -sf libgammamm.$(SO).$(LIB_VERSION) $@
+
bin/test: obj/test.o obj/libgamma-error.o obj/libgamma-facade.o obj/libgamma-method.o
$(CXX) $(LD_FLAGS) -o $@ $^
@@ -107,6 +125,56 @@ obj/%.o: src/%.cc src/*.hh
+.PHONY: install
+install: install-base
+
+.PHONY: install
+install-all: install-base
+
+.PHONY: install-base
+install-base: install-lib install-include install-copyright
+
+
+.PHONY: install-lib
+install-lib: bin/libgammamm.$(SO).$(LIB_VERSION)
+ install -dm755 -- "$(DESTDIR)$(LIBDIR)"
+ install -m755 $< -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO).$(LIB_VERSION)"
+ ln -sf libgammamm.$(SO).$(LIB_VERSION) -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO).$(LIB_MAJOR)"
+ ln -sf libgammamm.$(SO).$(LIB_VERSION) -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO)"
+
+.PHONY: install-include
+install-include:
+ install -dm755 -- "$(DESTDIR)$(INCLUDEDIR)"
+ install -m644 $(foreach H,$(HEADERS),src/$(H).hh) -- "$(DESTDIR)$(INCLUDEDIR)"
+
+
+.PHONY: install-copyright
+install-copyright: install-copying install-license
+
+.PHONY: install-copying
+install-copying:
+ install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ install -m644 COPYING -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
+
+.PHONY: install-license
+install-license:
+ install -dm755 -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+ install -m644 LICENSE -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+
+
+
+.PHONY: uninstall
+uninstall:
+ -rm -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO).$(LIB_VERSION)"
+ -rm -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO).$(LIB_MAJOR)"
+ -rm -- "$(DESTDIR)$(LIBDIR)/libgammamm.$(SO)"
+ -rm -- $(foreach H,$(HEADERS),"$(DESTDIR)$(INCLUDEDIR)/$(H).hh")
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/COPYING"
+ -rm -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)/LICENSE"
+ -rmdir -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
+
+
+
.PHONY: clean
clean:
-rm -r obj bin