Mark strings for translation.
[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
82a2d6bd
SP
10uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
11
bb616ddd 12SCRIPT_SH = git-gui.sh
41bdcda3 13GITGUI_BUILT_INS = git-citool
bb616ddd 14ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
f522c9b5 15ALL_LIBFILES = $(wildcard lib/*.tcl)
b9e7efb8 16PRELOAD_FILES = lib/class.tcl
41bdcda3
SP
17
18ifndef SHELL_PATH
19 SHELL_PATH = /bin/sh
20endif
b3678bac 21
663e7cf8
SP
22ifndef gitexecdir
23 gitexecdir := $(shell git --exec-path)
24endif
25
f522c9b5 26ifndef sharedir
ea75ee35 27 sharedir := $(dir $(gitexecdir))share
f522c9b5
SP
28endif
29
663e7cf8
SP
30ifndef INSTALL
31 INSTALL = install
32endif
b3678bac 33
573fe6d7
SP
34INSTALL_D0 = $(INSTALL) -d -m755 # space is required here
35INSTALL_D1 =
36INSTALL_R0 = $(INSTALL) -m644 # space is required here
37INSTALL_R1 =
38INSTALL_X0 = $(INSTALL) -m755 # space is required here
39INSTALL_X1 =
40INSTALL_L0 = rm -f # space is required here
41INSTALL_L1 = && ln # space is required here
42INSTALL_L2 =
43INSTALL_L3 =
44
0b5ea163 45ifndef V
573fe6d7
SP
46 QUIET = @
47 QUIET_GEN = $(QUIET)echo ' ' GEN $@ &&
48 QUIET_BUILT_IN = $(QUIET)echo ' ' BUILTIN $@ &&
49 QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) &&
b9e7efb8 50 QUIET_2DEVNULL = 2>/dev/null
573fe6d7
SP
51
52 INSTALL_D0 = dir=
53 INSTALL_D1 = && echo ' ' DEST $$dir && $(INSTALL) -d -m755 "$$dir"
54 INSTALL_R0 = src=
55 INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m644 $$src
56 INSTALL_X0 = src=
57 INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m755 $$src
58
59 INSTALL_L0 = dst=
60 INSTALL_L1 = && src=
61 INSTALL_L2 = && dst=
62 INSTALL_L3 = && echo ' ' 'LINK ' `basename "$$dst"` '->' `basename "$$src"` && rm -f "$$dst" && ln "$$src" "$$dst"
0b5ea163
SP
63endif
64
f522c9b5 65TCL_PATH ?= tclsh
845d377b
JH
66TCLTK_PATH ?= wish
67
0c3b4aac
AR
68ifeq ($(findstring $(MAKEFLAGS),s),s)
69QUIET_GEN =
70QUIET_BUILT_IN =
71endif
72
b3678bac
SP
73DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
74gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
41bdcda3 75SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
b9e7efb8 76TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
845d377b 77TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
41bdcda3 78
f522c9b5
SP
79libdir ?= $(sharedir)/git-gui/lib
80libdir_SQ = $(subst ','\'',$(libdir))
81
ea75ee35
SP
82exedir = $(dir $(gitexecdir))share/git-gui/lib
83exedir_SQ = $(subst ','\'',$(exedir))
84
bb616ddd 85$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
0b5ea163 86 $(QUIET_GEN)rm -f $@ $@+ && \
82a2d6bd 87 GITGUI_RELATIVE= && \
ea75ee35 88 if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \
82a2d6bd
SP
89 if test "$(uname_O)" = Cygwin; \
90 then GITGUI_RELATIVE= ; \
91 else GITGUI_RELATIVE=1; \
92 fi; \
ea75ee35 93 fi && \
bb616ddd 94 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
4e817d1a 95 -e 's|^ exec wish "$$0"| exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
7e81d4ee 96 -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
ea75ee35
SP
97 -e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
98 -e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
0b5ea163 99 $@.sh >$@+ && \
0b5ea163 100 chmod +x $@+ && \
41bdcda3
SP
101 mv $@+ $@
102
103$(GITGUI_BUILT_INS): git-gui
0b5ea163 104 $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
41bdcda3 105
f522c9b5 106lib/tclIndex: $(ALL_LIBFILES)
b9e7efb8
SP
107 $(QUIET_INDEX)if echo \
108 $(foreach p,$(PRELOAD_FILES),source $p\;) \
1f07c4e5 109 auto_mkindex lib '*.tcl' \
b9e7efb8
SP
110 | $(TCL_PATH) $(QUIET_2DEVNULL); then : ok; \
111 else \
112 echo 1>&2 " * $(TCL_PATH) failed; using unoptimized loading"; \
113 rm -f $@ ; \
114 echo '# Autogenerated by git-gui Makefile' >$@ && \
115 echo >>$@ && \
116 $(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
117 echo >>$@ ; \
118 fi
f522c9b5 119
bb616ddd 120# These can record GITGUI_VERSION
c6a5e403 121$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS
b9e7efb8 122lib/tclIndex: GIT-GUI-VARS
c6a5e403
SP
123
124TRACK_VARS = \
125 $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
b9e7efb8 126 $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \
c6a5e403 127 $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
ea75ee35 128 $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \
f522c9b5 129 $(subst ','\'',libdir='$(libdir_SQ)') \
c6a5e403
SP
130#end TRACK_VARS
131
132GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
133 @VARS='$(TRACK_VARS)'; \
134 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
135 echo 1>&2 " * new locations or Tcl/Tk interpreter"; \
136 echo 1>$@ "$$VARS"; \
137 fi
bb616ddd 138
f522c9b5 139all:: $(ALL_PROGRAMS) lib/tclIndex
b3678bac
SP
140
141install: all
573fe6d7
SP
142 $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
143 $(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
144 $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true
145 $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1)
146 $(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)'
147 $(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true
41bdcda3 148
bb616ddd 149dist-version:
5d643cd3
SP
150 @mkdir -p $(TARDIR)
151 @echo $(GITGUI_VERSION) > $(TARDIR)/version
152
41bdcda3 153clean::
f522c9b5
SP
154 rm -f $(ALL_PROGRAMS) lib/tclIndex
155 rm -f GIT-VERSION-FILE GIT-GUI-VARS
f1cee4e6 156
5d643cd3 157.PHONY: all install dist-version clean
f1cee4e6 158.PHONY: .FORCE-GIT-VERSION-FILE
c6a5e403 159.PHONY: .FORCE-GIT-GUI-VARS