Merge branch 'sanity-sleep-fix-master'
[platform/upstream/automake.git] / lib / am / depend2.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3 ## 2003, 2004, 2006, 2008, 2009, 2010  Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 ## This file is read several times:
19 ## - once per *extension* (not per language) for generic compilation rules
20 ## - once for each file which requires specific flags.
21
22 ## Note it is on purpose we wrote `if %AMDEP%', since:
23 ##
24 ## - if deps are turned off, %AMDEP% is mapped onto FALSE, and therefore
25 ##   the `if FALSE' chunk is removed (automake-time conditionals).
26 ##
27 ## - if deps are on, %AMDEP% is mapped onto AMDEP,  and therefore
28 ##   the `if AMDEP' chunk is prefix with @AMDEP_TRUE@ just like for any
29 ##   other configure-time conditional.
30 ##
31 ## We do likewise for %FASTDEP%; this expands to an ordinary
32 ## configure-time conditional.  %FASTDEP% is used to speed up the
33 ## common case of building a package with gcc 3.x.  In this case we
34 ## can skip the use of depcomp and easily inline the dependency
35 ## tracking.
36
37 ## Verbosity of FASTDEP rules
38 ## --------------------------
39 ## (1) Some people want to see what happens during make.  They think
40 ##     @-commands are evil because hiding things hinders debugging.
41 ## (2) Other people want to see only the important commands--those that
42 ##     may produce diagnostics, such as compiler invocations.  They
43 ##     do not care about build details such as dependency generation
44 ##     (the if/then/else machinery in FASTDEP rules).  Their point is
45 ##     that it is hard to spot diagnostics in a verbose output.
46 ## (3) Other people want `make -s' to work as expected: silently.
47 ##     This way they can spot any diagnostic really easily.
48 ##
49 ## The second point suggests we hide rules with @ and that we `echo'
50 ## only the relevant parts.  However this goes against the two others.
51 ## There are regular complaints about this on the mailing list, but
52 ## it's hard to please everybody.  On April 2003, William Fulton (from
53 ## clan (3)) and Karl Berry (from clan (2)) agreed that folding the
54 ## compile rules so that they are output on a single line (instead of 5)
55 ## would be a good compromise.  Actually we use two lines rather than one,
56 ## because this way %SOURCE% is always located at the end of the first
57 ## line and is therefore easier to spot.  (We need an extra line when
58 ## depbase is used.)
59
60 if %?NONLIBTOOL%
61 ?GENERIC?%EXT%.o:
62 ?!GENERIC?%OBJ%: %SOURCE%
63 if %FASTDEP%
64 ## In fast-dep mode, we can always use -o.
65 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
66 ?!GENERIC?      %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
67 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
68 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE%
69 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
70 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
71 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE% &&\
72 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
73 else !%FASTDEP%
74 if %AMDEP%
75         %VERBOSE%source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
76         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
77 endif %AMDEP%
78 if %?GENERIC%
79 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%%SOURCE%
80 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%%SOURCE%
81 else !%?GENERIC%
82 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
83 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
84 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
85 endif !%?GENERIC%
86 endif !%FASTDEP%
87
88 ?GENERIC?%EXT%.obj:
89 ?!GENERIC?%OBJOBJ%: %SOURCE%
90 if %FASTDEP%
91 ## In fast-dep mode, we can always use -o.
92 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
93 ?!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`
94 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
95 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
96 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
97 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
98 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
99 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
100 else !%FASTDEP%
101 if %AMDEP%
102         %VERBOSE%source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
103         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
104 endif %AMDEP%
105 if %?GENERIC%
106 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
107 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% `$(CYGPATH_W) %SOURCEFLAG%'%SOURCE%'`
108 else !%?GENERIC%
109 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
110 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
111 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
112 endif !%?GENERIC%
113 endif !%FASTDEP%
114 endif %?NONLIBTOOL%
115
116 if %?LIBTOOL%
117 ?GENERIC?%EXT%.lo:
118 ?!GENERIC?%LTOBJ%: %SOURCE%
119 if %FASTDEP%
120 ## In fast-dep mode, we can always use -o.
121 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
122 ?!GENERIC?      %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
123 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
124 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
125 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
126 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
127 ?GENERIC??SUBDIROBJ?    %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE% &&\
128 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
129 else !%FASTDEP%
130 if %AMDEP%
131         %VERBOSE%source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
132         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
133 endif %AMDEP%
134 ## We can always use `-o' with Libtool.
135 ?GENERIC?       %VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
136 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
137 ?!GENERIC?      %VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
138 endif !%FASTDEP%
139 endif %?LIBTOOL%