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