git-gui: Rename GIT_VERSION to GITGUI_VERSION.
[git/git.git] / Makefile
CommitLineData
41bdcda3
SP
1all::
2
f1cee4e6
SP
3GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
4 @$(SHELL_PATH) ./GIT-VERSION-GEN
5-include GIT-VERSION-FILE
6
41bdcda3
SP
7SCRIPT_SH = git-gui.sh
8GITGUI_BUILT_INS = git-citool
9ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
41bdcda3
SP
10
11ifndef SHELL_PATH
12 SHELL_PATH = /bin/sh
13endif
b3678bac 14
663e7cf8
SP
15ifndef gitexecdir
16 gitexecdir := $(shell git --exec-path)
17endif
18
19ifndef INSTALL
20 INSTALL = install
21endif
b3678bac
SP
22
23DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
24gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
41bdcda3
SP
25SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
26
27$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
28 rm -f $@ $@+
29 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
7e81d4ee 30 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
41bdcda3
SP
31 $@.sh >$@+
32 chmod +x $@+
33 mv $@+ $@
34
35$(GITGUI_BUILT_INS): git-gui
36 rm -f $@ && ln git-gui $@
37
7e81d4ee 38# These can record GITGUI_VERSION
f1cee4e6
SP
39$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
40
41bdcda3 41all:: $(ALL_PROGRAMS)
b3678bac
SP
42
43install: all
44 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
45 $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
41bdcda3
SP
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
48clean::
f1cee4e6
SP
49 rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
50
51.PHONY: all install clean
52.PHONY: .FORCE-GIT-VERSION-FILE