]>
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 | ||
bb616ddd | 10 | SCRIPT_SH = git-gui.sh |
41bdcda3 | 11 | GITGUI_BUILT_INS = git-citool |
bb616ddd | 12 | ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH)) |
41bdcda3 SP |
13 | |
14 | ifndef SHELL_PATH | |
15 | SHELL_PATH = /bin/sh | |
16 | endif | |
b3678bac | 17 | |
663e7cf8 SP |
18 | ifndef gitexecdir |
19 | gitexecdir := $(shell git --exec-path) | |
20 | endif | |
21 | ||
22 | ifndef INSTALL | |
23 | INSTALL = install | |
24 | endif | |
b3678bac | 25 | |
0b5ea163 SP |
26 | ifndef V |
27 | QUIET_GEN = @echo ' ' GEN $@; | |
28 | QUIET_BUILT_IN = @echo ' ' BUILTIN $@; | |
29 | endif | |
30 | ||
e2a1bc67 ER |
31 | TCLTK_PATH ?= wish |
32 | ||
0c3b4aac AR |
33 | ifeq ($(findstring $(MAKEFLAGS),s),s) |
34 | QUIET_GEN = | |
35 | QUIET_BUILT_IN = | |
36 | endif | |
37 | ||
b3678bac SP |
38 | DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) |
39 | gitexecdir_SQ = $(subst ','\'',$(gitexecdir)) | |
41bdcda3 SP |
40 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) |
41 | ||
bb616ddd | 42 | $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh |
0b5ea163 | 43 | $(QUIET_GEN)rm -f $@ $@+ && \ |
bb616ddd | 44 | sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ |
7e81d4ee | 45 | -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ |
0b5ea163 | 46 | $@.sh >$@+ && \ |
0b5ea163 | 47 | chmod +x $@+ && \ |
41bdcda3 SP |
48 | mv $@+ $@ |
49 | ||
50 | $(GITGUI_BUILT_INS): git-gui | |
0b5ea163 | 51 | $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@ |
41bdcda3 | 52 | |
bb616ddd SP |
53 | # These can record GITGUI_VERSION |
54 | $(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE | |
55 | ||
41bdcda3 | 56 | all:: $(ALL_PROGRAMS) |
b3678bac SP |
57 | |
58 | install: all | |
59 | $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' | |
e2a1bc67 | 60 | sed -i .bak -e'1,3s|^exec .* "$$0"|exec '"$(TCLTK_PATH)"' "$$0"|' git-gui && rm git-gui.bak |
b3678bac | 61 | $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)' |
41bdcda3 SP |
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 | ||
bb616ddd | 64 | dist-version: |
5d643cd3 SP |
65 | @mkdir -p $(TARDIR) |
66 | @echo $(GITGUI_VERSION) > $(TARDIR)/version | |
67 | ||
41bdcda3 | 68 | clean:: |
bb616ddd | 69 | rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE |
f1cee4e6 | 70 | |
5d643cd3 | 71 | .PHONY: all install dist-version clean |
f1cee4e6 | 72 | .PHONY: .FORCE-GIT-VERSION-FILE |