object name: introduce ':/<oneline prefix>' notation
[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 GITGUI_BUILT_INS = git-citool
8 ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
9
10 ifndef SHELL_PATH
11         SHELL_PATH = /bin/sh
12 endif
13
14 ifndef gitexecdir
15         gitexecdir := $(shell git --exec-path)
16 endif
17
18 ifndef INSTALL
19         INSTALL = install
20 endif
21
22 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
23 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
24 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
25
26 git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
27         rm -f $@ $@+
28         sed -n \
29                 -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
30                 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
31                 -e '1,/^set gitgui_credits /p' \
32                 $@.sh >$@+
33         cat CREDITS-FILE >>$@+
34         sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+
35         chmod +x $@+
36         mv $@+ $@
37
38 CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
39         $(SHELL_PATH) ./CREDITS-GEN
40
41 $(GITGUI_BUILT_INS): git-gui
42         rm -f $@ && ln git-gui $@
43
44 all:: $(ALL_PROGRAMS)
45
46 install: all
47         $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
48         $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
49         $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
50
51 dist-version: CREDITS-FILE
52         @mkdir -p $(TARDIR)
53         @echo $(GITGUI_VERSION) > $(TARDIR)/version
54         @cat CREDITS-FILE > $(TARDIR)/credits
55
56 clean::
57         rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
58
59 .PHONY: all install dist-version clean
60 .PHONY: .FORCE-GIT-VERSION-FILE
61 .PHONY: .FORCE-CREDITS-FILE