* lib/am/depend2.am (?GENERIC?%EXT%.o, ?GENERIC?%EXT%.obj)
[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, 2003
3 ## 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., 59 Temple Place - Suite 330, Boston, MA
18 ## 02111-1307, 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 ?GENERIC?%EXT%.o:
40 ?!GENERIC?%OBJ%: %SOURCE%
41 if %FASTDEP%
42 ## In fast-dep mode, we can always use -o.
43         @echo " %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ%" \
44 ?!GENERIC?      `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
45 ?GENERIC?       %SOURCE%
46         @if %COMPILE% -MT %OBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
47 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
48 ?!GENERIC?        %-c% -o %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
49 ?GENERIC?         %-c% -o %OBJ% %SOURCE%; \
50         then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
51         else rm -f "%DEPBASE%.Tpo"; exit 1; \
52         fi
53 else !%FASTDEP%
54 if %AMDEP%
55         source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
56         depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
57         $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
58 endif %AMDEP%
59 if %?GENERIC%
60 ?-o?    %COMPILE% %-c% %-o% %OBJ% %SOURCE%
61 ?!-o?   %COMPILE% %-c% %SOURCE%
62 else !%?GENERIC%
63 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
64 ?-o?    %COMPILE% %-c% %-o% %OBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
65 ?!-o?   %COMPILE% %-c% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
66 endif !%?GENERIC%
67 endif !%FASTDEP%
68
69 ?GENERIC?%EXT%.obj:
70 ?!GENERIC?%OBJOBJ%: %SOURCE%
71 if %FASTDEP%
72 ## In fast-dep mode, we can always use -o.
73         @echo " %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ%" \
74 ?!GENERIC?      `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
75 ?GENERIC?       %SOURCE%
76         @if %COMPILE% -MT %OBJOBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
77 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
78 ?!GENERIC?        %-c% -o %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`; \
79 ?GENERIC?         %-c% -o %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`; \
80         then mv "%DEPBASE%.Tpo" "%DEPBASE%.Po"; \
81         else rm -f "%DEPBASE%.Tpo"; exit 1; \
82         fi
83 else !%FASTDEP%
84 if %AMDEP%
85         source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
86         depfile='%DEPBASE%.Po' tmpdepfile='%DEPBASE%.TPo' @AMDEPBACKSLASH@
87         $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
88 endif %AMDEP%
89 if %?GENERIC%
90 ?-o?    %COMPILE% %-c% %-o% %OBJOBJ% `$(CYGPATH_W) '%SOURCE%'`
91 ?!-o?   %COMPILE% %-c% `$(CYGPATH_W) '%SOURCE%'`
92 else !%?GENERIC%
93 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
94 ?-o?    %COMPILE% %-c% %-o% %OBJOBJ% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
95 ?!-o?   %COMPILE% %-c% `if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
96 endif !%?GENERIC%
97 endif !%FASTDEP%
98
99 if %?LIBTOOL%
100 ?GENERIC?%EXT%.lo:
101 ?!GENERIC?%LTOBJ%: %SOURCE%
102 if %FASTDEP%
103 ## In fast-dep mode, we can always use -o.
104         @echo " %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %LTOBJ%" \
105 ?!GENERIC?      `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
106 ?GENERIC?       %SOURCE%
107         @if %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF "%DEPBASE%.Tpo" \
108 ?GENERIC?         %-c% -o %LTOBJ% %SOURCE%; \
109 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
110 ?!GENERIC?        %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
111         then mv "%DEPBASE%.Tpo" "%DEPBASE%.Plo"; \
112         else rm -f "%DEPBASE%.Tpo"; exit 1; \
113         fi
114 else !%FASTDEP%
115 if %AMDEP%
116         source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
117         depfile='%DEPBASE%.Plo' tmpdepfile='%DEPBASE%.TPlo' @AMDEPBACKSLASH@
118         $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
119 endif %AMDEP%
120 ## We can always use `-o' with Libtool.
121 ?GENERIC?       %LTCOMPILE% %-c% -o %LTOBJ% %SOURCE%
122 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
123 ?!GENERIC?      %LTCOMPILE% %-c% -o %LTOBJ% `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
124 endif !%FASTDEP%
125 endif %?LIBTOOL%