[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/11] depend: reduce code duplication, de-uglify make verbose ou
From: |
Stefano Lattarini |
Subject: |
[PATCH 11/11] depend: reduce code duplication, de-uglify make verbose output |
Date: |
Sat, 12 Jan 2013 13:52:04 +0100 |
Verbose output from compilation recipes had been made more messy by
the previous "simplifying" commit XXX. With this patch, not only we
reduce some code duplication, but also improve that output again, for
the joy of users who dislike silent-rules :-)
* lib/am/depend2.am: Use the new '%XSOURCE%' transform, instead of
copying and pasting the idiom for VPATH rewrite emulation over and
over. Fix some indentation and line-wrapping issues while at it.
* automake.in (handle_languages): Implement the new transform.
* t/silent-nested-vars.sh: Adjust to avoid spurious failures.
Signed-off-by: Stefano Lattarini <address@hidden>
---
automake.in | 5 +++++
lib/am/depend2.am | 44 ++++++++++++--------------------------------
t/silent-nested-vars.sh | 2 +-
3 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/automake.in b/automake.in
index a2f0d50..9320bae 100644
--- a/automake.in
+++ b/automake.in
@@ -1377,6 +1377,7 @@ sub handle_languages
BASE => '$*',
SOURCE => '$<',
+ XSOURCE => '$<',
SOURCEFLAG => $sourceflags{$ext} || '',
OBJ => '$@',
OBJOBJ => '$@',
@@ -1428,6 +1429,9 @@ sub handle_languages
"\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags)
\$(LIBTOOLFLAGS) "
. "--mode=compile $obj_compile";
+ # For non-suffix rules, we must emulate a VPATH search.
+ my $xsource = "`test -f '$source' || echo '\$(srcdir)/'`$source";
+
$output_rules .=
file_contents ($rule_file,
new Automake::Location,
@@ -1436,6 +1440,7 @@ sub handle_languages
BASE => $obj,
SOURCE => $source,
+ XSOURCE => $xsource,
SOURCEFLAG => $sourceflags{$srcext} || '',
# Use $myext and not '.o' here, in case
# we are actually building a new source
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index a947ee7..b975be2 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -41,43 +41,29 @@ if %?NONLIBTOOL%
?GENERIC?%EXT%.o:
?!GENERIC?%OBJ%: %SOURCE%
if %FASTDEP%
- %VERBOSE%$(am__set_depbase) \
- && %COMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG% \
-?GENERIC? %SOURCE% \
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% \
- && $(am__mv) $$depbase.Tpo $$depbase.Po
+ %VERBOSE%$(am__set_depbase) && \
+ %COMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG%
%XSOURCE% && \
+ $(am__mv) $$depbase.Tpo $$depbase.Po
else !%FASTDEP%
if %AMDEP%
%VERBOSE%source='%SOURCE%' object='$@' libtool=no @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %VERBOSE-NODEP%%COMPILE% -c -o $@ %SOURCEFLAG% \
-?GENERIC? %SOURCE%
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+ %VERBOSE-NODEP%%COMPILE% -c -o $@ %SOURCEFLAG% %XSOURCE%
endif !%FASTDEP%
?GENERIC?%EXT%.obj:
?!GENERIC?%OBJOBJ%: %SOURCE%
if %FASTDEP%
- %VERBOSE%$(am__set_depbase) \
- && %COMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG% \
-?GENERIC? $$($(CYGPATH_W) '%SOURCE%') \
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? $$(if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; \
-?!GENERIC? else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi) \
- && $(am__mv) $$depbase.Tpo $$depbase.Po
+ %VERBOSE%$(am__set_depbase) && \
+ %COMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG%
$$($(CYGPATH_W) %XSOURCE%) && \
+ $(am__mv) $$depbase.Tpo $$depbase.Po
else !%FASTDEP%
if %AMDEP%
%VERBOSE%source='%SOURCE%' object='$@' libtool=no @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %VERBOSE-NODEP%%COMPILE% -c -o $@ %SOURCEFLAG% \
-?GENERIC? $$($(CYGPATH_W) '%SOURCE%')
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? $$(if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; \
-?!GENERIC? else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi)
+ %VERBOSE-NODEP%%COMPILE% -c -o $@ %SOURCEFLAG% $$($(CYGPATH_W)
%XSOURCE%)
endif !%FASTDEP%
endif %?NONLIBTOOL%
@@ -85,20 +71,14 @@ if %?LIBTOOL%
?GENERIC?%EXT%.lo:
?!GENERIC?%LTOBJ%: %SOURCE%
if %FASTDEP%
- %VERBOSE%$(am__set_depbase) \
- && %LTCOMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG%
\
-?GENERIC? %SOURCE% \
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% \
- && $(am__mv) $$depbase.Tpo $$depbase.Plo
+ %VERBOSE%$(am__set_depbase) && \
+ %LTCOMPILE% -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ %SOURCEFLAG%
%XSOURCE% && \
+ $(am__mv) $$depbase.Tpo $$depbase.Plo
else !%FASTDEP%
if %AMDEP%
%VERBOSE%source='%SOURCE%' object='$@' libtool=yes @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif %AMDEP%
- %VERBOSE-NODEP%%LTCOMPILE% -c -o $@ %SOURCEFLAG% \
-?GENERIC? %SOURCE%
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC? `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+ %VERBOSE-NODEP%%LTCOMPILE% -c -o $@ %SOURCEFLAG% %XSOURCE%
endif !%FASTDEP%
endif %?LIBTOOL%
diff --git a/t/silent-nested-vars.sh b/t/silent-nested-vars.sh
index f03204d..08f46fd 100755
--- a/t/silent-nested-vars.sh
+++ b/t/silent-nested-vars.sh
@@ -67,7 +67,7 @@ case $1 in
done ;;
esac
-nested_var_pat='^[^#].*\$([^)]*\$'
+nested_var_pat='^[^#].*[^$]\$([^)]*\$'
if
case $makefile in
-) printf '%s\n' "$makerules" | grep "$nested_var_pat";;
--
1.8.1.rc3.192.g2d0029e
- [PATCH 01/11] compile: avoid AC_PROG_CC messy rewrite, (continued)
- [PATCH 01/11] compile: avoid AC_PROG_CC messy rewrite, Stefano Lattarini, 2013/01/12
- [PATCH 04/11] depend: assume we can always pass "-o" to the C compiler, Stefano Lattarini, 2013/01/12
- [PATCH 03/11] cleanup: having subdir-objects mandatory allow us some simplifications, Stefano Lattarini, 2013/01/12
- [PATCH 06/11] Automake::Language: drop unused fields 'compile_flag' and 'output_flag', Stefano Lattarini, 2013/01/12
- [PATCH 02/11] subdir-objects: enable unconditionally, Stefano Lattarini, 2013/01/12
- [PATCH 09/11] depend2.am: reduce code duplication, Stefano Lattarini, 2013/01/12
- [PATCH 10/11] depend: prefer $(...) over `...` in Cygwin-specific recipes, Stefano Lattarini, 2013/01/12
- [PATCH 07/11] depend2.am: refactor and remove code duplication, Stefano Lattarini, 2013/01/12
- [PATCH 11/11] depend: reduce code duplication, de-uglify make verbose output,
Stefano Lattarini <=
- [PATCH 08/11] depend2.am: preparatory refactoring, Stefano Lattarini, 2013/01/12