[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/10] depend: reduce code duplication, de-uglify make verbose ou
From: |
Stefano Lattarini |
Subject: |
[PATCH 10/10] depend: reduce code duplication, de-uglify make verbose output |
Date: |
Tue, 14 May 2013 10:04:33 +0200 |
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.
* bin/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>
---
bin/automake.in | 5 +++++
lib/am/depend2.am | 44 ++++++++++++--------------------------------
t/silent-nested-vars.sh | 2 +-
3 files changed, 18 insertions(+), 33 deletions(-)
diff --git a/bin/automake.in b/bin/automake.in
index 04906b3..f51cfa7 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -1291,6 +1291,7 @@ sub handle_languages ()
BASE => '$*',
SOURCE => '$<',
+ XSOURCE => '$<',
SOURCEFLAG => $sourceflags{$ext} || '',
OBJ => '$@',
OBJOBJ => '$@',
@@ -1342,6 +1343,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,
@@ -1350,6 +1354,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.3.rc0.19.g7e6a0cc
- [PATCH 00/10] {master} Enable subdir-objects option unconditionally, Stefano Lattarini, 2013/05/14
- [PATCH 01/10] subdir-objects: enable unconditionally, Stefano Lattarini, 2013/05/14
- [PATCH 10/10] depend: reduce code duplication, de-uglify make verbose output,
Stefano Lattarini <=
- [PATCH 08/10] depend: reduce code duplication, Stefano Lattarini, 2013/05/14
- [PATCH 03/10] depend: assume we can always pass '-o' to the C compiler, Stefano Lattarini, 2013/05/14
- [PATCH 06/10] depend: refactor and remove code duplication, Stefano Lattarini, 2013/05/14
- [PATCH 09/10] depend: prefer $(...) over `...` in Cygwin-specific recipes, Stefano Lattarini, 2013/05/14
- [PATCH 02/10] cleanup: having subdir-objects mandatory allow us some simplifications, Stefano Lattarini, 2013/05/14
- [PATCH 05/10] Automake::Language: drop unused fields 'compile_flag' and 'output_flag', Stefano Lattarini, 2013/05/14
- [PATCH 04/10] depend: assume '-c' compiler flag always means to produce object files, Stefano Lattarini, 2013/05/14
- [PATCH 07/10] depend: a preparatory refactoring, Stefano Lattarini, 2013/05/14