summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-01 16:14:45 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-01 16:18:35 +0200
commit60a247d75c24771b9352e50e724542a8b047c2cc (patch)
treefce7156cee9c630faf94c7883f2b2b0c5caa5d28
parent399dcc338e6539853fc94e6a2e565b0747925840 (diff)
Makefile: Support PREFIX & DESTDIRHEADmaster
-rw-r--r--Makefile22
-rw-r--r--config.mk8
2 files changed, 19 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 64612c4..03564b6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,21 +1,21 @@
-prefix = /usr/local
+include config.mk
-default: build/tibtoa.1
+all: build/tibtoa.1
-build/%.1: bin/%
+build/tibtoa.1: bin/tibtoa
mkdir -p build
- pod2man $< > $@
+ pod2man bin/tibtoa > $@
install: build/tibtoa.1
- mkdir -p $(prefix)/bin $(prefix)/share/man/man1
- cp bin/tibtoa $(prefix)/bin/tibtoa
- cp build/tibtoa.1 $(prefix)/share/man/man1/tibtoa.1
- chmod 755 $(prefix)/bin/tibtoa
- chmod 644 $(prefix)/share/man/man1/tibtoa.1
+ mkdir -p ${bin_dir} ${man_dir}/man1
+ cp bin/tibtoa ${bin_dir}/tibtoa
+ cp build/tibtoa.1 ${man_dir}/man1/tibtoa.1
+ chmod 755 ${bin_dir}/tibtoa
+ chmod 644 ${man_dir}/man1/tibtoa.1
uninstall:
- rm -f $(prefix)/bin/tibtoa
- rm -f $(prefix)/share/man/man1/tibtoa.1
+ rm -f ${bin_dir}/tibtoa
+ rm -f ${man_dir}/man1/tibtoa.1
clean:
rm -rf build
diff --git a/config.mk b/config.mk
new file mode 100644
index 0000000..701725a
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,8 @@
+# Prefix for all installed files
+PREFIX ?= /usr/local
+
+# Directories for manuals, executables, docs, data, etc.
+main_dir = ${DESTDIR}${PREFIX}
+man_dir = ${main_dir}/share/man
+bin_dir = ${main_dir}/bin
+doc_dir = ${main_dir}/share/doc