Merge branch 'sanity-sleep-fix-master'
[platform/upstream/automake.git] / lib / am / depend2.am
index 7e4c6a3..9a193a4 100644 (file)
@@ -1,5 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+## 2003, 2004, 2006, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
 ## GNU General Public License for more details.
 
 ## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-## 02111-1307, USA.
-%.o: %@EXT@
-       @echo '$(@PFX@COMPILE) -c $<'; \
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-       $(@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-       @-tr '\\ ' '\n\n' < .deps/$(*F).p \
-## The very first nondeleted line is always the primary source file.
-## No need for that, so we remove it too via `1d'.
-         | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' > .deps/$(*F).P; \
-       rm .deps/$(*F).p
-
-%.lo: %@EXT@
-       @echo '$(LT@PFX@COMPILE) -c $<'; \
-## See above to understand implementation weirdness.
-       $(LT@PFX@COMPILE) -Wp,-MD,.deps/$(*F).p -c $<
-       @-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
-         < .deps/$(*F).p > .deps/$(*F).P; \
-## See above to understand deleted header file trick.
-       tr '\\ ' '\n\n' < .deps/$(*F).p \
-## The very first nondeleted line is always the primary source file.
-## No need for that, so we remove it too via `1d'.
-         | sed -e '/^$$/ d' -e '/:$$/ d' -e 1d -e 's/$$/:/' \
-## Note subtle difference: here we append to the .P file.
-           >> .deps/$(*F).P; \
-       rm -f .deps/$(*F).p
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+## This file is read several times:
+## - once per *extension* (not per language) for generic compilation rules
+## - once for each file which requires specific flags.
+
+## Note it is on purpose we wrote `if %AMDEP%', since:
+##
+## - if deps are turned off, %AMDEP% is mapped onto FALSE, and therefore
+##   the `if FALSE' chunk is removed (automake-time conditionals).
+##
+## - if deps are on, %AMDEP% is mapped onto AMDEP,  and therefore
+##   the `if AMDEP' chunk is prefix with @AMDEP_TRUE@ just like for any
+##   other configure-time conditional.
+##
+## We do likewise for %FASTDEP%; this expands to an ordinary
+## configure-time conditional.  %FASTDEP% is used to speed up the
+## common case of building a package with gcc 3.x.  In this case we
+## can skip the use of depcomp and easily inline the dependency
+## tracking.
+
+## Verbosity of FASTDEP rules
+## --------------------------
+## (1) Some people want to see what happens during make.  They think
+##     @-commands are evil because hiding things hinders debugging.
+## (2) Other people want to see only the important commands--those that
+##     may produce diagnostics, such as compiler invocations.  They
+##     do not care about build details such as dependency generation
+##     (the if/then/else machinery in FASTDEP rules).  Their point is
+##     that it is hard to spot diagnostics in a verbose output.
+## (3) Other people want `make -s' to work as expected: silently.
+##     This way they can spot any diagnostic really easily.
+##
+## The second point suggests we hide rules with @ and that we `echo'
+## only the relevant parts.  However this goes against the two others.
+## There are regular complaints about this on the mailing list, but
+## it's hard to please everybody.  On April 2003, William Fulton (from
+## clan (3)) and Karl Berry (from clan (2)) agreed that folding the
+## compile rules so that they are output on a single line (instead of 5)
+## would be a good compromise.  Actually we use two lines rather than one,
+## because this way %SOURCE% is always located at the end of the first
+## line and is therefore easier to spot.  (We need an extra line when
+## depbase is used.)
+
+if %?NONLIBTOOL%
+?GENERIC?%EXT%.o:
+?!GENERIC?%OBJ%: %SOURCE%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?!GENERIC?     %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?!GENERIC?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC??!SUBDIROBJ?  %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE%
+?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+?GENERIC??SUBDIROBJ?   %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE% &&\
+?GENERIC??SUBDIROBJ?   $(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%
+?-o?   %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%%SOURCE%
+?!-o?  %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%%SOURCE%
+else !%?GENERIC%
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?-o?   %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?!-o?  %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+endif !%?GENERIC%
+endif !%FASTDEP%
+
+?GENERIC?%EXT%.obj:
+?!GENERIC?%OBJOBJ%: %SOURCE%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?!GENERIC?     %VERBOSE%%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?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC??!SUBDIROBJ?  %VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
+?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+?GENERIC??SUBDIROBJ?   %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
+?GENERIC??SUBDIROBJ?   $(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%
+?-o?   %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
+?!-o?  %VERBOSE-NODEP%%COMPILE% %-c% `$(CYGPATH_W) %SOURCEFLAG%'%SOURCE%'`
+else !%?GENERIC%
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?-o?   %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
+?!-o?  %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
+endif !%?GENERIC%
+endif !%FASTDEP%
+endif %?NONLIBTOOL%
+
+if %?LIBTOOL%
+?GENERIC?%EXT%.lo:
+?!GENERIC?%LTOBJ%: %SOURCE%
+if %FASTDEP%
+## In fast-dep mode, we can always use -o.
+## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
+?!GENERIC?     %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+?!GENERIC?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
+?GENERIC??!SUBDIROBJ?  %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
+?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
+?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+?GENERIC??SUBDIROBJ?   %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE% &&\
+?GENERIC??SUBDIROBJ?   $(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%
+## We can always use `-o' with Libtool.
+?GENERIC?      %VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%%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%
+endif !%FASTDEP%
+endif %?LIBTOOL%