Skip to content

Commit bb23009

Browse files
ChrisJohnsengitster
authored andcommitted
Documentation/Makefile: make most operations "quiet"
This adapts the "quiet make" implementation from the main Makefile. Signed-off-by: Chris Johnsen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eed1fcd commit bb23009

File tree

1 file changed

+55
-29
lines changed

1 file changed

+55
-29
lines changed

Documentation/Makefile

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,32 @@ endif
7676
# yourself - yes, all 6 characters of it!
7777
#
7878

79+
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
80+
QUIET_SUBDIR1 =
81+
82+
ifneq ($(findstring $(MAKEFLAGS),w),w)
83+
PRINT_DIR = --no-print-directory
84+
else # "make -w"
85+
NO_SUBDIR = :
86+
endif
87+
88+
ifneq ($(findstring $(MAKEFLAGS),s),s)
89+
ifndef V
90+
QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@;
91+
QUIET_XMLTO = @echo ' ' XMLTO $@;
92+
QUIET_DB2TEXI = @echo ' ' DB2TEXI $@;
93+
QUIET_MAKEINFO = @echo ' ' MAKEINFO $@;
94+
QUIET_DBLATEX = @echo ' ' DBLATEX $@;
95+
QUIET_XSLTPROC = @echo ' ' XSLTPROC $@;
96+
QUIET_GEN = @echo ' ' GEN $@;
97+
QUIET_STDERR = 2> /dev/null
98+
QUIET_SUBDIR0 = +@subdir=
99+
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
100+
$(MAKE) $(PRINT_DIR) -C $$subdir
101+
export V
102+
endif
103+
endif
104+
79105
all: html man
80106

81107
html: $(DOC_HTML)
@@ -119,16 +145,16 @@ install-html: html
119145
sh ./install-webdoc.sh $(DESTDIR)$(htmldir)
120146

121147
../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
122-
$(MAKE) -C ../ GIT-VERSION-FILE
148+
$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE
123149

124150
-include ../GIT-VERSION-FILE
125151

126152
#
127153
# Determine "include::" file references in asciidoc files.
128154
#
129155
doc.dep : $(wildcard *.txt) build-docdep.perl
130-
$(RM) $@+ $@
131-
$(PERL_PATH) ./build-docdep.perl >$@+
156+
$(QUIET_GEN)$(RM) $@+ $@ && \
157+
$(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
132158
mv $@+ $@
133159

134160
-include doc.dep
@@ -146,8 +172,8 @@ cmds_txt = cmds-ancillaryinterrogators.txt \
146172
$(cmds_txt): cmd-list.made
147173

148174
cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
149-
$(RM) $@
150-
$(PERL_PATH) ./cmd-list.perl ../command-list.txt
175+
$(QUIET_GEN)$(RM) $@ && \
176+
$(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
151177
date >$@
152178

153179
clean:
@@ -158,79 +184,79 @@ clean:
158184
$(RM) $(cmds_txt) *.made
159185

160186
$(MAN_HTML): %.html : %.txt
161-
$(RM) $@+ $@
187+
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
162188
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
163-
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
189+
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
164190
mv $@+ $@
165191

166192
%.1 %.5 %.7 : %.xml
167-
$(RM) $@
193+
$(QUIET_XMLTO)$(RM) $@ && \
168194
xmlto -m $(MANPAGE_XSL) man $<
169195

170196
%.xml : %.txt
171-
$(RM) $@+ $@
197+
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
172198
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
173-
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $<
199+
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
174200
mv $@+ $@
175201

176202
user-manual.xml: user-manual.txt user-manual.conf
177-
$(ASCIIDOC) -b docbook -d book $<
203+
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b docbook -d book $<
178204

179205
technical/api-index.txt: technical/api-index-skel.txt \
180206
technical/api-index.sh $(patsubst %,%.txt,$(API_DOCS))
181-
cd technical && sh ./api-index.sh
207+
$(QUIET_GEN)cd technical && sh ./api-index.sh
182208

183209
$(patsubst %,%.html,$(API_DOCS) technical/api-index): %.html : %.txt
184-
$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
210+
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
185211
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
186212

187213
XSLT = docbook.xsl
188214
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
189215

190216
user-manual.html: user-manual.xml
191-
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
217+
$(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
192218

193219
git.info: user-manual.texi
194-
$(MAKEINFO) --no-split -o $@ user-manual.texi
220+
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi
195221

196222
user-manual.texi: user-manual.xml
197-
$(RM) $@+ $@
223+
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
198224
$(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout | \
199-
$(PERL_PATH) fix-texi.perl >$@+
225+
$(PERL_PATH) fix-texi.perl >$@+ && \
200226
mv $@+ $@
201227

202228
user-manual.pdf: user-manual.xml
203-
$(RM) $@+ $@
204-
$(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $<
229+
$(QUIET_DBLATEX)$(RM) $@+ $@ && \
230+
$(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
205231
mv $@+ $@
206232

207233
gitman.texi: $(MAN_XML) cat-texi.perl
208-
$(RM) $@+ $@
234+
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
209235
($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
210-
--to-stdout $(xml);)) | $(PERL_PATH) cat-texi.perl $@ >$@+
236+
--to-stdout $(xml) &&) true) | $(PERL_PATH) cat-texi.perl $@ >$@+ && \
211237
mv $@+ $@
212238

213239
gitman.info: gitman.texi
214-
$(MAKEINFO) --no-split --no-validate $*.texi
240+
$(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
215241

216242
$(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
217-
$(RM) $@+ $@
218-
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+
243+
$(QUIET_DB2TEXI)$(RM) $@+ $@ && \
244+
$(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
219245
mv $@+ $@
220246

221247
howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
222-
$(RM) $@+ $@
223-
sh ./howto-index.sh $(wildcard howto/*.txt) >$@+
248+
$(QUIET_GEN)$(RM) $@+ $@ && \
249+
sh ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
224250
mv $@+ $@
225251

226252
$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
227-
$(ASCIIDOC) -b xhtml11 $*.txt
253+
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
228254

229255
WEBDOC_DEST = /pub/software/scm/git/docs
230256

231257
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
232-
$(RM) $@+ $@
233-
sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+
258+
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
259+
sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
234260
mv $@+ $@
235261

236262
install-webdoc : html

0 commit comments

Comments
 (0)