summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-03-19 14:29:04 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-03-19 14:29:04 -0400
commit9eff1e08b3e580d1e2a998af0243e27c8370c14e (patch)
treeb8d5df160dbc49d166553b81094fd8310e676e3d /Makefile
parent21b3a17b9b3e0ab21354b22b8b4017380d0a39ea (diff)
Add pbs and pbs-help, to have it work like git
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 45 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 96fe6b2..cfbe4a9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,55 @@
PREFIX=/usr/local
-BINPROGS=$(shell find * -type f -executable)
+# in a bind, thes can all be set to the same directory
+pbs-bindir = $(PREFIX)/lib/pbs-core
+git-bindir = $(PREFIX)/lib/git-core
+bindir = $(PREFIX)/bin
+libreconfdir = /etc/libretools.d
-all: $(BINPROGS) pbs-convert.conf
+pbs-progs := $(shell printf '%s\n' pbs-* | fgrep -v .)
+git-progs := $(shell printf '%s\n' git-* | fgrep -v .)
+bin-progs = pbs
+libreconf := $(wildcard pbs-*.conf)
-install: $(addprefix $(DESTDIR)$(PREFIX)/bin/,$(BINPROGS)) $(DESTDIR)/etc/libretools.d/pbs.conf
+install-targets := \
+ $(addprefix $(DESTDIR)$(pbs-bindir)/,$(pbs-progs)) \
+ $(addprefix $(DESTDIR)$(git-bindir)/,$(git-progs)) \
+ $(addprefix $(DESTDIR)$(bindir)/,$(bin-progs)) \
+ $(addprefix $(DESTDIR)$(libreconfdir)/,$(libreconf))
-uninstall:
- for f in $(BINPROGS); do rm -f $(DESTDIR)$(PREFIX)/bin/$$f; done
- rm -f $(DESTDIR)/etc/libretools.d/pbs-convert.conf
+# phony rules
-$(DESTDIR)$(PREFIX)/bin/%: % | $(DESTDIR)$(PREFIX)/bin
- install -m755 '$*' '${@D}'
+all: PHONY $(pbs-progs) $(git-progs) $(bin-progs) $(libreconf)
-$(DESTDIR)/etc/libretools.d/pbs-convert.conf: pbs-convert.conf | $(DESTDIR)/etc/libretools.d
+clean: PHONY
+ rm -f pbs
+
+install: PHONY $(install-targets)
+
+uninstall: PHONY
+ for f in $(install-targets); do rm -f -- $(f); done
+
+# actual file rules
+
+pbs: pbs.in
+ sed 's|@pbs-bindir@|$(pbs-bindir)|g' < $< > $@
+ chmod 755 $@
+
+$(DESTDIR)$(pbs-bindir)/%: % | $(DESTDIR)$(pbs-bindir)
+ cp '$*' '${@D}'
+
+$(DESTDIR)$(git-bindir)/%: % | $(DESTDIR)$(git-bindir)
+ cp '$*' '${@D}'
+
+$(DESTDIR)$(bindir)/%: % | $(DESTDIR)$(bindir)
+ cp '$*' '${@D}'
+
+$(DESTDIR)$(libreconfdir)/%: % | $(DESTDIR)$(libreconfdir)
install -m644 '$*' '${@D}'
-$(DESTDIR)$(PREFIX)/bin $(DESTDIR)/etc/libretools.d:
+$(addprefix $(DESTDIR),$(pbs-bindir) $(git-bindir) $(bindir) $(libreconfdir)):
install -d '$@'
+
+# tricks
+
+.PHONY: PHONY