[pacman-dev] [PATCH] Use automake verbose helpers in custom make rules
Dave Reisner
d at falconindy.com
Wed Dec 7 19:54:27 EST 2011
On Wed, Dec 07, 2011 at 12:33:41PM -0600, Dan McGee wrote:
> 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 at archlinux.org>
> ---
>
> Dave, I know you are good at shell stuff- can you take a look at this and make
> sure it is kosher? Mainly the chmod changes (is that comma stuff
> cross-platform?), and the sed conversion (cd doc/; make website). Thanks!
multiple operations in chmod appears to be portable, so we're fine on
that. Any reason to use \x0D instead of \r in the sed replacement just
for readability at a glance? This looks great, otherwise.
d
> Example full complile run now, including docs:
>
> $ make -s -j3 V=0
> Making all in lib/libalpm
> Making all in po
> CC alpm.lo
> CC add.lo
> CC alpm_list.lo
> CC backup.lo
> CC be_local.lo
> CC be_package.lo
> CC be_sync.lo
> CC conflict.lo
> CC db.lo
> CC delta.lo
> CC deps.lo
> CC diskspace.lo
> CC dload.lo
> CC error.lo
> CC graph.lo
> CC group.lo
> CC handle.lo
> CC log.lo
> CC package.lo
> CC pkghash.lo
> CC rawstr.lo
> CC remove.lo
> CC signing.lo
> CC sync.lo
> CC trans.lo
> CC util.lo
> CC version.lo
> CC base64.lo
> CCLD libalpm.la
> Making all in src/util
> CC vercmp.o
> CC testpkg.o
> CC testdb.o
> CC cleanupdelta.o
> CC pacsort.o
> CC pactree.o
> CCLD vercmp
> CCLD testpkg
> CCLD testdb
> CCLD cleanupdelta
> CCLD pacsort
> CCLD pactree
> Making all in src/pacman
> Making all in po
> CC conf.o
> CC database.o
> CC deptest.o
> CC package.o
> CC pacman.o
> CC query.o
> CC remove.o
> CC sync.o
> CC callback.o
> CC upgrade.o
> CC util.o
> CCLD pacman
> Making all in scripts
> Making all in po
> GEN makepkg
> GEN pacman-db-upgrade
> GEN pacman-key
> GEN pacman-optimize
> GEN pkgdelta
> GEN rankmirrors
> GEN repo-add
> Making all in etc
> GEN makepkg.conf
> GEN pacman.conf
> Making all in test/pacman
> Making all in tests
> GEN sync200.py
> Making all in test/util
> Making all in contrib
> GEN pacdiff
> GEN bacman
> GEN paccache
> GEN paclist
> GEN paclog-pkglist
> GEN pacscripts
> GEN pacsearch
> GEN bash_completion
> GEN zsh_completion
> Making all in doc
> GEN pacman.8
> GEN makepkg.8
> GEN repo-add.8
> GEN vercmp.8
> GEN pkgdelta.8
> GEN pacman-key.8
> GEN PKGBUILD.5
> GEN makepkg.conf.5
> GEN pacman.conf.5
> GEN libalpm.3
>
>
> contrib/Makefile.am | 19 ++++++++-----------
> doc/Makefile.am | 16 +++++++++-------
> etc/Makefile.am | 7 +++----
> scripts/Makefile.am | 10 +++-------
> test/pacman/tests/Makefile.am | 10 ++++------
> 5 files changed, 27 insertions(+), 35 deletions(-)
>
> diff --git a/contrib/Makefile.am b/contrib/Makefile.am
> index be0a4ba..970e17b 100644
> --- a/contrib/Makefile.am
> +++ b/contrib/Makefile.am
> @@ -35,19 +35,16 @@ edit = sed \
> -e '1s|!/bin/bash|!$(BASH_SHELL)|g'
>
> $(OURSCRIPTS): Makefile
> - @echo ' ' GEN $@;
> - @$(RM) $@ $@.tmp
> - @$(edit) $(srcdir)/$@.in >$@.tmp
> - @chmod +x $@.tmp
> - @chmod a-w $@.tmp
> - @mv $@.tmp $@
> + $(AM_V_at)$(RM) $@ $@.tmp
> + $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
> + $(AM_V_at)chmod +x,a-w $@.tmp
> + $(AM_V_at)mv $@.tmp $@
>
> $(OURFILES): Makefile
> - @echo ' ' GEN $@;
> - @$(RM) $@ $@.tmp
> - @$(edit) $(srcdir)/$@.in >$@.tmp
> - @chmod a-w $@.tmp
> - @mv $@.tmp $@
> + $(AM_V_at)$(RM) $@ $@.tmp
> + $(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
> + $(AM_V_at)chmod a-w $@.tmp
> + $(AM_V_at)mv $@.tmp $@
>
> all-am: $(OURSCRIPTS) $(OURFILES)
>
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index f449e72..b8d42d6 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -90,8 +90,10 @@ endif
>
> html: $(HTML_DOCS)
>
> -website: html
> - bsdtar czf website.tar.gz $(HTML_DOCS) \
> +website: website.tar.gz
> +
> +website.tar.gz: html
> + $(AM_V_GEN)bsdtar czf $@ $(HTML_DOCS) \
> asciidoc-override.css \
> -C /etc/asciidoc/stylesheets/ \
> asciidoc.css \
> @@ -119,15 +121,15 @@ A2X_OPTS = \
>
> # These rules are due to the includes and files of the asciidoc text
> $(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
> - asciidoc $(ASCIIDOC_OPTS) $*.txt
> - dos2unix $@
> + $(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.txt | \
> + sed -e 's/\x0D$$//' > $@
>
> HACKING.html: ../HACKING
> - asciidoc $(ASCIIDOC_OPTS) -o $@ ../HACKING
> - dos2unix $@
> + $(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - ../HACKING | \
> + sed -e 's/\x0D$$//' > $@
>
> # Customizations for certain HTML docs
> $(HTML_MANPAGES): asciidoc.conf footer.txt Makefile
> diff --git a/etc/Makefile.am b/etc/Makefile.am
> index d504d7f..58a80bd 100644
> --- a/etc/Makefile.am
> +++ b/etc/Makefile.am
> @@ -22,10 +22,9 @@ edit = sed \
> -e 's|@ROOTDIR[@]|$(ROOTDIR)|g'
>
> $(dist_sysconf_DATA): Makefile
> - @echo ' ' GEN $@;
> - @$(RM) $@ $@.tmp
> - @$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
> - @mv $@.tmp $@
> + $(AM_V_at)$(RM) $@ $@.tmp
> + $(AM_V_GEN)$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
> + $(AM_V_at)mv $@.tmp $@
>
> makepkg.conf: $(srcdir)/makepkg.conf.in
> pacman.conf: $(srcdir)/pacman.conf.in
> diff --git a/scripts/Makefile.am b/scripts/Makefile.am
> index d89fd30..328fbff 100644
> --- a/scripts/Makefile.am
> +++ b/scripts/Makefile.am
> @@ -60,14 +60,10 @@ edit = sed \
> ## 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
> ## 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
> - @echo ' ' GEN $@;
> - @$(RM) $@
> - @test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
> - @chmod +x $@
> - @chmod a-w $@
> + $(AM_V_at)$(RM) $@
> + $(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
> + $(AM_V_at)chmod +x,a-w $@
>
> makepkg: \
> $(srcdir)/makepkg.sh.in \
> diff --git a/test/pacman/tests/Makefile.am b/test/pacman/tests/Makefile.am
> index 508534a..9ab0c77 100644
> --- a/test/pacman/tests/Makefile.am
> +++ b/test/pacman/tests/Makefile.am
> @@ -17,11 +17,9 @@ edit = sed \
>
>
> $(CONFTESTS): Makefile
> - @echo ' ' GEN $@;
> - @$(RM) $@ $@.tmp
> - @test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@.tmp || true
> - @test -f $@.tmp || false
> - @chmod a-w $@.tmp
> - @mv $@.tmp $@
> + $(AM_V_at)$(RM) $@ $@.tmp
> + $(AM_V_GEN)test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@.tmp || true
> + $(AM_V_at)chmod a-w $@.tmp
> + $(AM_V_at)mv $@.tmp $@
>
> # vim:set ts=2 sw=2 noet:
> --
> 1.7.8
>
>
More information about the pacman-dev
mailing list