3 # Define V=1 to have a more verbose compile.
6 GIT-VERSION-FILE
: .FORCE-GIT-VERSION-FILE
7 @
$(SHELL_PATH
) .
/GIT-VERSION-GEN
8 -include GIT-VERSION-FILE
10 uname_O
:= $(shell sh
-c
'uname -o 2>/dev/null || echo not')
12 SCRIPT_SH
= git-gui.sh
13 GITGUI_BUILT_INS
= git-citool
14 ALL_PROGRAMS
= $(GITGUI_BUILT_INS
) $(patsubst %.sh
,%,$(SCRIPT_SH
))
15 ALL_LIBFILES
= $(wildcard lib
/*.tcl
)
16 PRELOAD_FILES
= lib
/class.tcl
23 gitexecdir
:= $(shell git
--exec-path
)
27 sharedir
:= $(dir $(gitexecdir
))share
37 INSTALL_D0
= $(INSTALL
) -d
-m755
# space is required here
39 INSTALL_R0
= $(INSTALL
) -m644
# space is required here
41 INSTALL_X0
= $(INSTALL
) -m755
# space is required here
43 INSTALL_L0
= rm -f
# space is required here
44 INSTALL_L1
= && ln
# space is required here
48 REMOVE_D0
= $(RMDIR
) # space is required here
50 REMOVE_F0
= $(RM_F
) # space is required here
56 QUIET_GEN
= $(QUIET
)echo
' ' GEN
$@
&&
57 QUIET_BUILT_IN
= $(QUIET
)echo
' ' BUILTIN
$@
&&
58 QUIET_INDEX
= $(QUIET
)echo
' ' INDEX
$(dir $@
) &&
59 QUIET_2DEVNULL
= 2>/dev
/null
62 INSTALL_D1
= && echo
' ' DEST
$$dir && $(INSTALL
) -d
-m755
"$$dir"
64 INSTALL_R1
= && echo
' ' INSTALL
644 `basename $$src` && $(INSTALL
) -m644
$$src
66 INSTALL_X1
= && echo
' ' INSTALL
755 `basename $$src` && $(INSTALL
) -m755
$$src
71 INSTALL_L3
= && echo
' ' 'LINK ' `basename "$$dst"` '->' `basename "$$src"` && rm -f
"$$dst" && ln
"$$src" "$$dst"
73 CLEAN_DST
= echo
' ' UNINSTALL
75 REMOVE_D1
= && echo
' ' REMOVE
$$dir && test -d
"$$dir" && $(RMDIR
) "$$dir" || true
77 REMOVE_F1
= && echo
' ' REMOVE
`basename "$$dst"` && $(RM_F
) "$$dst"
83 ifeq ($(findstring $(MAKEFLAGS
),s
),s
)
88 DESTDIR_SQ
= $(subst ','\'',$(DESTDIR))
89 gitexecdir_SQ = $(subst ','\'',$(gitexecdir
))
90 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
91 TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH
))
92 TCLTK_PATH_SQ
= $(subst ','\'',$(TCLTK_PATH))
94 gg_libdir ?= $(sharedir)/git-gui/lib
95 libdir_SQ = $(subst ','\'',$(gg_libdir
))
97 exedir
= $(dir $(gitexecdir
))share
/git-gui
/lib
98 exedir_SQ
= $(subst ','\'',$(exedir))
100 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
101 $(QUIET_GEN)rm -f $@ $@+ && \
102 GITGUI_RELATIVE= && \
103 if test '$(exedir_SQ
)' = '$(libdir_SQ
)'; then \
104 if test "$(uname_O)" = Cygwin; \
105 then GITGUI_RELATIVE= ; \
106 else GITGUI_RELATIVE=1; \
109 sed -e '1s|
#!.*/sh|#!$(SHELL_PATH_SQ)|' \
110 -e
's|^ exec wish "$$0"| exec $(subst |,'\|
',$(TCLTK_PATH_SQ)) "$$0"|' \
111 -e
's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
112 -e
's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
113 -e
$$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
118 $(GITGUI_BUILT_INS
): git-gui
119 $(QUIET_BUILT_IN
)rm -f
$@
&& ln git-gui
$@
121 lib
/tclIndex
: $(ALL_LIBFILES
)
122 $(QUIET_INDEX
)if echo \
123 $(foreach p
,$(PRELOAD_FILES
),source
$p\
;) \
124 auto_mkindex lib
'*.tcl' \
125 |
$(TCL_PATH
) $(QUIET_2DEVNULL
); then
: ok
; \
127 echo
1>&2 " * $(TCL_PATH) failed; using unoptimized loading"; \
129 echo
'# Autogenerated by git-gui Makefile' >$@
&& \
131 $(foreach p
,$(PRELOAD_FILES
) $(ALL_LIBFILES
),echo
'$(subst lib/,,$p)' >>$@
&&) \
135 # These can record GITGUI_VERSION
136 $(patsubst %.sh
,%,$(SCRIPT_SH
)): GIT-VERSION-FILE GIT-GUI-VARS
137 lib
/tclIndex
: GIT-GUI-VARS
140 $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ
)') \
141 $(subst ','\'',TCL_PATH
='$(TCL_PATH_SQ)') \
142 $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ
)') \
143 $(subst ','\'',gitexecdir
='$(gitexecdir_SQ)') \
144 $(subst ','\'',gg_libdir='$(libdir_SQ
)') \
147 GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
148 @VARS='$(TRACK_VARS
)'; \
149 if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
150 echo 1>&2 " * new locations or Tcl/Tk interpreter"; \
151 echo 1>$@ "$$VARS"; \
154 all:: $(ALL_PROGRAMS) lib/tclIndex
157 $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ
)$(gitexecdir_SQ
)' $(INSTALL_D1)
158 $(QUIET)$(INSTALL_X0)git-gui $(INSTALL_X1) '$(DESTDIR_SQ
)$(gitexecdir_SQ
)'
159 $(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
160 $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ
)$(libdir_SQ
)' $(INSTALL_D1)
161 $(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ
)$(libdir_SQ
)'
162 $(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ
)$(libdir_SQ
)' &&) true
165 $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ
)$(gitexecdir_SQ
)'
166 $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ
)$(gitexecdir_SQ
)'/git-gui $(REMOVE_F1)
167 $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ
)$(gitexecdir_SQ
)'/$p $(REMOVE_F1) &&) true
168 $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ
)$(libdir_SQ
)'
169 $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ
)$(libdir_SQ
)'/tclIndex $(REMOVE_F1)
170 $(QUIET)$(foreach p,$(ALL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ
)$(libdir_SQ
)'/$(notdir $p) $(REMOVE_F1) &&) true
171 $(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ
)$(gitexecdir_SQ
)' $(REMOVE_D1)
172 $(QUIET)$(REMOVE_D0)'$(DESTDIR_SQ
)$(libdir_SQ
)' $(REMOVE_D1)
173 $(QUIET)$(REMOVE_D0)`dirname '$(DESTDIR_SQ
)$(libdir_SQ
)'` $(REMOVE_D1)
177 @echo $(GITGUI_VERSION) > $(TARDIR)/version
180 rm -f $(ALL_PROGRAMS) lib/tclIndex
181 rm -f GIT-VERSION-FILE GIT-GUI-VARS
183 .PHONY: all install uninstall dist-version clean
184 .PHONY: .FORCE-GIT-VERSION-FILE
185 .PHONY: .FORCE-GIT-GUI-VARS