]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
depend: reduce code duplication
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 10 Jan 2013 20:31:57 +0000 (21:31 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 15 May 2013 13:53:30 +0000 (15:53 +0200)
Just a simplification; no semantic change is intended.

* lib/am/depend2.am (am__set_depbase): New.  Use it in all the three
flavours of recipes (.o, .obj, .lo), instead of duplicating its code.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
lib/am/depend2.am

index a54fcd35f37ac47eba391d91644c7dbbea4f47de..5522aa36ab7e57148556c6052adadf538f0c9fe0 100644 (file)
 ## a package with gcc 3.x or later.  In this case we can skip the use of
 ## depcomp and easily inline the dependency tracking.
 
+if %?FIRST%
+## TODO: rewrite this to avoid extra forks once we can assume a POSIX shell.
+am__set_depbase = depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.[^.]*$$||'`
+endif %?FIRST%
+
 if %?NONLIBTOOL%
 ?GENERIC?%EXT%.o:
 ?!GENERIC?%OBJ%: %SOURCE%
 if %FASTDEP%
-## TODO: rewrite this to avoid extra forks once we can assume a POSIX
-## TODO: shell.
-       %VERBOSE%depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.[^.]*$$||'` \
+       %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%.
@@ -58,9 +61,7 @@ endif !%FASTDEP%
 ?GENERIC?%EXT%.obj:
 ?!GENERIC?%OBJOBJ%: %SOURCE%
 if %FASTDEP%
-## TODO: rewrite this to avoid extra forks once we can assume a POSIX
-## TODO: shell.
-       %VERBOSE%depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.[^.]*$$||'` \
+       %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%.
@@ -84,9 +85,7 @@ if %?LIBTOOL%
 ?GENERIC?%EXT%.lo:
 ?!GENERIC?%LTOBJ%: %SOURCE%
 if %FASTDEP%
-## TODO: rewrite this to avoid extra forks once we can assume a POSIX
-## TODO: shell.
-       %VERBOSE%depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.[^.]*$$||'` \
+       %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%.