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
34 INSTALL_D0
= $(INSTALL
) -d
-m755
# space is required here
36 INSTALL_R0
= $(INSTALL
) -m644
# space is required here
38 INSTALL_X0
= $(INSTALL
) -m755
# space is required here
40 INSTALL_L0
= rm -f
# space is required here
41 INSTALL_L1
= && ln
# space is required here
47 QUIET_GEN
= $(QUIET
)echo
' ' GEN
$@
&&
48 QUIET_BUILT_IN
= $(QUIET
)echo
' ' BUILTIN
$@
&&
49 QUIET_INDEX
= $(QUIET
)echo
' ' INDEX
$(dir $@
) &&
50 QUIET_2DEVNULL
= 2>/dev
/null
53 INSTALL_D1
= && echo
' ' DEST
$$dir && $(INSTALL
) -d
-m755
"$$dir"
55 INSTALL_R1
= && echo
' ' INSTALL
644 `basename $$src` && $(INSTALL
) -m644
$$src
57 INSTALL_X1
= && echo
' ' INSTALL
755 `basename $$src` && $(INSTALL
) -m755
$$src
62 INSTALL_L3
= && echo
' ' 'LINK ' `basename "$$dst"` '->' `basename "$$src"` && rm -f
"$$dst" && ln
"$$src" "$$dst"
68 ifeq ($(findstring $(MAKEFLAGS
),s
),s
)
73 DESTDIR_SQ
= $(subst ','\'',$(DESTDIR))
74 gitexecdir_SQ = $(subst ','\'',$(gitexecdir
))
75 SHELL_PATH_SQ
= $(subst ','\'',$(SHELL_PATH))
76 TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH
))
77 TCLTK_PATH_SQ
= $(subst ','\'',$(TCLTK_PATH))
79 gg_libdir ?= $(sharedir)/git-gui/lib
80 libdir_SQ = $(subst ','\'',$(gg_libdir
))
82 exedir
= $(dir $(gitexecdir
))share
/git-gui
/lib
83 exedir_SQ
= $(subst ','\'',$(exedir))
85 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
86 $(QUIET_GEN)rm -f $@ $@+ && \
88 if test '$(exedir_SQ
)' = '$(libdir_SQ
)'; then \
89 if test "$(uname_O)" = Cygwin; \
90 then GITGUI_RELATIVE= ; \
91 else GITGUI_RELATIVE=1; \
94 sed -e '1s|
#!.*/sh|#!$(SHELL_PATH_SQ)|' \
95 -e
's|^ exec wish "$$0"| exec $(subst |,'\|
',$(TCLTK_PATH_SQ)) "$$0"|' \
96 -e
's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
97 -e
's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
98 -e
$$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
103 $(GITGUI_BUILT_INS
): git-gui
104 $(QUIET_BUILT_IN
)rm -f
$@
&& ln git-gui
$@
106 lib
/tclIndex
: $(ALL_LIBFILES
)
107 $(QUIET_INDEX
)if echo \
108 $(foreach p
,$(PRELOAD_FILES
),source
$p\
;) \
109 auto_mkindex lib
'*.tcl' \
110 |
$(TCL_PATH
) $(QUIET_2DEVNULL
); then
: ok
; \
112 echo
1>&2 " * $(TCL_PATH) failed; using unoptimized loading"; \
114 echo
'# Autogenerated by git-gui Makefile' >$@
&& \
116 $(foreach p
,$(PRELOAD_FILES
) $(ALL_LIBFILES
),echo
'$(subst lib/,,$p)' >>$@
&&) \
120 # These can record GITGUI_VERSION
121 $(patsubst %.sh
,%,$(SCRIPT_SH
)): GIT-VERSION-FILE GIT-GUI-VARS
122 lib
/tclIndex
: GIT-GUI-VARS
125 $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ
)') \
126 $(subst ','\'',TCL_PATH
='$(TCL_PATH_SQ)') \
127 $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ
)') \
128 $(subst ','\'',gitexecdir
='$(gitexecdir_SQ)') \
129 $(subst ','\'',gg_libdir='$(libdir_SQ
)') \
132 GIT-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"; \
139 all:: $(ALL_PROGRAMS) lib/tclIndex
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
151 @echo $(GITGUI_VERSION) > $(TARDIR)/version
154 rm -f $(ALL_PROGRAMS) lib/tclIndex
155 rm -f GIT-VERSION-FILE GIT-GUI-VARS
157 .PHONY: all install dist-version clean
158 .PHONY: .FORCE-GIT-VERSION-FILE
159 .PHONY: .FORCE-GIT-GUI-VARS