1all::
2
3SCRIPT_SH = git-gui.sh
4GITGUI_BUILT_INS = git-citool
5ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
6GITGUI_VERSION := $(shell git describe)
7
8ifndef SHELL_PATH
9 SHELL_PATH = /bin/sh
10endif
11
12gitexecdir := $(shell git --exec-path)
13INSTALL = install
14
15DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
16gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
17
18SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
19
20$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
21 rm -f $@ $@+
22 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
23 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
24 $@.sh >$@+
25 chmod +x $@+
26 mv $@+ $@
27
28$(GITGUI_BUILT_INS): git-gui
29 rm -f $@ && ln git-gui $@
30
31all:: $(ALL_PROGRAMS)
32
33install: all
34 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
35 $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
36 $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
37
38clean::
39 rm -f $(ALL_PROGRAMS)