depend2.am: improve comments a little
[platform/upstream/automake.git] / lib / am / depend2.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2013 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 configure-time
31 ## conditional.  %FASTDEP% is used to speed up the common case of building
32 ## a package with gcc 3.x or later.  In this case we can skip the use of
33 ## depcomp and easily inline the dependency tracking.
34
35 ## Verbosity of FASTDEP rules
36 ## --------------------------
37 ## (1) Some people want to see what happens during make.  They think
38 ##     @-commands are evil because hiding things hinders debugging.
39 ## (2) Other people want to see only the important commands--those that
40 ##     may produce diagnostics, such as compiler invocations.  They
41 ##     do not care about build details such as dependency generation
42 ##     (the if/then/else machinery in FASTDEP rules).  Their point is
43 ##     that it is hard to spot diagnostics in a verbose output.
44 ## (3) Other people want "make -s" to work as expected: silently.
45 ##     This way they can spot any diagnostic really easily.
46 ##
47 ## The second point suggests we hide rules with @ and that we 'echo'
48 ## only the relevant parts.  However this goes against the two others.
49 ## There are regular complaints about this on the mailing list, but
50 ## it's hard to please everybody.  On April 2003, William Fulton (from
51 ## clan (3)) and Karl Berry (from clan (2)) agreed that folding the
52 ## compile rules so that they are output on a single line (instead of 5)
53 ## would be a good compromise.  Actually we use two lines rather than one,
54 ## because this way %SOURCE% is always located at the end of the first
55 ## line and is therefore easier to spot.  (We need an extra line when
56 ## depbase is used.)
57
58 if %?NONLIBTOOL%
59 ?GENERIC?%EXT%.o:
60 ?!GENERIC?%OBJ%: %SOURCE%
61 if %FASTDEP%
62 ## In fast-dep mode, we can always use -o.
63 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
64 ?!GENERIC?      %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
65 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
66 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE%
67 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
68 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
69 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCEFLAG%%SOURCE% &&\
70 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
71 else !%FASTDEP%
72 if %AMDEP%
73         %VERBOSE%source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
74         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
75 endif %AMDEP%
76 if %?GENERIC%
77 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%%SOURCE%
78 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%%SOURCE%
79 else !%?GENERIC%
80 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
81 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
82 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
83 endif !%?GENERIC%
84 endif !%FASTDEP%
85
86 ?GENERIC?%EXT%.obj:
87 ?!GENERIC?%OBJOBJ%: %SOURCE%
88 if %FASTDEP%
89 ## In fast-dep mode, we can always use -o.
90 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
91 ?!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`
92 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
93 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
94 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
95 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
96 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
97 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
98 else !%FASTDEP%
99 if %AMDEP%
100         %VERBOSE%source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
101         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
102 endif %AMDEP%
103 if %?GENERIC%
104 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
105 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% `$(CYGPATH_W) %SOURCEFLAG%'%SOURCE%'`
106 else !%?GENERIC%
107 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
108 ?-o?    %VERBOSE-NODEP%%COMPILE% %-c% %-o% %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
109 ?!-o?   %VERBOSE-NODEP%%COMPILE% %-c% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
110 endif !%?GENERIC%
111 endif !%FASTDEP%
112 endif %?NONLIBTOOL%
113
114 if %?LIBTOOL%
115 ?GENERIC?%EXT%.lo:
116 ?!GENERIC?%LTOBJ%: %SOURCE%
117 if %FASTDEP%
118 ## In fast-dep mode, we can always use -o.
119 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
120 ?!GENERIC?      %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
121 ?!GENERIC?      %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
122 ?GENERIC??!SUBDIROBJ?   %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
123 ?GENERIC??!SUBDIROBJ?   %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
124 ?GENERIC??SUBDIROBJ?    %VERBOSE%depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
125 ?GENERIC??SUBDIROBJ?    %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE% &&\
126 ?GENERIC??SUBDIROBJ?    $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
127 else !%FASTDEP%
128 if %AMDEP%
129         %VERBOSE%source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
130         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
131 endif %AMDEP%
132 ## We can always use '-o' with Libtool.
133 ?GENERIC?       %VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
134 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
135 ?!GENERIC?      %VERBOSE-NODEP%%LTCOMPILE% %-c% -o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
136 endif !%FASTDEP%
137 endif %?LIBTOOL%