X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=blobdiff_plain;f=Makefile;h=b73a1f15b9c298e0e922df1c61f6fb15df8f7821;hp=3913d66b9de41db4bb2b78c0af2980a6dbc31cea;hb=11c70d59e524a64a44f810ce0da437a9e18a004c;hpb=308892d0c071135031994606170c8be6653e7197 diff --git a/Makefile b/Makefile index 3913d66..b73a1f1 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,43 @@ -# Set PREFIX to wherever you want to install TopGit -PREFIX = $(HOME) -bindir = $(PREFIX)/bin -cmddir = $(PREFIX)/libexec/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)) hooks_out = $(patsubst %.sh,%,$(hooks_in)) +help_out = $(patsubst %.sh,%.txt,$(commands_in)) -all:: tg $(commands_out) $(hooks_out) +all:: tg $(commands_out) $(hooks_out) $(help_out) tg $(commands_out) $(hooks_out): % : %.sh @echo "[SED] $@" @sed -e 's#@cmddir@#$(cmddir)#g;' \ -e 's#@hooksdir@#$(hooksdir)#g' \ -e 's#@bindir@#$(bindir)#g' \ + -e 's#@sharedir@#$(sharedir)#g' \ $@.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ +$(help_out): README + @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 "$(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) + rm -f tg $(commands_out) $(hooks_out) $(help_out)