X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=Makefile;h=31cc98e6fecdc1cec803f8c5744eb9b324d5b4b0;hp=9b826c8e787dbfccee6b738ccc8cef1117cfbb60;hb=120b1ea119b87b3ea292f0c2e2416540e790fcd1;hpb=2e722cbe3f885dfe17ba511b70daa8fcbce22645 diff --git a/Makefile b/Makefile index 9b826c8..31cc98e 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,20 @@ -# Set PREFIX to wherever you want to install TopGit -PREFIX = $(HOME) -bindir = $(PREFIX)/bin -cmddir = $(PREFIX)/share/topgit -docdir = $(PREFIX)/share/doc/topgit -hooksdir = $(cmddir)/hooks +prefix ?= $(HOME) +bindir := $(prefix)/bin +cmddir := $(prefix)/share/topgit +docdir := $(prefix)/share/doc/topgit +hooksdir := $(cmddir)/hooks -commands_in = tg-create.sh tg-delete.sh tg-export.sh tg-info.sh tg-patch.sh tg-summary.sh tg-update.sh +commands_in := $(wildcard tg-*.sh) hooks_in = hooks/pre-commit.sh -commands_out = $(patsubst %.sh,%,$(commands_in)) -hooks_out = $(patsubst %.sh,%,$(hooks_in)) -help_out = $(patsubst %.sh,%.txt,$(commands_in)) +commands_out := $(patsubst %.sh,%,$(commands_in)) +hooks_out := $(patsubst %.sh,%,$(hooks_in)) +help_out := $(patsubst %.sh,%.txt,$(commands_in)) all:: tg $(commands_out) $(hooks_out) $(help_out) -tg $(commands_out) $(hooks_out): % : %.sh +tg $(commands_out) $(hooks_out): % : %.sh Makefile @echo "[SED] $@" @sed -e 's#@cmddir@#$(cmddir)#g;' \ -e 's#@hooksdir@#$(hooksdir)#g' \ @@ -31,14 +30,14 @@ $(help_out): README ./create-help.sh $$CMD install:: all - install -d -m 755 "$(bindir)" - install tg "$(bindir)" - install -d -m 755 "$(cmddir)" - install $(commands_out) "$(cmddir)" - install -d -m 755 "$(hooksdir)" - install $(hooks_out) "$(hooksdir)" - install -d -m 755 "$(docdir)" - install -m 644 $(help_out) "$(docdir)" + install -d -m 755 "$(DESTDIR)$(bindir)" + install tg "$(DESTDIR)$(bindir)" + install -d -m 755 "$(DESTDIR)$(cmddir)" + install $(commands_out) "$(DESTDIR)$(cmddir)" + install -d -m 755 "$(DESTDIR)$(hooksdir)" + install $(hooks_out) "$(DESTDIR)$(hooksdir)" + install -d -m 755 "$(DESTDIR)$(docdir)" + install -m 644 $(help_out) "$(DESTDIR)$(docdir)" clean:: rm -f tg $(commands_out) $(hooks_out) $(help_out)