X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=Makefile;h=2c627afbaab085c72f58257399edca8da4d77fb5;hp=238d07d6a84e91e2c00605cff55afc534b6b11bc;hb=3c01cd2fe990d94651758ca858dd6ee326e73f7b;hpb=db4bc100e4afd0e405443f5bab4a242b989a6a64;ds=sidebyside diff --git a/Makefile b/Makefile index 238d07d..2c627af 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ -# Set PREFIX to wherever you want to install TopGit -PREFIX = $(HOME) -bindir = $(PREFIX)/bin -cmddir = $(PREFIX)/libexec/topgit -sharedir = $(PREFIX)/share/topgit +prefix = $(HOME) +bindir = $(prefix)/bin +cmddir = $(prefix)/libexec/topgit +sharedir = $(prefix)/share/topgit hooksdir = $(cmddir)/hooks -commands_in = tg-create.sh tg-delete.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)) @@ -15,7 +14,7 @@ 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' \ @@ -26,16 +25,19 @@ tg $(commands_out) $(hooks_out): % : %.sh mv $@+ $@ $(help_out): README - ./create-help.sh `echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` + @CMD=`echo $@ | sed -e 's/tg-//' -e 's/\.txt//'` && \ + echo '[HELP]' $$CMD && \ + ./create-help.sh $$CMD install:: all - 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 "$(sharedir)" - install $(help_out) "$(sharedir)" + 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)$(sharedir)" + install -m 644 $(help_out) "$(DESTDIR)$(sharedir)" clean:: rm -f tg $(commands_out) $(hooks_out) $(help_out)