summaryrefslogtreecommitdiff
path: root/common.mk
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-12-07 15:11:10 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-12-09 14:20:48 -0500
commitd3486f6c1aa38be431f865e406e4cddd69d88d59 (patch)
tree5e0856123d80c74cc8d4c879a85d79f127d0964e /common.mk
parent056aac864aaa989a17703857e8e0e9b67726fc22 (diff)
make the Makefile(s)... mortal-friendly
I did this by making the assumption that the files in a directory are dividable into 2 groups: those that are executable, and those that aren't, and that all of the files in each group all go in the same folder when installed. These install directories are configurable per source directory with $(libre_execdir) and $(libre_datadir)
Diffstat (limited to 'common.mk')
-rw-r--r--common.mk37
1 files changed, 37 insertions, 0 deletions
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000..6248b80
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,37 @@
+# Configuration
+DESTDIR=
+
+#prefix=/usr/local
+prefix=/usr
+exec_prefix=$(prefix)
+datarootdir=$(prefix)/share
+
+bindir=$(exec_prefix)/bin
+sbindir=$(exec_prefix)/sbin
+#sysconfdir=$(prefix)/etc
+sysconfdir=/etc
+datadir=$(datarootdir)
+docdir=$(datarootdir)/doc
+
+################################################################################
+progs = $(shell find . -maxdepth 1 -type f -executable -printf '%f\n')
+confs = $(shell find . -maxdepth 1 -type f -not -executable -printf '%f\n'|fgrep -v Makefile)
+files = $(addprefix $(DESTDIR)$(libre_execdir)/,$(progs)) \
+ $(addprefix $(DESTDIR)$(libre_datadir)/,$(confs))
+
+all: PHONY build
+
+build: PHONY
+
+install: PHONY $(files)
+
+$(DESTDIR)$(libre_execdir)/%: %
+ install -Dm755 '$<' '$@'
+$(DESTDIR)$(libre_datadir)/%: %
+ install -Dm755 '$<' '$@'
+
+################################################################################
+
+FORCE: PHONY
+PHONY:
+.PHONY: FORCE PHONY