Allow passing of an alternative CVSROOT via -d.
[git] / git-gui / Makefile
1 all::
2
3 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
4         @$(SHELL_PATH) ./GIT-VERSION-GEN
5 -include GIT-VERSION-FILE
6
7 SCRIPT_SH = git-gui.sh
8 GITGUI_BUILT_INS = git-citool
9 ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
10
11 ifndef SHELL_PATH
12         SHELL_PATH = /bin/sh
13 endif
14
15 ifndef gitexecdir
16         gitexecdir := $(shell git --exec-path)
17 endif
18
19 ifndef INSTALL
20         INSTALL = install
21 endif
22
23 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
24 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
25 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
26
27 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
28         rm -f $@ $@+
29         sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
30                 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
31                 $@.sh >$@+
32         chmod +x $@+
33         mv $@+ $@
34
35 $(GITGUI_BUILT_INS): git-gui
36         rm -f $@ && ln git-gui $@
37
38 # These can record GITGUI_VERSION
39 $(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
40
41 all:: $(ALL_PROGRAMS)
42
43 install: all
44         $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
45         $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
46         $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
47
48 dist-version:
49         @mkdir -p $(TARDIR)
50         @echo $(GITGUI_VERSION) > $(TARDIR)/version
51
52 clean::
53         rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
54
55 .PHONY: all install dist-version clean
56 .PHONY: .FORCE-GIT-VERSION-FILE