Use automake verbose helpers in custom make rules

This converts our script generation to use the built-in AM_V_GEN macro,
which honors the V= setting passed to make and allows one to see the
full command if they truly desire. The AM_V_at macro is also used in
place of an explicit @ so verbose-mode compiles show all commands being
run.

We can also use these two macros in doc generation to quiet it down to
the level we expect.

Other minor changes:
* a pointless test call is removed in test/pacman/tests/
* sed is used instead of dos2unix as we depend on it anyway
* consecutive chmod calls are reduced to a single call (e.g., '+x,a-x')

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2011-12-07 12:33:41 -06:00
parent dacda1f6b3
commit 781af8f91b
5 changed files with 27 additions and 35 deletions

View file

@ -35,19 +35,16 @@ edit = sed \
-e '1s|!/bin/bash|!$(BASH_SHELL)|g' -e '1s|!/bin/bash|!$(BASH_SHELL)|g'
$(OURSCRIPTS): Makefile $(OURSCRIPTS): Makefile
@echo ' ' GEN $@; $(AM_V_at)$(RM) $@ $@.tmp
@$(RM) $@ $@.tmp $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
@$(edit) $(srcdir)/$@.in >$@.tmp $(AM_V_at)chmod +x,a-w $@.tmp
@chmod +x $@.tmp $(AM_V_at)mv $@.tmp $@
@chmod a-w $@.tmp
@mv $@.tmp $@
$(OURFILES): Makefile $(OURFILES): Makefile
@echo ' ' GEN $@; $(AM_V_at)$(RM) $@ $@.tmp
@$(RM) $@ $@.tmp $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
@$(edit) $(srcdir)/$@.in >$@.tmp $(AM_V_at)chmod a-w $@.tmp
@chmod a-w $@.tmp $(AM_V_at)mv $@.tmp $@
@mv $@.tmp $@
all-am: $(OURSCRIPTS) $(OURFILES) all-am: $(OURSCRIPTS) $(OURFILES)

View file

@ -90,8 +90,10 @@ endif
html: $(HTML_DOCS) html: $(HTML_DOCS)
website: html website: website.tar.gz
bsdtar czf website.tar.gz $(HTML_DOCS) \
website.tar.gz: html
$(AM_V_GEN)bsdtar czf $@ $(HTML_DOCS) \
asciidoc-override.css \ asciidoc-override.css \
-C /etc/asciidoc/stylesheets/ \ -C /etc/asciidoc/stylesheets/ \
asciidoc.css \ asciidoc.css \
@ -119,15 +121,15 @@ A2X_OPTS = \
# These rules are due to the includes and files of the asciidoc text # These rules are due to the includes and files of the asciidoc text
$(ASCIIDOC_MANS): asciidoc.conf footer.txt Makefile $(ASCIIDOC_MANS): asciidoc.conf footer.txt Makefile
a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt $(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt
%.html: %.txt %.html: %.txt
asciidoc $(ASCIIDOC_OPTS) $*.txt $(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.txt | \
dos2unix $@ sed -e 's/\r$$//' > $@
HACKING.html: ../HACKING HACKING.html: ../HACKING
asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING $(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - ../HACKING | \
dos2unix $@ sed -e 's/\r$$//' > $@
# Customizations for certain HTML docs # Customizations for certain HTML docs
$(HTML_MANPAGES): asciidoc.conf footer.txt Makefile $(HTML_MANPAGES): asciidoc.conf footer.txt Makefile

View file

@ -22,10 +22,9 @@ edit = sed \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g' -e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
$(dist_sysconf_DATA): Makefile $(dist_sysconf_DATA): Makefile
@echo ' ' GEN $@; $(AM_V_at)$(RM) $@ $@.tmp
@$(RM) $@ $@.tmp $(AM_V_GEN)$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
@$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp $(AM_V_at)mv $@.tmp $@
@mv $@.tmp $@
makepkg.conf: $(srcdir)/makepkg.conf.in makepkg.conf: $(srcdir)/makepkg.conf.in
pacman.conf: $(srcdir)/pacman.conf.in pacman.conf: $(srcdir)/pacman.conf.in

View file

@ -60,14 +60,10 @@ edit = sed \
## All the scripts depend on Makefile so that they are rebuilt when the ## All the scripts depend on Makefile so that they are rebuilt when the
## prefix etc. changes. Use chmod -w to prevent people from editing the ## prefix etc. changes. Use chmod -w to prevent people from editing the
## wrong file by accident. ## wrong file by accident.
# two 'test' lines- make sure we can handle both sh and py type scripts
# third 'test' line- make sure one of the two checks succeeded
$(OURSCRIPTS): Makefile $(OURSCRIPTS): Makefile
@echo ' ' GEN $@; $(AM_V_at)$(RM) $@
@$(RM) $@ $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
@test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@ $(AM_V_at)chmod +x,a-w $@
@chmod +x $@
@chmod a-w $@
makepkg: \ makepkg: \
$(srcdir)/makepkg.sh.in \ $(srcdir)/makepkg.sh.in \

View file

@ -17,11 +17,9 @@ edit = sed \
$(CONFTESTS): Makefile $(CONFTESTS): Makefile
@echo ' ' GEN $@; $(AM_V_at)$(RM) $@ $@.tmp
@$(RM) $@ $@.tmp $(AM_V_GEN)test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@.tmp || true
@test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@.tmp || true $(AM_V_at)chmod a-w $@.tmp
@test -f $@.tmp || false $(AM_V_at)mv $@.tmp $@
@chmod a-w $@.tmp
@mv $@.tmp $@
# vim:set ts=2 sw=2 noet: # vim:set ts=2 sw=2 noet: