git-gui: Allow shift-{k,j} to select a range of branches to merge
[git/git.git] / Makefile
CommitLineData
41bdcda3
SP
1all::
2
0b5ea163
SP
3# Define V=1 to have a more verbose compile.
4#
5
f1cee4e6
SP
6GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
7 @$(SHELL_PATH) ./GIT-VERSION-GEN
8-include GIT-VERSION-FILE
9
bb616ddd 10SCRIPT_SH = git-gui.sh
41bdcda3 11GITGUI_BUILT_INS = git-citool
bb616ddd 12ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
f522c9b5 13ALL_LIBFILES = $(wildcard lib/*.tcl)
41bdcda3
SP
14
15ifndef SHELL_PATH
16 SHELL_PATH = /bin/sh
17endif
b3678bac 18
663e7cf8
SP
19ifndef gitexecdir
20 gitexecdir := $(shell git --exec-path)
21endif
22
f522c9b5
SP
23ifndef sharedir
24 sharedir := $(dir $(gitexecdir))/share
25endif
26
663e7cf8
SP
27ifndef INSTALL
28 INSTALL = install
29endif
b3678bac 30
0b5ea163
SP
31ifndef V
32 QUIET_GEN = @echo ' ' GEN $@;
33 QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
f522c9b5 34 QUIET_INDEX = @echo ' ' INDEX $(dir $@);
0b5ea163
SP
35endif
36
f522c9b5 37TCL_PATH ?= tclsh
845d377b
JH
38TCLTK_PATH ?= wish
39
0c3b4aac
AR
40ifeq ($(findstring $(MAKEFLAGS),s),s)
41QUIET_GEN =
42QUIET_BUILT_IN =
43endif
44
b3678bac
SP
45DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
46gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
41bdcda3 47SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
845d377b 48TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
41bdcda3 49
f522c9b5
SP
50libdir ?= $(sharedir)/git-gui/lib
51libdir_SQ = $(subst ','\'',$(libdir))
52
bb616ddd 53$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
0b5ea163 54 $(QUIET_GEN)rm -f $@ $@+ && \
bb616ddd 55 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
845d377b 56 -e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
7e81d4ee 57 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
f522c9b5 58 -e 's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
0b5ea163 59 $@.sh >$@+ && \
0b5ea163 60 chmod +x $@+ && \
41bdcda3
SP
61 mv $@+ $@
62
63$(GITGUI_BUILT_INS): git-gui
0b5ea163 64 $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
41bdcda3 65
f522c9b5
SP
66lib/tclIndex: $(ALL_LIBFILES)
67 $(QUIET_INDEX)echo auto_mkindex lib '*.tcl' | $(TCL_PATH)
68
bb616ddd 69# These can record GITGUI_VERSION
c6a5e403
SP
70$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS
71
72TRACK_VARS = \
73 $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
74 $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
f522c9b5 75 $(subst ','\'',libdir='$(libdir_SQ)') \
c6a5e403
SP
76#end TRACK_VARS
77
78GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
79 @VARS='$(TRACK_VARS)'; \
80 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
81 echo 1>&2 " * new locations or Tcl/Tk interpreter"; \
82 echo 1>$@ "$$VARS"; \
83 fi
bb616ddd 84
f522c9b5 85all:: $(ALL_PROGRAMS) lib/tclIndex
b3678bac
SP
86
87install: all
88 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)'
89 $(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
41bdcda3 90 $(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
f522c9b5
SP
91 $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(libdir_SQ)'
92 $(INSTALL) -m644 lib/tclIndex '$(DESTDIR_SQ)$(libdir_SQ)'
93 $(foreach p,$(ALL_LIBFILES), $(INSTALL) -m644 $p '$(DESTDIR_SQ)$(libdir_SQ)' ;)
41bdcda3 94
bb616ddd 95dist-version:
5d643cd3
SP
96 @mkdir -p $(TARDIR)
97 @echo $(GITGUI_VERSION) > $(TARDIR)/version
98
41bdcda3 99clean::
f522c9b5
SP
100 rm -f $(ALL_PROGRAMS) lib/tclIndex
101 rm -f GIT-VERSION-FILE GIT-GUI-VARS
f1cee4e6 102
5d643cd3 103.PHONY: all install dist-version clean
f1cee4e6 104.PHONY: .FORCE-GIT-VERSION-FILE
c6a5e403 105.PHONY: .FORCE-GIT-GUI-VARS