git-gui: Support of "make -s" in: do not output anything of the build itself
[git] / Makefile
1 all::
2
3 # Define V=1 to have a more verbose compile.
4 #
5
6 GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7         @$(SHELL_PATH) ./GIT-VERSION-GEN
8 -include GIT-VERSION-FILE
9
10 GITGUI_BUILT_INS = git-citool
11 ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
12
13 ifndef SHELL_PATH
14         SHELL_PATH = /bin/sh
15 endif
16
17 ifndef gitexecdir
18         gitexecdir := $(shell git --exec-path)
19 endif
20
21 ifndef INSTALL
22         INSTALL = install
23 endif
24
25 ifndef V
26         QUIET_GEN      = @echo '   ' GEN $@;
27         QUIET_BUILT_IN = @echo '   ' BUILTIN $@;
28 endif
29
30 ifeq ($(findstring $(MAKEFLAGS),s),s)
31 QUIET_GEN =
32 QUIET_BUILT_IN =
33 endif
34
35 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
36 gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
37 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
38
39 git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
40         $(QUIET_GEN)rm -f $@ $@+ && \
41         sed -n \
42                 -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
43                 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
44                 -e '1,/^set gitgui_credits /p' \
45                 $@.sh >$@+ && \
46         cat CREDITS-FILE >>$@+ && \
47         sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+ && \
48         chmod +x $@+ && \
49         mv $@+ $@
50
51 CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
52         $(QUIET_GEN)$(SHELL_PATH) ./CREDITS-GEN
53
54 $(GITGUI_BUILT_INS): git-gui
55         $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
56
57 all:: $(ALL_PROGRAMS)
58
59 install: all
60         $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
61         $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
62         $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
63
64 dist-version: CREDITS-FILE
65         @mkdir -p $(TARDIR)
66         @echo $(GITGUI_VERSION) > $(TARDIR)/version
67         @cat CREDITS-FILE > $(TARDIR)/credits
68
69 clean::
70         rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
71
72 .PHONY: all install dist-version clean
73 .PHONY: .FORCE-GIT-VERSION-FILE
74 .PHONY: .FORCE-CREDITS-FILE