* lib/am/depend2.am (?GENERIC?%EXT%.o, ?!GENERIC?%OBJ%): Likewise.
[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  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, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA.
19
20 ## This file is read several times:
21 ## - once per *extension* (not per language) for generic compilation rules
22 ## - once for each file which requires specific flags.
23
24 ## Note it is on purpose we wrote `if %AMDEP%', since:
25 ##
26 ## - if deps are turned off, %AMDEP% is mapped onto FALSE, and therefore
27 ##   the `if FALSE' chunk is removed (automake-time conditionals).
28 ##
29 ## - if deps are on, %AMDEP% is mapped onto AMDEP,  and therefore
30 ##   the `if AMDEP' chunk is prefix with @AMDEP_TRUE@ just like for any
31 ##   other configure-time conditional.
32 ##
33 ## We do likewise for %FASTDEP%; this expands to an ordinary
34 ## configure-time conditional.  %FASTDEP% is used to speed up the
35 ## common case of building a package with gcc 3.x.  In this case we
36 ## can skip the use of depcomp and easily inline the dependency
37 ## tracking.
38
39 ## Verbosity of FASTDEP rules
40 ## --------------------------
41 ## (1) Some people want to see what happens during make.  They think
42 ##     @-commands are evil because hiding things hinders debugging.
43 ## (2) Other people want to see only the important commands--those that
44 ##     may produce diagnostics, such as compiler invocations.  They
45 ##     do not care about build details such as dependency generation
46 ##     (the if/then/else machinery in FASTDEP rules).  Their point is
47 ##     that it is hard to spot diagnostics in a verbose output.
48 ## (3) Other people want `make -s' to work as expected: silently.
49 ##     This way they can spot any diagnostic really easily.
50 ##
51 ## The second point suggests we hide rules with @ and that we `echo'
52 ## only the relevant parts.  However this goes against the two others.
53 ## There are regular complaints about this on the mailing list, but
54 ## it's hard to please everybody.  On April 2003, William Fulton (from
55 ## clan (3)) and Karl Berry (from clan (2)) agreed that folding the
56 ## compile rules so that they are output on a single line (instead of 5)
57 ## would be a good compromise.  Actually we use two line rather than one,
58 ## because this way %SOURCE% is always located at the end of the first
59 ## line and is therefore easier to spot.  (We need an extra line when
60 ## depbase is used.)
61
62 if %?NONLIBTOOL%
63 ?GENERIC?%EXT%.o:
64 ?!GENERIC?%OBJ%: %SOURCE%
65 if %FASTDEP%
66 ## In fast-dep mode, we can always use -o.
67 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
68 ?!GENERIC?      %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
69 ?GENERIC??!SUBDIROBJ?   %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCE%
70 ?GENERIC??SUBDIROBJ?    depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
71 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% %SOURCE% &&\
72         mv -f %DEPBASE%.Tpo %DEPBASE%.Po
73 else !%FASTDEP%
74 if %AMDEP%
75         source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
76         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
77 endif %AMDEP%
78 if %?GENERIC%
79 ?-o?    %COMPILE% %-c% %-o% %OBJ% %SOURCE%
80 ?!-o?   %COMPILE% %-c% %SOURCE%
81 else !%?GENERIC%
82 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
83 ?-o?    %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
84 ?!-o?   %COMPILE% %-c% `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?      %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
94 ?GENERIC??!SUBDIROBJ?   %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`
95 ?GENERIC??SUBDIROBJ?    depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
96 ?GENERIC??SUBDIROBJ?    %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'` &&\
97         mv -f %DEPBASE%.Tpo %DEPBASE%.Po
98 else !%FASTDEP%
99 if %AMDEP%
100         source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
101         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
102 endif %AMDEP%
103 if %?GENERIC%
104 ?-o?    %COMPILE% %-c% %-o% %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`
105 ?!-o?   %COMPILE% %-c% `$(CYGPATH_W) '%SOURCE%'`
106 else !%?GENERIC%
107 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
108 ?-o?    %COMPILE% %-c% %-o% %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
109 ?!-o?   %COMPILE% %-c% `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?      %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
121 ?GENERIC??!SUBDIROBJ?   %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCE%
122 ?GENERIC??SUBDIROBJ?    depbase=`echo %OBJ% | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
123 ?GENERIC??SUBDIROBJ?    %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCE% &&\
124         mv -f %DEPBASE%.Tpo %DEPBASE%.Plo
125 else !%FASTDEP%
126 if %AMDEP%
127         source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
128         DEPDIR=$(DEPDIR) $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
129 endif %AMDEP%
130 ## We can always use `-o' with Libtool.
131 ?GENERIC?       %LTCOMPILE% %-c% -o %LTOBJ% %SOURCE%
132 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
133 ?!GENERIC?      %LTCOMPILE% %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
134 endif !%FASTDEP%
135 endif %?LIBTOOL%