automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 07/11] depend2.am: refactor and remove code duplication


From: Stefano Lattarini
Subject: [PATCH 07/11] depend2.am: refactor and remove code duplication
Date: Sat, 12 Jan 2013 13:52:00 +0100

* lib/am/depend2.am: Here.  The obsolescent comments removed from this
same file in commit 'v1.13.1-42-g8f06bfb' of 2012-01-09, "depend2.am: fix
comments on verbosity of compilation rules", gave the rationale for why
that code duplication was there in the first place (rationale that, like
those comments, has been obsolete by the silent-rules introduction).
* automake.in: Given the refactoring in 'depend2.am', there's no longer
need to add extra trailing whitespace to the entries of the '%sourceflags'
hash (which are used for the '%SOURCEFLAG%' transform when 'depend2.am'
is processed.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in       |  4 +---
 lib/am/depend2.am | 46 ++++++++++++++++++++++++----------------------
 2 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/automake.in b/automake.in
index ca67b26..a2f0d50 100644
--- a/automake.in
+++ b/automake.in
@@ -5193,9 +5193,7 @@ sub scan_autoconf_traces ($)
       elsif ($macro eq 'AC_FC_SRCEXT')
        {
          my $suffix = $args[1];
-         # These flags are used as %SOURCEFLAG% in depend2.am,
-         # where the trailing space is important.
-         $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') '
+         $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ')'
            if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || 
$suffix eq 'f08');
        }
       elsif ($macro eq 'AC_INIT')
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index 99e993b..6c6c684 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -36,47 +36,47 @@ if %?NONLIBTOOL%
 ?GENERIC?%EXT%.o:
 ?!GENERIC?%OBJ%: %SOURCE%
 if %FASTDEP%
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ## TODO: rewrite this to avoid extra forks once we can assume a POSIX
 ## TODO: shell.
        %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'` \
-?!GENERIC?     && %COMPILE% -MT %OBJ% -MD -MP -MF $$depbase.Tpo -c -o %OBJ% 
%SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% \
-?GENERIC?      && %COMPILE% -MT %OBJ% -MD -MP -MF $$depbase.Tpo -c -o %OBJ% 
%SOURCEFLAG%%SOURCE% \
-       && $(am__mv) $$depbase.Tpo $$depbase.Po
+         && %COMPILE% -MT %OBJ% -MD -MP -MF $$depbase.Tpo -c -o %OBJ% 
%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
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
-if %?GENERIC%
-       %VERBOSE-NODEP%%COMPILE% -c -o %OBJ% %SOURCEFLAG%%SOURCE%
-else !%?GENERIC%
+       %VERBOSE-NODEP%%COMPILE% -c -o %OBJ% %SOURCEFLAG% \
+?GENERIC?      %SOURCE%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-       %VERBOSE-NODEP%%COMPILE% -c -o %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || 
echo '$(srcdir)/'`%SOURCE%
-endif !%?GENERIC%
+?!GENERIC?     `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 endif !%FASTDEP%
 
 ?GENERIC?%EXT%.obj:
 ?!GENERIC?%OBJOBJ%: %SOURCE%
 if %FASTDEP%
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ## TODO: rewrite this to avoid extra forks once we can assume a POSIX
 ## TODO: shell.
        %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'` \
-?!GENERIC?     && %COMPILE% -MT %OBJOBJ% -MD -MP -MF $$depbase.Tpo -c -o 
%OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else 
$(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi` \
-?GENERIC?      && %COMPILE% -MT %OBJOBJ% -MD -MP -MF $$depbase.Tpo -c -o 
%OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` \
+       && %COMPILE% -MT %OBJOBJ% -MD -MP -MF $$depbase.Tpo -c -o %OBJOBJ% 
%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
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
-if %?GENERIC%
-       %VERBOSE-NODEP%%COMPILE% -c -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) 
'%SOURCE%'`
-else !%?GENERIC%
+       %VERBOSE-NODEP%%COMPILE% -c -o %OBJOBJ% %SOURCEFLAG% \
+?GENERIC?      `$(CYGPATH_W) '%SOURCE%'`
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-       %VERBOSE-NODEP%%COMPILE% -c -o %OBJOBJ% %SOURCEFLAG%`if test -f 
'%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) 
'$(srcdir)/%SOURCE%'; fi`
-endif !%?GENERIC%
+?!GENERIC?     `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; \
+?!GENERIC?      else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
 endif !%FASTDEP%
 endif %?NONLIBTOOL%
 
@@ -84,20 +84,22 @@ if %?LIBTOOL%
 ?GENERIC?%EXT%.lo:
 ?!GENERIC?%LTOBJ%: %SOURCE%
 if %FASTDEP%
-## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ## TODO: rewrite this to avoid extra forks once we can assume a POSIX
 ## TODO: shell.
        %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'` 
\
-?!GENERIC?     && %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF $$depbase.Tpo -c -o 
%LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% \
-?GENERIC?      && %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF $$depbase.Tpo -c -o 
%LTOBJ% %SOURCEFLAG%%SOURCE% \
+         && %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF $$depbase.Tpo -c -o %LTOBJ% 
%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
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 endif %AMDEP%
-?GENERIC?      %VERBOSE-NODEP%%LTCOMPILE% -c -o %LTOBJ% %SOURCEFLAG%%SOURCE%
+       %VERBOSE-NODEP%%LTCOMPILE% -c -o %LTOBJ% %SOURCEFLAG% \
+?GENERIC?      %SOURCE%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC?     %VERBOSE-NODEP%%LTCOMPILE% -c -o %LTOBJ% %SOURCEFLAG%`test -f 
'%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?!GENERIC?     `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 endif !%FASTDEP%
 endif %?LIBTOOL%
-- 
1.8.1.rc3.192.g2d0029e




reply via email to

[Prev in Thread] Current Thread [Next in Thread]