1 # Makefile.mak - POSIX Makefile.mak adjunct for TopGit
5 # Default target is all
8 # Makefile.sh sets many variables used by this Makefile.mak
14 shell_compatibility_test \
16 tg
$(commands_out
) $(utils_out
) $(awk_out
) $(hooks_out
) $(helpers_out
) \
17 bin-wrappers
/tg
$(help_out
) tg-tg.txt
21 helpers
: $(helpers_out
)
23 please_set_SHELL_PATH_to_a_more_modern_shell
: FORCE
26 shell_compatibility_test
: please_set_SHELL_PATH_to_a_more_modern_shell
28 # $(POUND) expands to a single '#' courtesy of Makefile.sh
33 QSED_
= $(AT
)echo
"[SED] $@" &&
36 QHELP_
= $(AT
)CMD
="$@" CMD
="$${CMD$(POUND)tg-}" && echo
"[HELP] $${CMD%.txt}" &&
39 QHELPTG_
= $(AT
)echo
"[HELP] tg" &&
40 QHELPTG_0
= $(QHELPTG_
)
41 QHELPTG
= $(QHELPTG_
$(V
))
42 QHTML_
= $(AT
)CMD
="$@" CMD
="$${CMD$(POUND)tg-}" && echo
"[HTML] $${CMD%.html}" &&
45 QHTMLTOPGIT_
= $(AT
)echo
"[HTML] topgit" &&
46 QHTMLTOPGIT_0
= $(QHTMLTOPGIT_
)
47 QHTMLTOPGIT
= $(QHTMLTOPGIT_
$(V
))
48 QWRAPPER_
= $(AT
)echo
"[WRAPPER] $@" &&
49 QWRAPPER_0
= $(QWRAPPER_
)
50 QWRAPPER
= $(QWRAPPER_
$(V
))
52 # Very important rule to avoid "accidents" caused by Makefile.sh's existence
53 # Some ridiculous "make" implementations will always implicitly "make Makefile"
54 # even though .POSIX: has been specified and that's definately NOT POSIX!
58 # Clean out the standard six single suffix inference rules to avoid accidents
59 .SUFFIXES
: .c .sh .f .c˜ .sh˜ .f˜
68 # The fatal flaw with .SUFFIXES is that while it's possible to add dependencies
69 # without listing rule commands, doing so prevents use of an inference rule
70 # because the dependency-adding-rule-with-no-commands is still considered a rule.
71 # Of course that means the free automatic dependency crated by an inference rule
72 # also can't be picked up but fortunately we have DEPFILE instead.
75 tg
$(commands_out
) $(utils_out
) $(hooks_out
) $(helpers_out
): Makefile Makefile.mak Makefile.sh TG-BUILD-SETTINGS
77 -e
'1s|#!.*/sh|#!$(SHELL_PATH)|' \
78 -e
'1s|#!.*/awk|#!$(AWK_PREFIX)$(AWK_PATH)|' \
79 -e
's#@cmddir@#$(cmddir)#g;' \
80 -e
's#@hooksdir@#$(hooksdir)#g' \
81 -e
's#@bindir@#$(bindir)#g' \
82 -e
's#@sharedir@#$(sharedir)#g' \
83 -e
's#@mingitver@#$(GIT_MINIMUM_VERSION)#g' \
84 -e
's#@tgsthelpusage@#$(TG_STATUS_HELP_USAGE)#g' \
85 -e
's#@SHELL_PATH@#$(SHELL_PATH_SQ)#g' \
86 -e
's#@AWK_PATH@#$(AWK_PATH_SQ)#g' \
92 tg--awksome
: $(awk_out
)
93 $(awk_out
): Makefile TG-BUILD-SETTINGS
95 -e
'1s|#!.*/awk|#!$(AWK_PREFIX)$(AWK_PATH_SQ)|' \
101 $(QWRAPPER
){ [ -d bin-wrappers
] || mkdir bin-wrappers
; } && \
102 echo
'#!$(SHELL_PATH_SQ)' >"$@" && \
103 curdir
="$$(pwd -P)" && \
104 echo
"TG_INST_CMDDIR='$$curdir' && export TG_INST_CMDDIR" >>"$@" && \
105 echo
"TG_INST_SHAREDIR='$$curdir' && export TG_INST_SHAREDIR" >>"$@" && \
106 echo
"TG_INST_HOOKSDIR='$$curdir' && export TG_INST_HOOKSDIR" >>"$@" && \
107 echo
'[ -n "$$tg__include" ] || exec $(SHELL_PATH_SQ) -c '\''. "$$TG_INST_CMDDIR/tg"'\'' tg "$$@" || exit' >>"$@" && \
108 echo
". '$$curdir/tg'" >>"$@" && \
111 $(help_out
): README create-help.sh
112 $(QHELP
)CMD
="$@" CMD
="$${CMD#tg-}" CMD
="$${CMD%.txt}" && \
113 $(SHELL_PATH
) .
/create-help.sh
"$$CMD"
117 install-doc
: install-html
119 html
: topgit.html
$(html_out
)
121 tg-tg.txt
: README create-html-usage.pl
$(commands_in
)
122 $(QHELPTG
)perl .
/create-html-usage.pl
--text
< README
> $@
124 topgit.html
: README create-html-usage.pl
$(commands_in
)
125 $(QHTMLTOPGIT
)perl .
/create-html-usage.pl
< README | rst2html.py
- $@
127 $(html_out
): create-html.sh
128 $(QHTML
)CMD
="$@" CMD
="$${CMD#tg-}" CMD
="$${CMD%.html}" && \
129 $(SHELL_PATH
) .
/create-html.sh
"$$CMD"
131 precheck
: precheck_DESTDIR_
$(DESTDIRBOOL
)
133 precheck_DESTDIR_No
: tg FORCE
135 precheck_DESTDIR_Yes
: FORCE
136 $(Q
)echo
"skipping precheck because DESTDIR is set"
139 install -d
-m
755 "$(DESTDIR)$(bindir)"
140 install tg
"$(DESTDIR)$(bindir)"
141 install -d
-m
755 "$(DESTDIR)$(cmddir)"
142 install $(commands_out
) $(utils_out
) "$(DESTDIR)$(cmddir)"
143 install -d
-m
755 "$(DESTDIR)$(cmddir)/awk"
144 install $(awk_out
) "$(DESTDIR)$(cmddir)/awk"
145 install -d
-m
755 "$(DESTDIR)$(hooksdir)"
146 install $(hooks_out
) "$(DESTDIR)$(hooksdir)"
147 install -d
-m
755 "$(DESTDIR)$(sharedir)"
148 install -m
644 $(help_out
) tg-tg.txt
"$(DESTDIR)$(sharedir)"
150 install-html
: html FORCE
151 install -d
-m
755 "$(DESTDIR)$(sharedir)"
152 install -m
644 topgit.html
$(html_out
) "$(DESTDIR)$(sharedir)"
155 rm -f tg
$(commands_out
) $(utils_out
) $(awk_out
) $(hooks_out
) $(helpers_out
) $(help_out
) tg-tg.txt topgit.html
$(html_out
)
156 rm -f TG-BUILD-SETTINGS Makefile.dep Makefile.var
158 +-$(Q
)$(GMAKE
) -C t
clean
161 TG_INST_BINDIR
='$(bindir)' \
162 TG_INST_CMDDIR
='$(cmddir)' \
163 TG_INST_HOOKSDIR
='$(hooksdir)' \
164 TG_INST_SHAREDIR
='$(sharedir)' \
165 SHELL_PATH
='$(SHELL_PATH)' \
166 AWK_PATH
='$(AWK_PATH)' \
167 TG_VERSION
='$(version)' \
168 TG_GIT_MINIMUM_VERSION
='$(GIT_MINIMUM_VERSION)' \
171 # Makefile.sh sets FORCE_SETTINGS_BUILD to FORCE and pre-runs
172 # make -f Makefile.mak TG-BUILD-SETTINGS thus avoiding this always
173 # causing the targets that depend on it to build while still forcing
174 # a rebuild if any settings actually change.
175 TG-BUILD-SETTINGS
: $(FORCE_SETTINGS_BUILD
)
176 $(Q
)if
test x
"$(BUILD_SETTINGS)" != x
"`cat \"$@\" 2>/dev/null`"; then \
177 echo
"* new build settings"; \
178 printf
'%s\n' "$(BUILD_SETTINGS)" >"$@"; \
182 +$(Q
)$(GMAKE
) -C t
all
184 FORCE
: __file_which_should_not_exist
186 # This "phony" target must have at least one command otherwise it will not
187 # actually run anything and so will not actually trigger the rules that depend
188 # on FORCE to run either. By using "true" instead of ":" "make"s that
189 # short-circuit directly to execvp should be able to run "true" directly.
190 __file_which_should_not_exist
: