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