From: Stefano Lattarini Date: Thu, 10 Jan 2013 20:31:57 +0000 (+0100) Subject: depend: reduce code duplication X-Git-Tag: v1.16~89^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13abbe06ca25c31f011dc3deba21330ca0d7e8ad;p=thirdparty%2Fautomake.git depend: reduce code duplication 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 --- diff --git a/lib/am/depend2.am b/lib/am/depend2.am index a54fcd35f..5522aa36a 100644 --- a/lib/am/depend2.am +++ b/lib/am/depend2.am @@ -32,13 +32,16 @@ ## 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%.