From 9eff1e08b3e580d1e2a998af0243e27c8370c14e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 19 Mar 2013 14:29:04 -0400 Subject: Add pbs and pbs-help, to have it work like git --- Makefile | 55 +++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'Makefile') 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 -- cgit v1.2.2