]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
depend: refactor and remove code duplication
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 10 Jan 2013 17:04:33 +0000 (18:04 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 15 May 2013 13:53:29 +0000 (15:53 +0200)
* 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).
* bin/automake.in: Given the refactoring in 'depend2.am', there is 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.
* t/fort2.sh: Adjust to avoid spurious failures.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
bin/automake.in
lib/am/depend2.am
t/fort2.sh

index c87acba7222aee177667a499f632862eb8305275..04906b3f37659cb8208628dc2835f50840366399 100644 (file)
@@ -5060,9 +5060,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')
index 99e993b000c6c7100afd73db3a633f51ea832080..6c6c6843bad387a1704550b33d2dbcb71e7ae96d 100644 (file)
@@ -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%
index d6144529624898154746ccb074340a2c90e8a0e7..bed0323682e4104f92cc748ed860e41eab1a864d 100755 (executable)
@@ -70,8 +70,17 @@ $MAKE -n \
   FCFLAGS_f90=--@90 FCFLAGS_f95=--@95 FCFLAGS_f03=--@03 FCFLAGS_f08=--@08 \
   > stdout || { cat stdout; exit 1; }
 cat stdout
-# To make it easier to have  stricter grepping below.
-sed -e 's/[    ][      ]*/  /g' -e 's/^/ /' -e 's/$/ /' stdout > out
+# To make it easier to have stricter grepping below.
+$PERL -e '
+  undef $/;
+  $_ = <>;
+  s/[^\\]\\\n/ /g;
+  s/^/ /;
+  s/\n/ \n /g;
+  s/[ \t]+/  /g;
+  s/\n\s*\z/\n/;
+  print;
+' <stdout >out
 cat out
 
 grep ' fake-fc .* --@90 .* hello\.f90 ' out