]>
Commit | Line | Data |
---|---|---|
d3ac17c9 | 1 | [+ AutoGen5 template -*- Mode: Makefile -*- |
95ddd785 NN |
2 | in |
3 | +] | |
4 | ||
5 | # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. | |
6 | # | |
7 | # Makefile for directory with subdirs to build. | |
8 | # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, | |
b7e5a296 | 9 | # 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2023 |
309c24a9 | 10 | # Free Software Foundation |
95ddd785 NN |
11 | # |
12 | # This file is free software; you can redistribute it and/or modify | |
13 | # it under the terms of the GNU General Public License as published by | |
309c24a9 | 14 | # the Free Software Foundation; either version 3 of the License, or |
95ddd785 | 15 | # (at your option) any later version. |
c1aba5e7 | 16 | # |
95ddd785 NN |
17 | # This program is distributed in the hope that it will be useful, |
18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | # GNU General Public License for more details. | |
c1aba5e7 | 21 | # |
95ddd785 | 22 | # You should have received a copy of the GNU General Public License |
309c24a9 JJ |
23 | # along with this program; see the file COPYING3. If not see |
24 | # <http://www.gnu.org/licenses/>. | |
95ddd785 NN |
25 | # |
26 | ||
295e261a HPN |
27 | # First, test for a proper version of make, but only where one is required. |
28 | ||
29 | @if gcc | |
30 | ifeq (,$(.VARIABLES)) # The variable .VARIABLES, new with 3.80, is never empty. | |
31 | $(error GNU make version 3.80 or newer is required.) | |
32 | endif | |
33 | @endif gcc | |
34 | ||
df0f0674 NN |
35 | # ------------------------------- |
36 | # Standard Autoconf-set variables | |
37 | # ------------------------------- | |
4977bab6 | 38 | VPATH=@srcdir@ |
4977bab6 | 39 | |
1c710c3c | 40 | build_alias=@build_noncanonical@ |
e69bf64b PB |
41 | build_vendor=@build_vendor@ |
42 | build_os=@build_os@ | |
e89fbdfe | 43 | build=@build@ |
fcb60292 | 44 | cpu_type=@cpu_type@ |
1c710c3c | 45 | host_alias=@host_noncanonical@ |
e69bf64b PB |
46 | host_vendor=@host_vendor@ |
47 | host_os=@host_os@ | |
e89fbdfe | 48 | host=@host@ |
1c710c3c | 49 | target_alias=@target_noncanonical@ |
e69bf64b PB |
50 | target_vendor=@target_vendor@ |
51 | target_os=@target_os@ | |
e89fbdfe | 52 | target=@target@ |
4977bab6 | 53 | |
df0f0674 | 54 | program_transform_name = @program_transform_name@ |
0dffceed NN |
55 | |
56 | prefix = @prefix@ | |
57 | exec_prefix = @exec_prefix@ | |
58 | ||
df0f0674 NN |
59 | srcdir = @srcdir@ |
60 | ||
0dffceed NN |
61 | bindir = @bindir@ |
62 | sbindir = @sbindir@ | |
63 | libexecdir = @libexecdir@ | |
64 | datadir = @datadir@ | |
65 | sysconfdir = @sysconfdir@ | |
66 | sharedstatedir = @sharedstatedir@ | |
67 | localstatedir = @localstatedir@ | |
68 | libdir = @libdir@ | |
69 | includedir = @includedir@ | |
70 | oldincludedir = @oldincludedir@ | |
71 | infodir = @infodir@ | |
65d6e994 CD |
72 | datarootdir = @datarootdir@ |
73 | docdir = @docdir@ | |
9c4d2493 | 74 | pdfdir = @pdfdir@ |
65d6e994 | 75 | htmldir = @htmldir@ |
0dffceed | 76 | mandir = @mandir@ |
95ddd785 NN |
77 | man1dir = $(mandir)/man1 |
78 | man2dir = $(mandir)/man2 | |
79 | man3dir = $(mandir)/man3 | |
80 | man4dir = $(mandir)/man4 | |
81 | man5dir = $(mandir)/man5 | |
82 | man6dir = $(mandir)/man6 | |
83 | man7dir = $(mandir)/man7 | |
84 | man8dir = $(mandir)/man8 | |
85 | man9dir = $(mandir)/man9 | |
95ddd785 | 86 | |
775956d0 NN |
87 | INSTALL = @INSTALL@ |
88 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | |
89 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | |
90 | INSTALL_DATA = @INSTALL_DATA@ | |
ad6717df PB |
91 | LN = @LN@ |
92 | LN_S = @LN_S@ | |
58e24147 AM |
93 | MAINT = @MAINT@ |
94 | MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ | |
95 | MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ | |
95ddd785 | 96 | |
df0f0674 NN |
97 | # ------------------------------------------------- |
98 | # Miscellaneous non-standard autoconf-set variables | |
99 | # ------------------------------------------------- | |
95ddd785 | 100 | |
df0f0674 NN |
101 | # The gcc driver likes to know the arguments it was configured with. |
102 | TOPLEVEL_CONFIGURE_ARGUMENTS=@TOPLEVEL_CONFIGURE_ARGUMENTS@ | |
95ddd785 | 103 | |
df0f0674 NN |
104 | tooldir = @tooldir@ |
105 | build_tooldir = @build_tooldir@ | |
95ddd785 | 106 | |
df0f0674 NN |
107 | # This is the name of the environment variable used for the path to |
108 | # the libraries. | |
109 | RPATH_ENVVAR = @RPATH_ENVVAR@ | |
95ddd785 | 110 | |
d89f0ad6 AL |
111 | # On targets where RPATH_ENVVAR is PATH, a subdirectory of the GCC build path |
112 | # is used instead of the directory itself to avoid including built | |
113 | # executables in PATH. | |
114 | GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@ | |
115 | ||
d39367fa IS |
116 | # If the build should make suitable code for shared host resources. |
117 | host_shared = @host_shared@ | |
118 | ||
df0f0674 NN |
119 | # Build programs are put under this directory. |
120 | BUILD_SUBDIR = @build_subdir@ | |
121 | # This is set by the configure script to the arguments to use when configuring | |
122 | # directories built for the build system. | |
25b42232 | 123 | BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)" |
23f6b2f9 | 124 | |
00020c16 ILT |
125 | # Linker flags to use on the host, for stage1 or when not |
126 | # bootstrapping. | |
127 | STAGE1_LDFLAGS = @stage1_ldflags@ | |
128 | ||
129 | # Libraries to use on the host, for stage1 or when not bootstrapping. | |
130 | STAGE1_LIBS = @stage1_libs@ | |
131 | ||
132 | # Linker flags to use for stage2 and later. | |
133 | POSTSTAGE1_LDFLAGS = @poststage1_ldflags@ | |
134 | ||
135 | # Libraries to use for stage2 and later. | |
136 | POSTSTAGE1_LIBS = @poststage1_libs@ | |
137 | ||
23f6b2f9 PB |
138 | # This is the list of variables to export in the environment when |
139 | # configuring any subdirectory. It must also be exported whenever | |
140 | # recursing into a build directory in case that directory's Makefile | |
141 | # re-runs configure. | |
142 | BASE_EXPORTS = \ | |
143 | FLEX="$(FLEX)"; export FLEX; \ | |
144 | LEX="$(LEX)"; export LEX; \ | |
145 | BISON="$(BISON)"; export BISON; \ | |
146 | YACC="$(YACC)"; export YACC; \ | |
147 | M4="$(M4)"; export M4; \ | |
87264276 | 148 | SED="$(SED)"; export SED; \ |
f945e229 | 149 | AWK="$(AWK)"; export AWK; \ |
b7e5a296 TT |
150 | MAKEINFO="$(MAKEINFO)"; export MAKEINFO; \ |
151 | GUILE="$(GUILE)"; export GUILE; | |
23f6b2f9 | 152 | |
4fc4dd12 | 153 | # This is the list of variables to export in the environment when |
23f6b2f9 | 154 | # configuring subdirectories for the build system. |
4fc4dd12 | 155 | BUILD_EXPORTS = \ |
23f6b2f9 | 156 | $(BASE_EXPORTS) \ |
4fc4dd12 DJ |
157 | AR="$(AR_FOR_BUILD)"; export AR; \ |
158 | AS="$(AS_FOR_BUILD)"; export AS; \ | |
159 | CC="$(CC_FOR_BUILD)"; export CC; \ | |
160 | CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \ | |
161 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
84401ce5 RP |
162 | CPP="$(CPP_FOR_BUILD)"; export CPP; \ |
163 | CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \ | |
4fc4dd12 DJ |
164 | CXX="$(CXX_FOR_BUILD)"; export CXX; \ |
165 | CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \ | |
4fc4dd12 | 166 | GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ |
632e2a07 ILT |
167 | GOC="$(GOC_FOR_BUILD)"; export GOC; \ |
168 | GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \ | |
b4c522fa IB |
169 | GDC="$(GDC_FOR_BUILD)"; export GDC; \ |
170 | GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \ | |
1eee94d3 GM |
171 | GM2="$(GM2_FOR_BUILD)"; export GM2; \ |
172 | GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \ | |
4fc4dd12 | 173 | DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ |
3b5e8ee4 | 174 | DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \ |
4fc4dd12 DJ |
175 | LD="$(LD_FOR_BUILD)"; export LD; \ |
176 | LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ | |
177 | NM="$(NM_FOR_BUILD)"; export NM; \ | |
178 | RANLIB="$(RANLIB_FOR_BUILD)"; export RANLIB; \ | |
0136f2f7 | 179 | WINDRES="$(WINDRES_FOR_BUILD)"; export WINDRES; \ |
901119ae | 180 | WINDMC="$(WINDMC_FOR_BUILD)"; export WINDMC; |
df0f0674 | 181 | |
f8c33439 | 182 | # These variables must be set on the make command line for directories |
32e6ed92 | 183 | # built for the build system to override those in BASE_FLAGS_TO_PASS. |
f8c33439 JM |
184 | EXTRA_BUILD_FLAGS = \ |
185 | CFLAGS="$(CFLAGS_FOR_BUILD)" \ | |
186 | LDFLAGS="$(LDFLAGS_FOR_BUILD)" | |
187 | ||
df0f0674 NN |
188 | # This is the list of directories to built for the host system. |
189 | SUBDIRS = @configdirs@ | |
aae29963 | 190 | TARGET_CONFIGDIRS = @target_configdirs@ |
df0f0674 NN |
191 | # This is set by the configure script to the arguments to use when configuring |
192 | # directories built for the host system. | |
193 | HOST_CONFIGARGS = @host_configargs@ | |
215c351a PB |
194 | # Host programs are put under this directory, which is . except if building |
195 | # with srcdir=.. | |
196 | HOST_SUBDIR = @host_subdir@ | |
4fc4dd12 | 197 | # This is the list of variables to export in the environment when |
2abefe3d PB |
198 | # configuring subdirectories for the host system. We need to pass |
199 | # some to the GCC configure because of its hybrid host/target nature. | |
4fc4dd12 | 200 | HOST_EXPORTS = \ |
23f6b2f9 | 201 | $(BASE_EXPORTS) \ |
4fc4dd12 | 202 | CC="$(CC)"; export CC; \ |
00afcaa0 | 203 | ADA_CFLAGS="$(ADA_CFLAGS)"; export ADA_CFLAGS; \ |
75299e4f | 204 | CRAB1_LIBS="$(CRAB1_LIBS)"; export CRAB1_LIBS; \ |
4fc4dd12 DJ |
205 | CFLAGS="$(CFLAGS)"; export CFLAGS; \ |
206 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ | |
207 | CXX="$(CXX)"; export CXX; \ | |
208 | CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \ | |
4a4a4e99 | 209 | GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \ |
632e2a07 | 210 | GOC="$(GOC)"; export GOC; \ |
b4c522fa | 211 | GDC="$(GDC)"; export GDC; \ |
1eee94d3 | 212 | GM2="$(GM2)"; export GM2; \ |
bab1b248 | 213 | GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)"; export GNATMAKE_FOR_BUILD; \ |
4fc4dd12 DJ |
214 | AR="$(AR)"; export AR; \ |
215 | AS="$(AS)"; export AS; \ | |
216 | CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ | |
84401ce5 RP |
217 | CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \ |
218 | CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \ | |
d0fc6e9f | 219 | CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \ |
4fc4dd12 | 220 | DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \ |
3b5e8ee4 | 221 | DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \ |
4fc4dd12 | 222 | LD="$(LD)"; export LD; \ |
00020c16 | 223 | LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \ |
4fc4dd12 DJ |
224 | NM="$(NM)"; export NM; \ |
225 | RANLIB="$(RANLIB)"; export RANLIB; \ | |
226 | WINDRES="$(WINDRES)"; export WINDRES; \ | |
901119ae | 227 | WINDMC="$(WINDMC)"; export WINDMC; \ |
4fc4dd12 | 228 | OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ |
1c020272 | 229 | OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ |
e4a9a572 | 230 | OTOOL="$(OTOOL)"; export OTOOL; \ |
1ddd41fd | 231 | PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ |
e7a82751 | 232 | READELF="$(READELF)"; export READELF; \ |
2abefe3d PB |
233 | AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ |
234 | AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ | |
3b5e8ee4 | 235 | DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \ |
eabd44a0 | 236 | GCC_FOR_TARGET="$(GCC_FOR_TARGET) $$TFLAGS"; export GCC_FOR_TARGET; \ |
2abefe3d PB |
237 | LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \ |
238 | NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \ | |
239 | OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \ | |
9bccfdf5 | 240 | OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \ |
e4a9a572 | 241 | OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \ |
2abefe3d | 242 | RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \ |
e7a82751 | 243 | READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \ |
4fc4dd12 | 244 | TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \ |
00020c16 | 245 | HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \ |
4fc4dd12 | 246 | GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \ |
4c4a5bbc | 247 | GMPINC="$(HOST_GMPINC)"; export GMPINC; \ |
eae1a5d4 | 248 | ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \ |
33ad93b9 | 249 | ISLINC="$(HOST_ISLINC)"; export ISLINC; \ |
105b682e | 250 | XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \ |
1061f99e PB |
251 | @if gcc-bootstrap |
252 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ | |
253 | @endif gcc-bootstrap | |
0bff65e7 | 254 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); |
4fc4dd12 | 255 | |
f61428ed AO |
256 | POSTSTAGE1_CXX_EXPORT = \ |
257 | CXX='$(CXX)'; export CXX; \ | |
258 | CXX_FOR_BUILD='$(CXX_FOR_BUILD)'; export CXX_FOR_BUILD; | |
259 | @if target-libstdc++-v3-bootstrap | |
260 | # Override the above if we're bootstrapping C++. | |
261 | POSTSTAGE1_CXX_EXPORT = \ | |
5d99894e | 262 | CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xg++$(exeext) \ |
f61428ed | 263 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \ |
77198d71 | 264 | -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ |
242f5421 | 265 | -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ |
3b9edeac JJ |
266 | `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \ |
267 | `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \ | |
268 | `if $(LEAN); then echo ' -isystem '; else echo ' -I'; fi`$$s/libstdc++-v3/libsupc++ \ | |
242f5421 DE |
269 | -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ |
270 | -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs"; \ | |
271 | export CXX; \ | |
f61428ed AO |
272 | CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD; |
273 | @endif target-libstdc++-v3-bootstrap | |
274 | ||
4fc4dd12 | 275 | # Similar, for later GCC stages. |
ce406537 | 276 | POSTSTAGE1_HOST_EXPORTS = \ |
a52a0a7f | 277 | $(HOST_EXPORTS) \ |
215c351a | 278 | CC="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/xgcc$(exeext) \ |
4a4a4e99 AO |
279 | -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \ |
280 | $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ | |
281 | CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \ | |
f61428ed | 282 | $(POSTSTAGE1_CXX_EXPORT) \ |
e04733ee | 283 | $(LTO_EXPORTS) \ |
b4c522fa | 284 | GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \ |
5fee5ec3 IB |
285 | -B$(build_tooldir)/bin/ $(GDCFLAGS_FOR_TARGET) \ |
286 | -B$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/gcc \ | |
b4c522fa | 287 | -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \ |
5fee5ec3 | 288 | -B$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \ |
b4c522fa IB |
289 | -I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \ |
290 | -L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \ | |
5fee5ec3 IB |
291 | -B$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ |
292 | -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; \ | |
b4c522fa IB |
293 | export GDC; \ |
294 | GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \ | |
00020c16 ILT |
295 | GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \ |
296 | LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \ | |
297 | HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS; | |
df0f0674 | 298 | |
df0f0674 NN |
299 | # Target libraries are put under this directory: |
300 | TARGET_SUBDIR = @target_subdir@ | |
301 | # This is set by the configure script to the arguments to use when configuring | |
302 | # directories built for the target. | |
25b42232 | 303 | TARGET_CONFIGARGS = @target_configargs@ --with-target-subdir="$(TARGET_SUBDIR)" |
4fc4dd12 | 304 | # This is the list of variables to export in the environment when |
60a2e213 | 305 | # configuring subdirectories for the target system. |
4fc4dd12 | 306 | BASE_TARGET_EXPORTS = \ |
23f6b2f9 | 307 | $(BASE_EXPORTS) \ |
4fc4dd12 | 308 | AR="$(AR_FOR_TARGET)"; export AR; \ |
2abefe3d | 309 | AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \ |
4a4a4e99 AO |
310 | CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \ |
311 | CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ | |
4fc4dd12 | 312 | CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \ |
e7daab31 | 313 | CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \ |
4a4a4e99 | 314 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ |
4a4a4e99 | 315 | GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ |
632e2a07 | 316 | GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ |
b4c522fa | 317 | GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \ |
1eee94d3 | 318 | GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \ |
bab1b248 | 319 | GNATMAKE_FOR_BUILD="$(GNATMAKE_FOR_BUILD)"; export GNATMAKE_FOR_BUILD; \ |
4fc4dd12 | 320 | DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ |
3b5e8ee4 | 321 | DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \ |
2abefe3d | 322 | LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ |
4fc4dd12 | 323 | LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ |
040b1c5a | 324 | LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \ |
2abefe3d | 325 | NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \ |
d739199a | 326 | OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \ |
9bccfdf5 | 327 | OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \ |
e4a9a572 | 328 | OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \ |
4fc4dd12 | 329 | RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \ |
e7a82751 | 330 | READELF="$(READELF_FOR_TARGET)"; export READELF; \ |
040b1c5a | 331 | STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \ |
d1bff1ba | 332 | SYSROOT_CFLAGS_FOR_TARGET="$(SYSROOT_CFLAGS_FOR_TARGET)"; export SYSROOT_CFLAGS_FOR_TARGET; \ |
4c4a5bbc | 333 | WINDRES="$(WINDRES_FOR_TARGET)"; export WINDRES; \ |
901119ae | 334 | WINDMC="$(WINDMC_FOR_TARGET)"; export WINDMC; \ |
60a2e213 RW |
335 | @if gcc-bootstrap |
336 | $(RPATH_ENVVAR)=`echo "$(TARGET_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ | |
337 | @endif gcc-bootstrap | |
aae29963 JR |
338 | $(RPATH_ENVVAR)=`echo "$(HOST_LIB_PATH)$$$(RPATH_ENVVAR)" | sed 's,::*,:,g;s,^:*,,;s,:*$$,,'`; export $(RPATH_ENVVAR); \ |
339 | TARGET_CONFIGDIRS="$(TARGET_CONFIGDIRS)"; export TARGET_CONFIGDIRS; | |
4fc4dd12 DJ |
340 | |
341 | RAW_CXX_TARGET_EXPORTS = \ | |
342 | $(BASE_TARGET_EXPORTS) \ | |
343 | CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ | |
4a4a4e99 | 344 | CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; |
4fc4dd12 DJ |
345 | |
346 | NORMAL_TARGET_EXPORTS = \ | |
347 | $(BASE_TARGET_EXPORTS) \ | |
70bc553e | 348 | CXX_FOR_TARGET="$(CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \ |
4a4a4e99 | 349 | CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; |
df0f0674 | 350 | |
6de9cd9a DN |
351 | # Where to find GMP |
352 | HOST_GMPLIBS = @gmplibs@ | |
353 | HOST_GMPINC = @gmpinc@ | |
354 | ||
e357a5e0 | 355 | # Where to find isl |
eae1a5d4 | 356 | HOST_ISLLIBS = @isllibs@ |
33ad93b9 | 357 | HOST_ISLINC = @islinc@ |
f8bf9252 | 358 | |
df0f0674 NN |
359 | # ---------------------------------------------- |
360 | # Programs producing files for the BUILD machine | |
361 | # ---------------------------------------------- | |
362 | ||
72691ba6 | 363 | SHELL = @SHELL@ |
df0f0674 NN |
364 | |
365 | # pwd command to use. Allow user to override default by setting PWDCMD in | |
366 | # the environment to account for automounters. The make variable must not | |
367 | # be called PWDCMD, otherwise the value set here is passed to make | |
368 | # subprocesses and overrides the setting from the user's environment. | |
8c90b13a L |
369 | # Don't use PWD since it is a common shell environment variable and we |
370 | # don't want to corrupt it. | |
371 | PWD_COMMAND = $${PWDCMD-pwd} | |
df0f0674 NN |
372 | |
373 | # compilers to use to create programs which must be run in the build | |
374 | # environment. | |
0999159b PB |
375 | AR_FOR_BUILD = @AR_FOR_BUILD@ |
376 | AS_FOR_BUILD = @AS_FOR_BUILD@ | |
df0f0674 | 377 | CC_FOR_BUILD = @CC_FOR_BUILD@ |
6691a79e | 378 | CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ |
84401ce5 RP |
379 | CPP_FOR_BUILD = @CPP_FOR_BUILD@ |
380 | CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@ | |
0999159b PB |
381 | CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@ |
382 | CXX_FOR_BUILD = @CXX_FOR_BUILD@ | |
383 | DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ | |
3b5e8ee4 | 384 | DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@ |
0999159b | 385 | GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ |
632e2a07 | 386 | GOC_FOR_BUILD = @GOC_FOR_BUILD@ |
b4c522fa | 387 | GDC_FOR_BUILD = @GDC_FOR_BUILD@ |
1eee94d3 | 388 | GM2_FOR_BUILD = @GM2_FOR_BUILD@ |
bab1b248 | 389 | GNATMAKE_FOR_BUILD = @GNATMAKE_FOR_BUILD@ |
0999159b PB |
390 | LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ |
391 | LD_FOR_BUILD = @LD_FOR_BUILD@ | |
392 | NM_FOR_BUILD = @NM_FOR_BUILD@ | |
393 | RANLIB_FOR_BUILD = @RANLIB_FOR_BUILD@ | |
394 | WINDMC_FOR_BUILD = @WINDMC_FOR_BUILD@ | |
395 | WINDRES_FOR_BUILD = @WINDRES_FOR_BUILD@ | |
df0f0674 NN |
396 | |
397 | # Special variables passed down in EXTRA_GCC_FLAGS. They are defined | |
398 | # here so that they can be overridden by Makefile fragments. | |
df0f0674 NN |
399 | BUILD_PREFIX = @BUILD_PREFIX@ |
400 | BUILD_PREFIX_1 = @BUILD_PREFIX_1@ | |
95ddd785 | 401 | |
45f366ab PB |
402 | # Flags to pass to stage2 and later makes. They are defined |
403 | # here so that they can be overridden by Makefile fragments. | |
404 | BOOT_CFLAGS= -g -O2 | |
d19bca38 | 405 | BOOT_LDFLAGS= |
7cb9fd07 | 406 | BOOT_ADAFLAGS= -gnatpg |
45f366ab | 407 | |
87264276 PB |
408 | AWK = @AWK@ |
409 | SED = @SED@ | |
2abefe3d PB |
410 | BISON = @BISON@ |
411 | YACC = @YACC@ | |
412 | FLEX = @FLEX@ | |
413 | LEX = @LEX@ | |
414 | M4 = @M4@ | |
415 | MAKEINFO = @MAKEINFO@ | |
416 | EXPECT = @EXPECT@ | |
417 | RUNTEST = @RUNTEST@ | |
95ddd785 | 418 | |
275f7bc3 | 419 | AUTO_PROFILE = gcc-auto-profile --all -c 10000000 |
277d7ee0 | 420 | |
95ddd785 NN |
421 | # This just becomes part of the MAKEINFO definition passed down to |
422 | # sub-makes. It lets flags be given on the command line while still | |
423 | # using the makeinfo from the object tree. | |
2f50999f GP |
424 | # (Default to avoid splitting info files by setting the threshold high.) |
425 | MAKEINFOFLAGS = --split-size=5000000 | |
95ddd785 | 426 | |
df0f0674 NN |
427 | # --------------------------------------------- |
428 | # Programs producing files for the HOST machine | |
429 | # --------------------------------------------- | |
95ddd785 | 430 | |
df0f0674 | 431 | AS = @AS@ |
126f707e | 432 | AR = @AR@ @AR_PLUGIN_OPTION@ |
df0f0674 | 433 | AR_FLAGS = rc |
df0f0674 | 434 | CC = @CC@ |
df0f0674 | 435 | CXX = @CXX@ |
df0f0674 | 436 | DLLTOOL = @DLLTOOL@ |
3b5e8ee4 | 437 | DSYMUTIL = @DSYMUTIL@ |
df0f0674 | 438 | LD = @LD@ |
2abefe3d PB |
439 | LIPO = @LIPO@ |
440 | NM = @NM@ | |
2d309510 | 441 | OBJDUMP = @OBJDUMP@ |
e4a9a572 | 442 | OTOOL = @OTOOL@ |
126f707e | 443 | RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@ |
e7a82751 | 444 | READELF = @READELF@ |
2abefe3d | 445 | STRIP = @STRIP@ |
df0f0674 | 446 | WINDRES = @WINDRES@ |
901119ae | 447 | WINDMC = @WINDMC@ |
95ddd785 | 448 | |
b4c522fa | 449 | GDC = @GDC@ |
5305be7e RG |
450 | GNATBIND = @GNATBIND@ |
451 | GNATMAKE = @GNATMAKE@ | |
452 | ||
2abefe3d | 453 | CFLAGS = @CFLAGS@ |
f6671c93 | 454 | LDFLAGS = @LDFLAGS@ |
2abefe3d PB |
455 | LIBCFLAGS = $(CFLAGS) |
456 | CXXFLAGS = @CXXFLAGS@ | |
457 | LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates | |
632e2a07 | 458 | GOCFLAGS = $(CFLAGS) |
e4cd4f78 | 459 | GDCFLAGS = @GDCFLAGS@ |
1eee94d3 | 460 | GM2FLAGS = $(CFLAGS) |
df0f0674 | 461 | |
75299e4f AC |
462 | CRAB1_LIBS = @CRAB1_LIBS@ |
463 | ||
1ddd41fd SM |
464 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ |
465 | ||
b7e5a296 TT |
466 | GUILE = guile |
467 | ||
4a5e71f2 L |
468 | # Pass additional PGO and LTO compiler options to the PGO build. |
469 | BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) | |
470 | override CFLAGS += $(BUILD_CFLAGS) | |
471 | override CXXFLAGS += $(BUILD_CFLAGS) | |
472 | ||
473 | # Additional PGO and LTO compiler options to generate profiling data | |
474 | # for the PGO build. | |
475 | PGO_BUILD_GEN_FLAGS_TO_PASS = \ | |
476 | PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \ | |
477 | PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@" | |
478 | ||
479 | # NB: Filter out any compiler options which may fail PGO training runs. | |
480 | PGO_BUILD_TRAINING_CFLAGS:= \ | |
481 | $(filter-out -Werror=%,$(CFLAGS)) | |
482 | PGO_BUILD_TRAINING_CXXFLAGS:=\ | |
483 | $(filter-out -Werror=%,$(CXXFLAGS)) | |
484 | PGO_BUILD_TRAINING_CFLAGS:= \ | |
485 | $(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS)) | |
486 | PGO_BUILD_TRAINING_CXXFLAGS:= \ | |
487 | $(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS)) | |
488 | PGO_BUILD_TRAINING_CFLAGS:= \ | |
489 | $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS)) | |
490 | PGO_BUILD_TRAINING_CXXFLAGS:= \ | |
491 | $(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS)) | |
492 | PGO_BUILD_TRAINING_FLAGS_TO_PASS = \ | |
493 | PGO_BUILD_TRAINING=yes \ | |
494 | CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \ | |
495 | CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)" | |
496 | ||
497 | # Ignore "make check" errors in PGO training runs. | |
498 | PGO_BUILD_TRAINING_MFLAGS = -i | |
499 | ||
500 | # Additional PGO and LTO compiler options to use profiling data for the | |
501 | # PGO build. | |
502 | PGO_BUILD_USE_FLAGS_TO_PASS = \ | |
503 | PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \ | |
504 | PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@" | |
505 | ||
506 | # PGO training targets for the PGO build. FIXME: Add gold tests to | |
507 | # training. | |
508 | PGO-TRAINING-TARGETS = binutils gas gdb ld sim | |
509 | PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS)) | |
510 | ||
277d7ee0 | 511 | CREATE_GCOV = create_gcov |
0c77a090 | 512 | PROFILE_MERGER = profile_merger |
277d7ee0 | 513 | |
4a4a4e99 AO |
514 | TFLAGS = |
515 | ||
516 | # Defaults for all stages; some are overridden below. | |
517 | ||
518 | STAGE_CFLAGS = $(BOOT_CFLAGS) | |
519 | STAGE_TFLAGS = $(TFLAGS) | |
520 | STAGE_CONFIGURE_FLAGS=@stage2_werror_flag@ | |
521 | ||
522 | [+ FOR bootstrap-stage +] | |
523 | # Defaults for stage [+id+]; some are overridden below. | |
524 | STAGE[+id+]_CFLAGS = $(STAGE_CFLAGS) | |
f61428ed AO |
525 | STAGE[+id+]_CXXFLAGS = $(CXXFLAGS) |
526 | @if target-libstdc++-v3-bootstrap | |
527 | # Override the above if we're bootstrapping C++. | |
528 | STAGE[+id+]_CXXFLAGS = $(STAGE[+id+]_CFLAGS) | |
529 | @endif target-libstdc++-v3-bootstrap | |
4a4a4e99 | 530 | STAGE[+id+]_TFLAGS = $(STAGE_TFLAGS) |
0823efed | 531 | STAGE[+id+]_CONFIGURE_FLAGS = $(STAGE_CONFIGURE_FLAGS) |
4a4a4e99 AO |
532 | [+ ENDFOR bootstrap-stage +] |
533 | ||
da0bfb86 JM |
534 | # By default, C and C++ are the only stage1 languages, because they are the |
535 | # only ones we require to build with the bootstrap compiler, and also the | |
536 | # only ones useful for building stage2. | |
8efea775 | 537 | |
4a4a4e99 | 538 | STAGE1_CFLAGS = @stage1_cflags@ |
f61428ed AO |
539 | STAGE1_CHECKING = @stage1_checking@ |
540 | STAGE1_LANGUAGES = @stage1_languages@ | |
d6a112af SJ |
541 | # * We force-disable coverage flags, since the installed compiler probably |
542 | # has never heard of them. Luckily, autoconf always respects the last | |
543 | # argument when conflicting --enable arguments are passed. | |
1652c6da | 544 | # * We also disable -Wformat, since older GCCs don't understand newer %s. |
d6a112af | 545 | STAGE1_CONFIGURE_FLAGS = $(STAGE1_CHECKING) \ |
1652c6da JM |
546 | --disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \ |
547 | --disable-build-format-warnings | |
8efea775 | 548 | |
5fee5ec3 IB |
549 | @if target-libphobos-bootstrap |
550 | STAGE1_CONFIGURE_FLAGS += --with-libphobos-druntime-only | |
551 | STAGE2_CONFIGURE_FLAGS += --with-libphobos-druntime-only | |
552 | @endif target-libphobos-bootstrap | |
553 | ||
ae05281f RB |
554 | # When using the slow stage1 compiler disable IL verification and forcefully |
555 | # enable it when using the stage2 compiler instead. As we later compare | |
556 | # stage2 and stage3 we are merely avoid doing redundant work, plus we apply | |
557 | # checking when building all target libraries for release builds. | |
558 | STAGE1_TFLAGS += -fno-checking | |
559 | STAGE2_CFLAGS += -fno-checking | |
560 | STAGE2_TFLAGS += -fno-checking | |
bece35ca RB |
561 | STAGE3_CFLAGS += -fchecking=1 |
562 | STAGE3_TFLAGS += -fchecking=1 | |
ae05281f | 563 | |
4a4a4e99 AO |
564 | STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate |
565 | STAGEprofile_TFLAGS = $(STAGE2_TFLAGS) | |
bb286d71 | 566 | |
bece35ca RB |
567 | STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS)) |
568 | STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS)) | |
0d053a49 | 569 | |
04638a81 | 570 | STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use -fprofile-reproducible=parallel-runs |
0d053a49 | 571 | STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS) |
2551e100 ST |
572 | # Disable warnings as errors for a few reasons: |
573 | # - sources for gen* binaries do not have .gcda files available | |
574 | # - inlining decisions generate extra warnings | |
575 | STAGEfeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS)) | |
1c8bd6a3 | 576 | |
0d6b822f | 577 | STAGEautoprofile_CFLAGS = $(filter-out -gtoggle,$(STAGE2_CFLAGS)) -g |
277d7ee0 AK |
578 | STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS) |
579 | ||
580 | STAGEautofeedback_CFLAGS = $(STAGE3_CFLAGS) | |
581 | STAGEautofeedback_TFLAGS = $(STAGE3_TFLAGS) | |
6657950d ER |
582 | # Disable warnings as errors since inlining decisions with -fauto-profile |
583 | # may result in additional warnings. | |
584 | STAGEautofeedback_CONFIGURE_FLAGS = $(filter-out --enable-werror-always,$(STAGE_CONFIGURE_FLAGS)) | |
277d7ee0 | 585 | |
bb286d71 AO |
586 | do-compare = @do_compare@ |
587 | do-compare3 = $(do-compare) | |
bb286d71 | 588 | |
df0f0674 NN |
589 | # ----------------------------------------------- |
590 | # Programs producing files for the TARGET machine | |
591 | # ----------------------------------------------- | |
95ddd785 | 592 | |
df0f0674 | 593 | AR_FOR_TARGET=@AR_FOR_TARGET@ |
4977bab6 | 594 | AS_FOR_TARGET=@AS_FOR_TARGET@ |
4a4a4e99 | 595 | CC_FOR_TARGET=$(STAGE_CC_WRAPPER) @CC_FOR_TARGET@ |
4de997d1 | 596 | |
df0f0674 NN |
597 | # If GCC_FOR_TARGET is not overriden on the command line, then this |
598 | # variable is passed down to the gcc Makefile, where it is used to | |
599 | # build libgcc2.a. We define it here so that it can itself be | |
600 | # overridden on the command line. | |
4a4a4e99 AO |
601 | GCC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCC_FOR_TARGET@ |
602 | CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@ | |
603 | RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@ | |
4a4a4e99 | 604 | GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ |
632e2a07 | 605 | GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ |
b4c522fa | 606 | GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@ |
1eee94d3 | 607 | GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@ |
4977bab6 | 608 | DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ |
3b5e8ee4 | 609 | DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@ |
df0f0674 | 610 | LD_FOR_TARGET=@LD_FOR_TARGET@ |
df0f0674 | 611 | |
040b1c5a | 612 | LIPO_FOR_TARGET=@LIPO_FOR_TARGET@ |
df0f0674 | 613 | NM_FOR_TARGET=@NM_FOR_TARGET@ |
d739199a | 614 | OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@ |
9bccfdf5 | 615 | OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@ |
e4a9a572 | 616 | OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@ |
4977bab6 | 617 | RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@ |
e7a82751 | 618 | READELF_FOR_TARGET=@READELF_FOR_TARGET@ |
040b1c5a | 619 | STRIP_FOR_TARGET=@STRIP_FOR_TARGET@ |
df0f0674 | 620 | WINDRES_FOR_TARGET=@WINDRES_FOR_TARGET@ |
901119ae | 621 | WINDMC_FOR_TARGET=@WINDMC_FOR_TARGET@ |
95ddd785 | 622 | |
2abefe3d PB |
623 | COMPILER_AS_FOR_TARGET=@COMPILER_AS_FOR_TARGET@ |
624 | COMPILER_LD_FOR_TARGET=@COMPILER_LD_FOR_TARGET@ | |
625 | COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_TARGET@ | |
626 | ||
1c8bd6a3 PB |
627 | CFLAGS_FOR_TARGET = @CFLAGS_FOR_TARGET@ |
628 | CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@ | |
1c8bd6a3 | 629 | |
2abefe3d PB |
630 | LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET) |
631 | LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates | |
6f57bdf6 | 632 | LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ |
1eee94d3 | 633 | GM2FLAGS_FOR_TARGET = -O2 -g |
632e2a07 | 634 | GOCFLAGS_FOR_TARGET = -O2 -g |
b4c522fa | 635 | GDCFLAGS_FOR_TARGET = -O2 -g |
df0f0674 | 636 | |
4a4a4e99 AO |
637 | FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ |
638 | SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ | |
639 | DEBUG_PREFIX_CFLAGS_FOR_TARGET = @DEBUG_PREFIX_CFLAGS_FOR_TARGET@ | |
640 | ||
641 | XGCC_FLAGS_FOR_TARGET = $(FLAGS_FOR_TARGET) $(SYSROOT_CFLAGS_FOR_TARGET) $(DEBUG_PREFIX_CFLAGS_FOR_TARGET) | |
642 | ||
df0f0674 NN |
643 | # ------------------------------------ |
644 | # Miscellaneous targets and flag lists | |
645 | # ------------------------------------ | |
646 | ||
95ddd785 NN |
647 | # The first rule in the file had better be this one. Don't put any above it. |
648 | # This lives here to allow makefile fragments to contain dependencies. | |
1061f99e | 649 | all: |
95ddd785 | 650 | |
95ddd785 | 651 | #### host and target specific makefile fragments come in here. |
671aa708 NN |
652 | @target_makefile_frag@ |
653 | @alphaieee_frag@ | |
654 | @ospace_frag@ | |
655 | @host_makefile_frag@ | |
95ddd785 NN |
656 | ### |
657 | ||
0bff65e7 | 658 | # This is the list of directories that may be needed in RPATH_ENVVAR |
66c92425 | 659 | # so that programs built for the target machine work. |
0bff65e7 PB |
660 | TARGET_LIB_PATH = [+ FOR target_modules +][+ |
661 | IF lib_path +]$(TARGET_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
662 | ENDFOR target_modules +]$(HOST_LIB_PATH_gcc) | |
663 | [+ FOR target_modules +][+ IF lib_path +] | |
664 | @if target-[+module+] | |
665 | TARGET_LIB_PATH_[+module+] = $$r/$(TARGET_SUBDIR)/[+module+]/[+lib_path+]: | |
666 | @endif target-[+module+] | |
667 | [+ ENDIF lib_path +][+ ENDFOR target_modules +] | |
668 | ||
669 | ||
670 | # This is the list of directories that may be needed in RPATH_ENVVAR | |
671 | # so that programs built for the host machine work. | |
672 | HOST_LIB_PATH = [+ FOR host_modules +][+ | |
673 | IF lib_path +]$(HOST_LIB_PATH_[+module+])[+ ENDIF lib_path +][+ | |
674 | ENDFOR host_modules +] | |
675 | ||
676 | # Define HOST_LIB_PATH_gcc here, for the sake of TARGET_LIB_PATH, ouch | |
677 | @if gcc | |
d89f0ad6 | 678 | HOST_LIB_PATH_gcc = $$r/$(HOST_SUBDIR)/gcc$(GCC_SHLIB_SUBDIR):$$r/$(HOST_SUBDIR)/prev-gcc$(GCC_SHLIB_SUBDIR): |
0bff65e7 PB |
679 | @endif gcc |
680 | ||
681 | [+ FOR host_modules +][+ IF lib_path +] | |
682 | @if [+module+] | |
683 | HOST_LIB_PATH_[+module+] = \ | |
684 | $$r/$(HOST_SUBDIR)/[+module+]/[+lib_path+]:[+ IF bootstrap | |
685 | +]$$r/$(HOST_SUBDIR)/prev-[+module+]/[+lib_path+]:[+ ENDIF bootstrap +] | |
686 | @endif [+module+] | |
687 | [+ ENDIF lib_path +][+ ENDFOR host_modules +] | |
688 | ||
9aff220f AO |
689 | CXX_FOR_TARGET_FLAG_TO_PASS = \ |
690 | "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" | |
691 | @if target-libstdc++-v3 | |
692 | # CXX_FOR_TARGET is tricky to get right for target libs that require a | |
693 | # functional C++ compiler. When we recurse, if we expand | |
694 | # CXX_FOR_TARGET before configuring libstdc++-v3, we won't get | |
695 | # libstdc++ include flags from the script. Instead, we get an | |
696 | # -funconfigured-* word, so that we'll get errors if this invalid C++ | |
697 | # command line is used for anything, but also so that we can use the | |
698 | # word to decide whether or not to pass on this CXX_FOR_TARGET. If we | |
699 | # don't pass it on, sub-make will use the default definition, that | |
700 | # re-expands it at the time of use, so we'll get it right when we need | |
701 | # it. One potential exception is the expansion of CXX_FOR_TARGET | |
702 | # passed down as part of CXX within TARGET_FLAGS, but this wouldn't | |
703 | # really work, for C++ host programs can't depend on the current-stage | |
704 | # C++ target library. | |
705 | CXX_FOR_TARGET_FLAG_TO_PASS = \ | |
706 | $(shell if echo "$(CXX_FOR_TARGET)" | grep " -funconfigured-" > /dev/null; then :; else echo '"CXX_FOR_TARGET=$(CXX_FOR_TARGET)"'; fi) | |
707 | @endif target-libstdc++-v3 | |
708 | ||
da0bfb86 JM |
709 | # Flags to pass down to all sub-makes. STAGE*FLAGS, |
710 | # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them | |
711 | # overrideable (for a bootstrap build stage1 also builds gcc.info). | |
cc11cc9b PB |
712 | BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \ |
713 | "`echo '[+flag+]=$([+flag+])' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"[+ ELSE optional +] \ | |
4a4a4e99 AO |
714 | "[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \ |
715 | "STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \ | |
f61428ed | 716 | "STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \ |
1c67e69c | 717 | "STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \ |
4a4a4e99 | 718 | "STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \ |
9aff220f | 719 | $(CXX_FOR_TARGET_FLAG_TO_PASS) \ |
4a4a4e99 | 720 | "TFLAGS=$(TFLAGS)" \ |
e75f9147 | 721 | "CONFIG_SHELL=$(SHELL)" \ |
cefadad1 MM |
722 | "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ |
723 | $(if $(LSAN_OPTIONS),"LSAN_OPTIONS=$(LSAN_OPTIONS)") | |
95ddd785 | 724 | |
4de997d1 PB |
725 | # We leave this in just in case, but it is not needed anymore. |
726 | RECURSE_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) | |
ad6717df | 727 | |
95ddd785 NN |
728 | # Flags to pass down to most sub-makes, in which we're building with |
729 | # the host environment. | |
95ddd785 NN |
730 | EXTRA_HOST_FLAGS = \ |
731 | 'AR=$(AR)' \ | |
732 | 'AS=$(AS)' \ | |
733 | 'CC=$(CC)' \ | |
734 | 'CXX=$(CXX)' \ | |
735 | 'DLLTOOL=$(DLLTOOL)' \ | |
3b5e8ee4 | 736 | 'DSYMUTIL=$(DSYMUTIL)' \ |
4a4a4e99 | 737 | 'GFORTRAN=$(GFORTRAN)' \ |
632e2a07 | 738 | 'GOC=$(GOC)' \ |
b4c522fa | 739 | 'GDC=$(GDC)' \ |
1eee94d3 | 740 | 'GM2=$(GM2)' \ |
95ddd785 | 741 | 'LD=$(LD)' \ |
2abefe3d | 742 | 'LIPO=$(LIPO)' \ |
95ddd785 | 743 | 'NM=$(NM)' \ |
2d309510 | 744 | 'OBJDUMP=$(OBJDUMP)' \ |
e4a9a572 | 745 | 'OTOOL=$(OTOOL)' \ |
c858bf1e | 746 | 'RANLIB=$(RANLIB)' \ |
e7a82751 | 747 | 'READELF=$(READELF)' \ |
2abefe3d | 748 | 'STRIP=$(STRIP)' \ |
901119ae | 749 | 'WINDRES=$(WINDRES)' \ |
277d7ee0 | 750 | 'WINDMC=$(WINDMC)' \ |
0c77a090 ER |
751 | 'CREATE_GCOV=$(CREATE_GCOV)' \ |
752 | 'PROFILE_MERGER=$(PROFILE_MERGER)' | |
95ddd785 NN |
753 | |
754 | FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) | |
755 | ||
0b21f5d3 EB |
756 | # Flags to pass to stage1 or when not bootstrapping. |
757 | ||
758 | STAGE1_FLAGS_TO_PASS = \ | |
759 | LDFLAGS="$${LDFLAGS}" \ | |
760 | HOST_LIBS="$${HOST_LIBS}" | |
761 | ||
8efea775 PB |
762 | # Flags to pass to stage2 and later makes. |
763 | ||
764 | POSTSTAGE1_FLAGS_TO_PASS = \ | |
00020c16 ILT |
765 | CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \ |
766 | CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \ | |
b4c522fa | 767 | GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \ |
1eee94d3 | 768 | GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \ |
00020c16 | 769 | GNATBIND="$${GNATBIND}" \ |
f61428ed AO |
770 | LDFLAGS="$${LDFLAGS}" \ |
771 | HOST_LIBS="$${HOST_LIBS}" \ | |
e04733ee | 772 | $(LTO_FLAGS_TO_PASS) \ |
8efea775 PB |
773 | "`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" |
774 | ||
77019397 MO |
775 | @if gcc-bootstrap |
776 | EXTRA_HOST_EXPORTS = if [ $(current_stage) != stage1 ]; then \ | |
777 | $(POSTSTAGE1_HOST_EXPORTS) \ | |
fafb95a6 | 778 | fi; |
77019397 MO |
779 | |
780 | EXTRA_BOOTSTRAP_FLAGS = CC="$$CC" CXX="$$CXX" LDFLAGS="$$LDFLAGS" | |
781 | @endif gcc-bootstrap | |
782 | ||
95ddd785 | 783 | # Flags to pass down to makes which are built with the target environment. |
f41d6665 DJ |
784 | # The double $ decreases the length of the command line; those variables |
785 | # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them. The | |
1c8bd6a3 PB |
786 | # *_CFLAGS_FOR_TARGET variables are not passed down and most often empty, |
787 | # so we expand them here. | |
95ddd785 NN |
788 | EXTRA_TARGET_FLAGS = \ |
789 | 'AR=$$(AR_FOR_TARGET)' \ | |
f41d6665 | 790 | 'AS=$(COMPILER_AS_FOR_TARGET)' \ |
4a4a4e99 AO |
791 | 'CC=$$(CC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ |
792 | 'CFLAGS=$$(CFLAGS_FOR_TARGET)' \ | |
b6a65eb6 JJ |
793 | 'CXX=$$(CXX_FOR_TARGET) -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/src/.libs \ |
794 | -B$$r/$$(TARGET_SUBDIR)/libstdc++-v3/libsupc++/.libs \ | |
795 | $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ | |
4a4a4e99 | 796 | 'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \ |
95ddd785 | 797 | 'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \ |
3b5e8ee4 | 798 | 'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \ |
4a4a4e99 | 799 | 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ |
632e2a07 ILT |
800 | 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ |
801 | 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ | |
b4c522fa IB |
802 | 'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ |
803 | 'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \ | |
1eee94d3 GM |
804 | 'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ |
805 | 'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \ | |
f41d6665 | 806 | 'LD=$(COMPILER_LD_FOR_TARGET)' \ |
e3791243 | 807 | 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ |
4a4a4e99 AO |
808 | 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \ |
809 | 'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \ | |
f41d6665 | 810 | 'NM=$(COMPILER_NM_FOR_TARGET)' \ |
d739199a | 811 | 'OBJDUMP=$$(OBJDUMP_FOR_TARGET)' \ |
9bccfdf5 | 812 | 'OBJCOPY=$$(OBJCOPY_FOR_TARGET)' \ |
95ddd785 | 813 | 'RANLIB=$$(RANLIB_FOR_TARGET)' \ |
e7a82751 | 814 | 'READELF=$$(READELF_FOR_TARGET)' \ |
901119ae | 815 | 'WINDRES=$$(WINDRES_FOR_TARGET)' \ |
4a4a4e99 AO |
816 | 'WINDMC=$$(WINDMC_FOR_TARGET)' \ |
817 | 'XGCC_FLAGS_FOR_TARGET=$(XGCC_FLAGS_FOR_TARGET)' \ | |
b6a65eb6 JJ |
818 | 'STAGE1_LDFLAGS=$$(POSTSTAGE1_LDFLAGS)' \ |
819 | 'STAGE1_LIBS=$$(POSTSTAGE1_LIBS)' \ | |
4a4a4e99 | 820 | "TFLAGS=$$TFLAGS" |
95ddd785 NN |
821 | |
822 | TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) | |
823 | ||
824 | # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it | |
825 | # unfortunately needs the native compiler and the target ar and | |
826 | # ranlib. | |
827 | # If any variables are added here, they must be added to do-*, below. | |
1358ccea | 828 | # The BUILD_* variables are a special case, which are used for the gcc |
95ddd785 NN |
829 | # cross-building scheme. |
830 | EXTRA_GCC_FLAGS = \ | |
eabd44a0 | 831 | "GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \ |
1eee94d3 | 832 | "GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \ |
d4cd9d81 | 833 | "`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \ |
f9989b51 | 834 | "`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" |
95ddd785 | 835 | |
d29b8ad8 | 836 | GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS) $(EXTRA_GCC_FLAGS) |
95ddd785 | 837 | |
4a4a4e99 | 838 | @if gcc |
e12c4094 | 839 | BUILD_CONFIG = @BUILD_CONFIG@ |
4a4a4e99 AO |
840 | ifneq ($(BUILD_CONFIG),) |
841 | include $(foreach CONFIG, $(BUILD_CONFIG), $(srcdir)/config/$(CONFIG).mk) | |
842 | endif | |
843 | @endif gcc | |
844 | ||
8b87bb96 | 845 | .PHONY: configure-host |
d32ab992 | 846 | configure-host: [+ |
8b87bb96 NN |
847 | FOR host_modules +] \ |
848 | maybe-configure-[+module+][+ | |
849 | ENDFOR host_modules +] | |
850 | .PHONY: configure-target | |
851 | configure-target: [+ | |
852 | FOR target_modules +] \ | |
853 | maybe-configure-target-[+module+][+ | |
854 | ENDFOR target_modules +] | |
95ddd785 | 855 | |
f516a7da PB |
856 | # The target built for a native non-bootstrap build. |
857 | .PHONY: all | |
4a5e71f2 L |
858 | |
859 | # --enable-pgo-build enables the PGO build. | |
860 | # 1. First build with -fprofile-generate. | |
861 | # 2. Use "make maybe-check-*" to generate profiling data. | |
862 | # 3. Use "make clean" to remove the previous build. | |
863 | # 4. Rebuild with -fprofile-use. | |
1061f99e PB |
864 | all: |
865 | @if gcc-bootstrap | |
2abefe3d | 866 | [ -f stage_final ] || echo stage3 > stage_final |
1061f99e PB |
867 | @r=`${PWD_COMMAND}`; export r; \ |
868 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
f41d6665 | 869 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble |
1061f99e | 870 | @endif gcc-bootstrap |
f41d6665 | 871 | @: $(MAKE); $(unstage) |
4a5e71f2 | 872 | +@r=`${PWD_COMMAND}`; export r; \ |
1061f99e | 873 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
4a4a4e99 | 874 | @if gcc-bootstrap |
0f501837 | 875 | if [ -f stage_last ]; then \ |
a1fc946a | 876 | TFLAGS="$(STAGE$(shell test ! -f stage_last || sed s,^stage,, stage_last)_TFLAGS)"; \ |
2abefe3d | 877 | $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \ |
1061f99e | 878 | else \ |
4a4a4e99 | 879 | @endif gcc-bootstrap |
4a5e71f2 L |
880 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) \ |
881 | $(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \ | |
882 | @if pgo-build | |
883 | && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \ | |
884 | $(PGO_BUILD_TRAINING_MFLAGS) \ | |
885 | $(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \ | |
886 | $(PGO_BUILD_TRAINING) \ | |
887 | && $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \ | |
888 | && $(MAKE) $(RECURSE_FLAGS_TO_PASS) \ | |
889 | $(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \ | |
890 | @endif pgo-build | |
31c98f49 AO |
891 | @if gcc-bootstrap |
892 | ; \ | |
394e9195 | 893 | fi \ |
31c98f49 | 894 | @endif gcc-bootstrap |
394e9195 | 895 | && : |
8b87bb96 | 896 | |
23f6b2f9 | 897 | .PHONY: all-build |
cc11cc9b PB |
898 | [+ FOR build_modules +] |
899 | all-build: maybe-all-build-[+module+][+ ENDFOR build_modules +] | |
900 | ||
8b87bb96 | 901 | .PHONY: all-host |
cc11cc9b PB |
902 | [+ FOR host_modules +][+ IF bootstrap +] |
903 | @if [+module+]-no-bootstrap[+ ENDIF bootstrap +] | |
904 | all-host: maybe-all-[+module+][+ IF bootstrap +] | |
905 | @endif [+module+]-no-bootstrap[+ ENDIF bootstrap +][+ ENDFOR host_modules +] | |
906 | ||
8b87bb96 | 907 | .PHONY: all-target |
cc11cc9b | 908 | [+ FOR target_modules +][+ IF bootstrap +] |
54fdc474 | 909 | @if target-[+module+]-no-bootstrap[+ ENDIF bootstrap +] |
cc11cc9b | 910 | all-target: maybe-all-target-[+module+][+ IF bootstrap +] |
54fdc474 DJ |
911 | @endif target-[+module+]-no-bootstrap[+ |
912 | ENDIF bootstrap +][+ ENDFOR target_modules +] | |
95ddd785 NN |
913 | |
914 | # Do a target for all the subdirectories. A ``make do-X'' will do a | |
915 | # ``make X'' in all subdirectories (because, in general, there is a | |
916 | # dependency (below) of X upon do-X, a ``make X'' will also do this, | |
917 | # but it may do additional work as well). | |
4977bab6 | 918 | [+ FOR recursive_targets +] |
1a1e6b96 | 919 | .PHONY: do-[+make_target+] |
1061f99e | 920 | do-[+make_target+]: |
f41d6665 | 921 | @: $(MAKE); $(unstage) |
e7c84bf8 PB |
922 | @r=`${PWD_COMMAND}`; export r; \ |
923 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
924 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+make_target+]-host \ | |
1061f99e | 925 | [+make_target+]-target |
1061f99e | 926 | |
1358ccea NN |
927 | |
928 | .PHONY: [+make_target+]-host | |
cc11cc9b PB |
929 | [+ FOR host_modules +] |
930 | [+make_target+]-host: maybe-[+make_target+]-[+module+][+ ENDFOR host_modules +] | |
1358ccea NN |
931 | |
932 | .PHONY: [+make_target+]-target | |
cc11cc9b PB |
933 | [+ FOR target_modules +] |
934 | [+make_target+]-target: maybe-[+make_target+]-target-[+module+][+ ENDFOR target_modules +] | |
4977bab6 ZW |
935 | [+ ENDFOR recursive_targets +] |
936 | ||
95ddd785 NN |
937 | # Here are the targets which correspond to the do-X targets. |
938 | ||
9c4d2493 | 939 | .PHONY: info installcheck dvi pdf html |
c3e80a16 | 940 | .PHONY: install-info install-dvi install-pdf install-html |
95ddd785 NN |
941 | .PHONY: clean distclean mostlyclean maintainer-clean realclean |
942 | .PHONY: local-clean local-distclean local-maintainer-clean | |
943 | info: do-info | |
944 | installcheck: do-installcheck | |
945 | dvi: do-dvi | |
b5422ad7 | 946 | pdf: do-pdf |
f87a2b2e | 947 | html: do-html |
95ddd785 | 948 | |
212f6dd0 NN |
949 | # Make sure makeinfo is built before we do a `make info', if we're |
950 | # in fact building texinfo. | |
951 | do-info: maybe-all-texinfo | |
95ddd785 NN |
952 | |
953 | install-info: do-install-info dir.info | |
8c90b13a | 954 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
fafb95a6 BRF |
955 | if [ -f dir.info ]; then \ |
956 | $(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \ | |
957 | else true; fi | |
95ddd785 | 958 | |
c3e80a16 EG |
959 | install-dvi: do-install-dvi |
960 | ||
9c4d2493 BM |
961 | install-pdf: do-install-pdf |
962 | ||
65d6e994 CD |
963 | install-html: do-install-html |
964 | ||
95ddd785 NN |
965 | local-clean: |
966 | -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log | |
967 | ||
968 | local-distclean: | |
969 | -rm -f Makefile config.status config.cache mh-frag mt-frag | |
f3653cf5 | 970 | -rm -f maybedep.tmp serdep.tmp stage_final |
95ddd785 NN |
971 | -if [ "$(TARGET_SUBDIR)" != "." ]; then \ |
972 | rm -rf $(TARGET_SUBDIR); \ | |
973 | else true; fi | |
0c227849 | 974 | -rm -rf $(BUILD_SUBDIR) |
215c351a PB |
975 | -if [ "$(HOST_SUBDIR)" != "." ]; then \ |
976 | rm -rf $(HOST_SUBDIR); \ | |
977 | else true; fi | |
95ddd785 NN |
978 | -rm -f texinfo/po/Makefile texinfo/po/Makefile.in texinfo/info/Makefile |
979 | -rm -f texinfo/doc/Makefile texinfo/po/POTFILES | |
980 | -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null | |
981 | -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null | |
2efd8b1f NS |
982 | -rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null |
983 | -rmdir libcc1 libiberty texinfo zlib 2>/dev/null | |
e50390fc | 984 | -find . -name config.cache -exec rm -f {} \; \; 2>/dev/null |
95ddd785 NN |
985 | |
986 | local-maintainer-clean: | |
987 | @echo "This command is intended for maintainers to use;" | |
988 | @echo "it deletes files that may require special tools to rebuild." | |
989 | ||
990 | clean: do-clean local-clean | |
991 | mostlyclean: do-mostlyclean local-clean | |
992 | distclean: do-distclean local-clean local-distclean | |
993 | maintainer-clean: local-maintainer-clean do-maintainer-clean local-clean | |
994 | maintainer-clean: local-distclean | |
995 | realclean: maintainer-clean | |
996 | ||
95ddd785 NN |
997 | # Check target. |
998 | ||
999 | .PHONY: check do-check | |
333a28b4 | 1000 | check: do-check |
95ddd785 | 1001 | |
4977bab6 | 1002 | # Only include modules actually being configured and built. |
1061f99e PB |
1003 | .PHONY: check-host |
1004 | check-host: [+ | |
7e2dbcef NN |
1005 | FOR host_modules +] \ |
1006 | maybe-check-[+module+][+ | |
1061f99e PB |
1007 | ENDFOR host_modules +] |
1008 | ||
1009 | .PHONY: check-target | |
1010 | check-target: [+ | |
7e2dbcef NN |
1011 | FOR target_modules +] \ |
1012 | maybe-check-target-[+module+][+ | |
1061f99e PB |
1013 | ENDFOR target_modules +] |
1014 | ||
1015 | do-check: | |
f41d6665 | 1016 | @: $(MAKE); $(unstage) |
e7c84bf8 PB |
1017 | @r=`${PWD_COMMAND}`; export r; \ |
1018 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1019 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) check-host check-target | |
95ddd785 NN |
1020 | |
1021 | # Automated reporting of test results. | |
1022 | ||
1023 | warning.log: build.log | |
1024 | $(srcdir)/contrib/warn_summary build.log > $@ | |
1025 | ||
1026 | mail-report.log: | |
1027 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
1028 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
1029 | fi; \ | |
1030 | $(srcdir)/contrib/test_summary -t >$@ | |
1031 | chmod +x $@ | |
1032 | echo If you really want to send e-mail, run ./$@ now | |
1033 | ||
1034 | mail-report-with-warnings.log: warning.log | |
1035 | if test x'$(BOOT_CFLAGS)' != x''; then \ | |
1036 | BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \ | |
1037 | fi; \ | |
1038 | $(srcdir)/contrib/test_summary -t -i warning.log >$@ | |
1039 | chmod +x $@ | |
1040 | echo If you really want to send e-mail, run ./$@ now | |
1041 | ||
c3e1e693 YG |
1042 | # Local Vim config |
1043 | ||
1044 | $(srcdir)/.local.vimrc: | |
ec523909 | 1045 | $(LN_S) contrib/vimrc $@ |
c3e1e693 YG |
1046 | |
1047 | $(srcdir)/.lvimrc: | |
ec523909 | 1048 | $(LN_S) contrib/vimrc $@ |
c3e1e693 YG |
1049 | |
1050 | vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc | |
1051 | ||
1052 | .PHONY: vimrc | |
1053 | ||
daa53f38 ML |
1054 | # clang-format config |
1055 | ||
1056 | $(srcdir)/.clang-format: | |
1057 | $(LN_S) contrib/clang-format $@ | |
1058 | ||
1059 | clang-format: $(srcdir)/.clang-format | |
1060 | ||
1061 | .PHONY: clang-format | |
1062 | ||
95ddd785 NN |
1063 | # Installation targets. |
1064 | ||
4977bab6 | 1065 | .PHONY: install uninstall |
1061f99e | 1066 | install: |
f41d6665 | 1067 | @: $(MAKE); $(unstage) |
e7c84bf8 PB |
1068 | @r=`${PWD_COMMAND}`; export r; \ |
1069 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1070 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-host install-target | |
8b87bb96 | 1071 | |
7e2dbcef NN |
1072 | .PHONY: install-host-nogcc |
1073 | install-host-nogcc: [+ | |
3589b69e PB |
1074 | FOR host_modules +][+ IF (not (= (get "module") "gcc")) +] \ |
1075 | maybe-install-[+module+][+ ENDIF +][+ | |
7e2dbcef NN |
1076 | ENDFOR host_modules +] |
1077 | ||
8b87bb96 | 1078 | .PHONY: install-host |
d32ab992 | 1079 | install-host: [+ |
8b87bb96 NN |
1080 | FOR host_modules +] \ |
1081 | maybe-install-[+module+][+ | |
1082 | ENDFOR host_modules +] | |
7e2dbcef | 1083 | |
8b87bb96 NN |
1084 | .PHONY: install-target |
1085 | install-target: [+ | |
1086 | FOR target_modules +] \ | |
1087 | maybe-install-target-[+module+][+ | |
1088 | ENDFOR target_modules +] | |
95ddd785 NN |
1089 | |
1090 | uninstall: | |
1091 | @echo "the uninstall target is not supported in this tree" | |
1092 | ||
95ddd785 NN |
1093 | .PHONY: install.all |
1094 | install.all: install-no-fixedincludes | |
fafb95a6 BRF |
1095 | @if [ -f ./gcc/Makefile ]; then \ |
1096 | r=`${PWD_COMMAND}`; export r; \ | |
f41d6665 | 1097 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
a52a0a7f | 1098 | $(HOST_EXPORTS) \ |
88b5521b | 1099 | (cd ./gcc && \ |
fafb95a6 | 1100 | $(MAKE) $(FLAGS_TO_PASS) install-headers); \ |
95ddd785 | 1101 | else \ |
fafb95a6 | 1102 | true; \ |
95ddd785 NN |
1103 | fi |
1104 | ||
8294b6fe OH |
1105 | # install-no-fixedincludes is used to allow the elaboration of binary packages |
1106 | # suitable for distribution, where we cannot include the fixed system header | |
1107 | # files. | |
95ddd785 | 1108 | .PHONY: install-no-fixedincludes |
7e2dbcef | 1109 | install-no-fixedincludes: installdirs install-host-nogcc \ |
8294b6fe | 1110 | install-target gcc-install-no-fixedincludes |
95ddd785 | 1111 | |
455c8f48 RW |
1112 | .PHONY: install-strip |
1113 | install-strip: | |
1114 | @: $(MAKE); $(unstage) | |
1115 | @r=`${PWD_COMMAND}`; export r; \ | |
1116 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1117 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) installdirs install-strip-host install-strip-target | |
1118 | ||
1119 | .PHONY: install-strip-host | |
1120 | install-strip-host: [+ | |
1121 | FOR host_modules +] \ | |
1122 | maybe-install-strip-[+module+][+ | |
1123 | ENDFOR host_modules +] | |
1124 | ||
1125 | .PHONY: install-strip-target | |
1126 | install-strip-target: [+ | |
1127 | FOR target_modules +] \ | |
1128 | maybe-install-strip-target-[+module+][+ | |
1129 | ENDFOR target_modules +] | |
1130 | ||
1131 | ||
4977bab6 | 1132 | ### other supporting targets |
95ddd785 | 1133 | |
4977bab6 ZW |
1134 | MAKEDIRS= \ |
1135 | $(DESTDIR)$(prefix) \ | |
1136 | $(DESTDIR)$(exec_prefix) | |
1137 | .PHONY: installdirs | |
1138 | installdirs: mkinstalldirs | |
1139 | $(SHELL) $(srcdir)/mkinstalldirs $(MAKEDIRS) | |
1140 | ||
1141 | dir.info: do-install-info | |
fafb95a6 BRF |
1142 | if [ -f $(srcdir)/texinfo/gen-info-dir ]; then \ |
1143 | $(srcdir)/texinfo/gen-info-dir $(DESTDIR)$(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new; \ | |
1144 | mv -f dir.info.new dir.info; \ | |
1145 | else true; \ | |
95ddd785 NN |
1146 | fi |
1147 | ||
4977bab6 ZW |
1148 | dist: |
1149 | @echo "Building a full distribution of this tree isn't done" | |
1150 | @echo "via 'make dist'. Check out the etc/ subdirectory" | |
1151 | ||
1152 | etags tags: TAGS | |
1153 | ||
1154 | # Right now this just builds TAGS in each subdirectory. emacs19 has the | |
1155 | # ability to use several tags files at once, so there is probably no need | |
1156 | # to combine them into one big TAGS file (like CVS 1.3 does). We could | |
1157 | # (if we felt like it) have this Makefile write a piece of elisp which | |
1158 | # the user could load to tell emacs19 where all the TAGS files we just | |
1159 | # built are. | |
1160 | TAGS: do-TAGS | |
1161 | ||
25b42232 PB |
1162 | # ------------------------------------ |
1163 | # Macros for configure and all targets | |
1164 | # ------------------------------------ | |
1165 | ||
1166 | [+ DEFINE configure +] | |
1167 | .PHONY: configure-[+prefix+][+module+] maybe-configure-[+prefix+][+module+] | |
1168 | maybe-configure-[+prefix+][+module+]: | |
3ff3adad PB |
1169 | @if gcc-bootstrap |
1170 | configure-[+prefix+][+module+]: stage_current | |
1171 | @endif gcc-bootstrap | |
25b42232 PB |
1172 | @if [+prefix+][+module+] |
1173 | maybe-configure-[+prefix+][+module+]: configure-[+prefix+][+module+] | |
3ff3adad | 1174 | configure-[+prefix+][+module+]: [+ IF bootstrap +][+ ELSE +] |
cc11cc9b PB |
1175 | @: $(MAKE); $(unstage)[+ ENDIF bootstrap +] |
1176 | @r=`${PWD_COMMAND}`; export r; \ | |
f41d6665 | 1177 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
cc11cc9b PB |
1178 | [+ IF check_multilibs |
1179 | +]echo "Checking multilib configuration for [+module+]..."; \ | |
fafb95a6 BRF |
1180 | $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \ |
1181 | $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \ | |
f41d6665 DJ |
1182 | if test -r [+subdir+]/[+module+]/multilib.out; then \ |
1183 | if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \ | |
1184 | rm -f [+subdir+]/[+module+]/multilib.tmp; \ | |
1185 | else \ | |
1186 | rm -f [+subdir+]/[+module+]/Makefile; \ | |
1187 | mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ | |
1188 | fi; \ | |
1189 | else \ | |
1190 | mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ | |
cc11cc9b PB |
1191 | fi; \ |
1192 | [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ | |
fafb95a6 | 1193 | $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \ |
f61428ed | 1194 | [+exports+] [+extra_exports+] \ |
25b42232 PB |
1195 | echo Configuring in [+subdir+]/[+module+]; \ |
1196 | cd "[+subdir+]/[+module+]" || exit 1; \ | |
3aa83176 | 1197 | case $(srcdir) in \ |
215c351a | 1198 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ |
25b42232 | 1199 | *) topdir=`echo [+subdir+]/[+module+]/ | \ |
215c351a | 1200 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ |
3aa83176 | 1201 | esac; \ |
b6383ab8 | 1202 | module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \ |
25b42232 | 1203 | [+ IF no-config-site +]rm -f no-such-file || : ; \ |
b6383ab8 TS |
1204 | CONFIG_SITE=no-such-file [+ ENDIF +]$(SHELL) \ |
1205 | $$s/$$module_srcdir/configure \ | |
1206 | --srcdir=$${topdir}/$$module_srcdir \ | |
e69bf64b | 1207 | [+args+] --build=${build_alias} --host=[+host_alias+] \ |
b6383ab8 | 1208 | --target=[+target_alias+] [+extra_configure_flags+] \ |
3aa83176 | 1209 | || exit 1 |
25b42232 | 1210 | @endif [+prefix+][+module+] |
ce406537 PB |
1211 | |
1212 | [+ IF bootstrap +] | |
1213 | [+ FOR bootstrap_stage +] | |
1214 | .PHONY: configure-stage[+id+]-[+prefix+][+module+] maybe-configure-stage[+id+]-[+prefix+][+module+] | |
1215 | maybe-configure-stage[+id+]-[+prefix+][+module+]: | |
f41d6665 | 1216 | @if [+prefix+][+module+]-bootstrap |
ce406537 | 1217 | maybe-configure-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] |
f41d6665 | 1218 | configure-stage[+id+]-[+prefix+][+module+]: |
cc11cc9b | 1219 | @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start |
f41d6665 | 1220 | @$(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+] |
cc11cc9b | 1221 | @r=`${PWD_COMMAND}`; export r; \ |
ce406537 | 1222 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
4a4a4e99 | 1223 | TFLAGS="$(STAGE[+id+]_TFLAGS)"; \ |
cc11cc9b PB |
1224 | [+ IF check_multilibs |
1225 | +]echo "Checking multilib configuration for [+module+]..."; \ | |
fafb95a6 | 1226 | $(CC_FOR_TARGET) --print-multi-lib > [+subdir+]/[+module+]/multilib.tmp 2> /dev/null; \ |
f41d6665 DJ |
1227 | if test -r [+subdir+]/[+module+]/multilib.out; then \ |
1228 | if cmp -s [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; then \ | |
1229 | rm -f [+subdir+]/[+module+]/multilib.tmp; \ | |
1230 | else \ | |
1231 | rm -f [+subdir+]/[+module+]/Makefile; \ | |
1232 | mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ | |
1233 | fi; \ | |
1234 | else \ | |
1235 | mv [+subdir+]/[+module+]/multilib.tmp [+subdir+]/[+module+]/multilib.out; \ | |
cc11cc9b PB |
1236 | fi; \ |
1237 | [+ ENDIF check_multilibs +]test ! -f [+subdir+]/[+module+]/Makefile || exit 0; \ | |
ce406537 | 1238 | [+exports+][+ IF prev +] \ |
4a4a4e99 AO |
1239 | [+poststage1_exports+][+ ENDIF prev +][+ IF prefix +] \ |
1240 | CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \ | |
1241 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \ | |
1242 | LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"; export LIBCFLAGS;[+ ELSE prefix +] \ | |
1243 | CFLAGS="$(STAGE[+id+]_CFLAGS)"; export CFLAGS; \ | |
f61428ed | 1244 | CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"; export CXXFLAGS;[+ IF prev +] \ |
4a4a4e99 | 1245 | LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \ |
f61428ed AO |
1246 | LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +]; export LIBCFLAGS;[+ |
1247 | ENDIF prefix +] [+extra_exports+] \ | |
fafb95a6 BRF |
1248 | echo Configuring stage [+id+] in [+subdir+]/[+module+]; \ |
1249 | $(SHELL) $(srcdir)/mkinstalldirs [+subdir+]/[+module+]; \ | |
ce406537 PB |
1250 | cd [+subdir+]/[+module+] || exit 1; \ |
1251 | case $(srcdir) in \ | |
1252 | /* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \ | |
1253 | *) topdir=`echo [+subdir+]/[+module+]/ | \ | |
1254 | sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \ | |
1255 | esac; \ | |
b6383ab8 TS |
1256 | module_srcdir=[+? module_srcdir (get "module_srcdir") (get "module")+]; \ |
1257 | $(SHELL) $$s/$$module_srcdir/configure \ | |
1258 | --srcdir=$${topdir}/$$module_srcdir \ | |
e69bf64b | 1259 | [+args+] --build=${build_alias} --host=[+host_alias+] \ |
b6383ab8 | 1260 | --target=[+target_alias+] \ |
fafb95a6 | 1261 | [+ IF prev +]--with-build-libsubdir=$(HOST_SUBDIR)[+ ENDIF prev +] \ |
4a4a4e99 AO |
1262 | $(STAGE[+id+]_CONFIGURE_FLAGS)[+ IF extra_configure_flags +] \ |
1263 | [+extra_configure_flags+][+ ENDIF extra_configure_flags +] | |
f41d6665 | 1264 | @endif [+prefix+][+module+]-bootstrap |
ce406537 PB |
1265 | [+ ENDFOR bootstrap_stage +] |
1266 | [+ ENDIF bootstrap +] | |
25b42232 PB |
1267 | [+ ENDDEF +] |
1268 | ||
1269 | [+ DEFINE all +] | |
1270 | .PHONY: all-[+prefix+][+module+] maybe-all-[+prefix+][+module+] | |
1271 | maybe-all-[+prefix+][+module+]: | |
3ff3adad PB |
1272 | @if gcc-bootstrap |
1273 | all-[+prefix+][+module+]: stage_current | |
1274 | @endif gcc-bootstrap | |
25b42232 PB |
1275 | @if [+prefix+][+module+] |
1276 | TARGET-[+prefix+][+module+]=[+ | |
e69bf64b | 1277 | IF all_target +][+all_target+][+ ELSE +]all[+ ENDIF all_target +] |
25b42232 | 1278 | maybe-all-[+prefix+][+module+]: all-[+prefix+][+module+] |
3ff3adad | 1279 | all-[+prefix+][+module+]: configure-[+prefix+][+module+][+ IF bootstrap +][+ ELSE +] |
cc11cc9b PB |
1280 | @: $(MAKE); $(unstage)[+ ENDIF bootstrap +] |
1281 | @r=`${PWD_COMMAND}`; export r; \ | |
8c90b13a | 1282 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
f61428ed | 1283 | [+exports+] [+extra_exports+] \ |
25b42232 | 1284 | (cd [+subdir+]/[+module+] && \ |
0b21f5d3 | 1285 | $(MAKE) $(BASE_FLAGS_TO_PASS) [+args+] [+stage1_args+] [+extra_make_flags+] \ |
1c8bd6a3 | 1286 | $(TARGET-[+prefix+][+module+])) |
25b42232 | 1287 | @endif [+prefix+][+module+] |
ce406537 PB |
1288 | |
1289 | [+ IF bootstrap +] | |
1290 | [+ FOR bootstrap_stage +] | |
1291 | .PHONY: all-stage[+id+]-[+prefix+][+module+] maybe-all-stage[+id+]-[+prefix+][+module+] | |
1292 | .PHONY: clean-stage[+id+]-[+prefix+][+module+] maybe-clean-stage[+id+]-[+prefix+][+module+] | |
1293 | maybe-all-stage[+id+]-[+prefix+][+module+]: | |
1294 | maybe-clean-stage[+id+]-[+prefix+][+module+]: | |
f41d6665 | 1295 | @if [+prefix+][+module+]-bootstrap |
ce406537 PB |
1296 | maybe-all-stage[+id+]-[+prefix+][+module+]: all-stage[+id+]-[+prefix+][+module+] |
1297 | all-stage[+id+]: all-stage[+id+]-[+prefix+][+module+] | |
1061f99e | 1298 | TARGET-stage[+id+]-[+prefix+][+module+] = $(TARGET-[+prefix+][+module+]) |
ce406537 | 1299 | all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+] |
cc11cc9b | 1300 | @[ $(current_stage) = stage[+id+] ] || $(MAKE) stage[+id+]-start |
ce406537 PB |
1301 | @r=`${PWD_COMMAND}`; export r; \ |
1302 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4a4a4e99 | 1303 | TFLAGS="$(STAGE[+id+]_TFLAGS)"; \ |
ce406537 | 1304 | [+exports+][+ IF prev +] \ |
f61428ed | 1305 | [+poststage1_exports+][+ ENDIF prev +] [+extra_exports+] \ |
ce406537 | 1306 | cd [+subdir+]/[+module+] && \ |
277d7ee0 | 1307 | [+autoprofile+] \ |
4a4a4e99 AO |
1308 | $(MAKE) $(BASE_FLAGS_TO_PASS)[+ IF prefix +] \ |
1309 | CFLAGS="$(CFLAGS_FOR_TARGET)" \ | |
1310 | CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \ | |
1311 | LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \ | |
1312 | CFLAGS="$(STAGE[+id+]_CFLAGS)" \ | |
1c67e69c | 1313 | GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \ |
f61428ed | 1314 | CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \ |
4a4a4e99 AO |
1315 | LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \ |
1316 | LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \ | |
1317 | CFLAGS_FOR_TARGET="$(CFLAGS_FOR_TARGET)" \ | |
1318 | CXXFLAGS_FOR_TARGET="$(CXXFLAGS_FOR_TARGET)" \ | |
1319 | LIBCFLAGS_FOR_TARGET="$(LIBCFLAGS_FOR_TARGET)" \ | |
0b21f5d3 EB |
1320 | [+args+] [+IF prev +][+poststage1_args+][+ ELSE prev +] \ |
1321 | [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] \ | |
277d7ee0 | 1322 | TFLAGS="$(STAGE[+id+]_TFLAGS)" [+profile_data+] \ |
1061f99e | 1323 | $(TARGET-stage[+id+]-[+prefix+][+module+]) |
ce406537 PB |
1324 | |
1325 | maybe-clean-stage[+id+]-[+prefix+][+module+]: clean-stage[+id+]-[+prefix+][+module+] | |
1326 | clean-stage[+id+]: clean-stage[+id+]-[+prefix+][+module+] | |
1327 | clean-stage[+id+]-[+prefix+][+module+]: | |
995a5697 PB |
1328 | @if [ $(current_stage) = stage[+id+] ]; then \ |
1329 | [ -f [+subdir+]/[+module+]/Makefile ] || exit 0; \ | |
1330 | else \ | |
1331 | [ -f [+subdir+]/stage[+id+]-[+module+]/Makefile ] || exit 0; \ | |
1332 | $(MAKE) stage[+id+]-start; \ | |
1333 | fi; \ | |
ce406537 | 1334 | cd [+subdir+]/[+module+] && \ |
0b21f5d3 EB |
1335 | $(MAKE) [+args+] [+ IF prev +][+poststage1_args+][+ ELSE prev +] \ |
1336 | [+stage1_args+][+ ENDIF prev +] [+extra_make_flags+] clean | |
f41d6665 | 1337 | @endif [+prefix+][+module+]-bootstrap |
ce406537 PB |
1338 | |
1339 | [+ ENDFOR bootstrap_stage +] | |
1340 | [+ ENDIF bootstrap +] | |
25b42232 PB |
1341 | [+ ENDDEF +] |
1342 | ||
1343 | # -------------------------------------- | |
1344 | # Modules which run on the build machine | |
1345 | # -------------------------------------- | |
1346 | [+ FOR build_modules +] | |
1347 | [+ configure prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" | |
e69bf64b PB |
1348 | host_alias=(get "host" "${build_alias}") |
1349 | target_alias=(get "target" "${target_alias}") | |
25b42232 PB |
1350 | args="$(BUILD_CONFIGARGS)" no-config-site=true +] |
1351 | ||
f8c33439 JM |
1352 | [+ all prefix="build-" subdir="$(BUILD_SUBDIR)" exports="$(BUILD_EXPORTS)" |
1353 | args="$(EXTRA_BUILD_FLAGS)" +] | |
25b42232 | 1354 | [+ ENDFOR build_module +] |
4977bab6 ZW |
1355 | |
1356 | # -------------------------------------- | |
1357 | # Modules which run on the host machine | |
1358 | # -------------------------------------- | |
1359 | [+ FOR host_modules +] | |
ce406537 PB |
1360 | [+ configure prefix="" subdir="$(HOST_SUBDIR)" |
1361 | exports="$(HOST_EXPORTS)" | |
1362 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
e69bf64b PB |
1363 | host_alias=(get "host" "${host_alias}") |
1364 | target_alias=(get "target" "${target_alias}") | |
25b42232 | 1365 | args="$(HOST_CONFIGARGS)" +] |
95ddd785 | 1366 | |
ce406537 PB |
1367 | [+ all prefix="" subdir="$(HOST_SUBDIR)" |
1368 | exports="$(HOST_EXPORTS)" | |
1369 | poststage1_exports="$(POSTSTAGE1_HOST_EXPORTS)" | |
1c8bd6a3 | 1370 | args="$(EXTRA_HOST_FLAGS)" |
0b21f5d3 | 1371 | stage1_args="$(STAGE1_FLAGS_TO_PASS)" |
ce406537 | 1372 | poststage1_args="$(POSTSTAGE1_FLAGS_TO_PASS)" +] |
4977bab6 | 1373 | |
7e2dbcef NN |
1374 | .PHONY: check-[+module+] maybe-check-[+module+] |
1375 | maybe-check-[+module+]: | |
60975492 PB |
1376 | @if [+module+] |
1377 | maybe-check-[+module+]: check-[+module+] | |
4977bab6 | 1378 | [+ IF no_check +] |
4977bab6 ZW |
1379 | check-[+module+]: |
1380 | [+ ELIF no_check_cross +] | |
4977bab6 ZW |
1381 | # This module is only tested in a native toolchain. |
1382 | check-[+module+]: | |
f41d6665 | 1383 | @: $(MAKE); $(unstage) |
fafb95a6 | 1384 | @if [ '$(host)' = '$(target)' ]; then \ |
8c90b13a L |
1385 | r=`${PWD_COMMAND}`; export r; \ |
1386 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
77019397 MO |
1387 | $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+ |
1388 | ENDIF bootstrap +] \ | |
215c351a | 1389 | (cd $(HOST_SUBDIR)/[+module+] && \ |
77019397 MO |
1390 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+ |
1391 | IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check) | |
3aa83176 NN |
1392 | fi |
1393 | [+ ELSE check +] | |
3aa83176 | 1394 | check-[+module+]: |
f41d6665 | 1395 | @: $(MAKE); $(unstage) |
8c90b13a L |
1396 | @r=`${PWD_COMMAND}`; export r; \ |
1397 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
77019397 MO |
1398 | $(HOST_EXPORTS) [+ IF bootstrap +]$(EXTRA_HOST_EXPORTS)[+ |
1399 | ENDIF bootstrap +] \ | |
215c351a | 1400 | (cd $(HOST_SUBDIR)/[+module+] && \ |
77019397 MO |
1401 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+][+ |
1402 | IF bootstrap +] $(EXTRA_BOOTSTRAP_FLAGS)[+ ENDIF bootstrap +] check) | |
4977bab6 | 1403 | [+ ENDIF no_check +] |
60975492 | 1404 | @endif [+module+] |
4977bab6 | 1405 | |
4977bab6 ZW |
1406 | .PHONY: install-[+module+] maybe-install-[+module+] |
1407 | maybe-install-[+module+]: | |
60975492 PB |
1408 | @if [+module+] |
1409 | maybe-install-[+module+]: install-[+module+] | |
7e2dbcef | 1410 | [+ IF no_install +] |
4977bab6 ZW |
1411 | install-[+module+]: |
1412 | [+ ELSE install +] | |
4977bab6 | 1413 | install-[+module+]: installdirs |
f41d6665 | 1414 | @: $(MAKE); $(unstage) |
8c90b13a L |
1415 | @r=`${PWD_COMMAND}`; export r; \ |
1416 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4fc4dd12 | 1417 | $(HOST_EXPORTS) \ |
215c351a | 1418 | (cd $(HOST_SUBDIR)/[+module+] && \ |
ace9ac7b | 1419 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install) |
4977bab6 | 1420 | [+ ENDIF no_install +] |
60975492 | 1421 | @endif [+module+] |
295f4e42 | 1422 | |
455c8f48 RW |
1423 | .PHONY: install-strip-[+module+] maybe-install-strip-[+module+] |
1424 | maybe-install-strip-[+module+]: | |
1425 | @if [+module+] | |
1426 | maybe-install-strip-[+module+]: install-strip-[+module+] | |
1427 | [+ IF no_install +] | |
1428 | install-strip-[+module+]: | |
1429 | [+ ELSE install +] | |
1430 | install-strip-[+module+]: installdirs | |
1431 | @: $(MAKE); $(unstage) | |
1432 | @r=`${PWD_COMMAND}`; export r; \ | |
1433 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1434 | $(HOST_EXPORTS) \ | |
1435 | (cd $(HOST_SUBDIR)/[+module+] && \ | |
1436 | $(MAKE) $(FLAGS_TO_PASS) [+extra_make_flags+] install-strip) | |
1437 | [+ ENDIF no_install +] | |
1438 | @endif [+module+] | |
1439 | ||
b5422ad7 | 1440 | # Other targets (info, dvi, pdf, etc.) |
295f4e42 NN |
1441 | [+ FOR recursive_targets +] |
1442 | .PHONY: maybe-[+make_target+]-[+module+] [+make_target+]-[+module+] | |
1443 | maybe-[+make_target+]-[+module+]: | |
60975492 PB |
1444 | @if [+module+] |
1445 | maybe-[+make_target+]-[+module+]: [+make_target+]-[+module+] | |
295f4e42 NN |
1446 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1447 | # [+module+] doesn't support [+make_target+]. | |
1448 | [+make_target+]-[+module+]: | |
1449 | [+ ELSE +] | |
1450 | [+make_target+]-[+module+]: [+ | |
1451 | FOR depend +]\ | |
1452 | [+depend+]-[+module+] [+ | |
1453 | ENDFOR depend +] | |
f41d6665 | 1454 | @[+ IF bootstrap +][+ ELSE +]: $(MAKE); $(unstage) |
1061f99e | 1455 | @[+ ENDIF bootstrap +][ -f ./[+module+]/Makefile ] || exit 0; \ |
295f4e42 NN |
1456 | r=`${PWD_COMMAND}`; export r; \ |
1457 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4fc4dd12 | 1458 | $(HOST_EXPORTS) \ |
d32ab992 | 1459 | for flag in $(EXTRA_HOST_FLAGS) [+extra_make_flags+]; do \ |
295f4e42 NN |
1460 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ |
1461 | done; \ | |
fafb95a6 | 1462 | echo "Doing [+make_target+] in [+module+]"; \ |
215c351a | 1463 | (cd $(HOST_SUBDIR)/[+module+] && \ |
295f4e42 NN |
1464 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ |
1465 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1466 | "RANLIB=$${RANLIB}" \ | |
901119ae | 1467 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ |
d32ab992 | 1468 | [+make_target+]) \ |
295f4e42 NN |
1469 | || exit 1 |
1470 | [+ ENDIF +] | |
60975492 | 1471 | @endif [+module+] |
295f4e42 | 1472 | [+ ENDFOR recursive_targets +] |
4977bab6 ZW |
1473 | [+ ENDFOR host_modules +] |
1474 | ||
1475 | # --------------------------------------- | |
1476 | # Modules which run on the target machine | |
1477 | # --------------------------------------- | |
1478 | [+ FOR target_modules +] | |
4977bab6 | 1479 | |
25b42232 PB |
1480 | [+ IF raw_cxx +] |
1481 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
f41d6665 | 1482 | check_multilibs=true |
25b42232 | 1483 | exports="$(RAW_CXX_TARGET_EXPORTS)" |
e69bf64b PB |
1484 | host_alias=(get "host" "${target_alias}") |
1485 | target_alias=(get "target" "${target_alias}") | |
25b42232 PB |
1486 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] |
1487 | ||
1488 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1489 | exports="$(RAW_CXX_TARGET_EXPORTS)" | |
1c8bd6a3 | 1490 | args="$(EXTRA_TARGET_FLAGS) 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)'" +] |
25b42232 PB |
1491 | [+ ELSE +] |
1492 | [+ configure prefix="target-" subdir="$(TARGET_SUBDIR)" | |
f41d6665 | 1493 | check_multilibs=true |
25b42232 | 1494 | exports="$(NORMAL_TARGET_EXPORTS)" |
e69bf64b PB |
1495 | host_alias=(get "host" "${target_alias}") |
1496 | target_alias=(get "target" "${target_alias}") | |
25b42232 PB |
1497 | args="$(TARGET_CONFIGARGS)" no-config-site=true +] |
1498 | ||
1499 | [+ all prefix="target-" subdir="$(TARGET_SUBDIR)" | |
1500 | exports="$(NORMAL_TARGET_EXPORTS)" | |
1c8bd6a3 | 1501 | args="$(EXTRA_TARGET_FLAGS)" +] |
25b42232 | 1502 | [+ ENDIF +] |
7e2dbcef NN |
1503 | |
1504 | .PHONY: check-target-[+module+] maybe-check-target-[+module+] | |
1505 | maybe-check-target-[+module+]: | |
60975492 PB |
1506 | @if target-[+module+] |
1507 | maybe-check-target-[+module+]: check-target-[+module+] | |
4977bab6 ZW |
1508 | [+ IF no_check +] |
1509 | # Dummy target for uncheckable module. | |
4977bab6 ZW |
1510 | check-target-[+module+]: |
1511 | [+ ELSE check +] | |
4977bab6 | 1512 | check-target-[+module+]: |
f41d6665 | 1513 | @: $(MAKE); $(unstage) |
8c90b13a | 1514 | @r=`${PWD_COMMAND}`; export r; \ |
0bff65e7 | 1515 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
4fc4dd12 DJ |
1516 | IF raw_cxx +] |
1517 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1518 | ELSE normal_cxx +] | |
1519 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1520 | ENDIF raw_cxx +] | |
3aa83176 NN |
1521 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
1522 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+ | |
1523 | IF raw_cxx | |
1524 | +] 'CXX=$$(RAW_CXX_FOR_TARGET)' 'CXX_FOR_TARGET=$$(RAW_CXX_FOR_TARGET)' [+ | |
1525 | ENDIF raw_cxx | |
a52a0a7f | 1526 | +] [+extra_make_flags+] check) |
4977bab6 | 1527 | [+ ENDIF no_check +] |
60975492 | 1528 | @endif target-[+module+] |
7e2dbcef | 1529 | |
4977bab6 ZW |
1530 | .PHONY: install-target-[+module+] maybe-install-target-[+module+] |
1531 | maybe-install-target-[+module+]: | |
60975492 PB |
1532 | @if target-[+module+] |
1533 | maybe-install-target-[+module+]: install-target-[+module+] | |
7e2dbcef | 1534 | [+ IF no_install +] |
4977bab6 ZW |
1535 | # Dummy target for uninstallable. |
1536 | install-target-[+module+]: | |
1537 | [+ ELSE install +] | |
4977bab6 | 1538 | install-target-[+module+]: installdirs |
f41d6665 | 1539 | @: $(MAKE); $(unstage) |
8c90b13a | 1540 | @r=`${PWD_COMMAND}`; export r; \ |
0bff65e7 | 1541 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
4fc4dd12 DJ |
1542 | IF raw_cxx +] |
1543 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1544 | ELSE normal_cxx +] | |
1545 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1546 | ENDIF raw_cxx +] | |
3aa83176 | 1547 | (cd $(TARGET_SUBDIR)/[+module+] && \ |
a52a0a7f | 1548 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install) |
4977bab6 | 1549 | [+ ENDIF no_install +] |
60975492 | 1550 | @endif target-[+module+] |
295f4e42 | 1551 | |
455c8f48 RW |
1552 | .PHONY: install-strip-target-[+module+] maybe-install-strip-target-[+module+] |
1553 | maybe-install-strip-target-[+module+]: | |
1554 | @if target-[+module+] | |
1555 | maybe-install-strip-target-[+module+]: install-strip-target-[+module+] | |
1556 | [+ IF no_install +] | |
1557 | # Dummy target for uninstallable. | |
1558 | install-strip-target-[+module+]: | |
1559 | [+ ELSE install +] | |
1560 | install-strip-target-[+module+]: installdirs | |
1561 | @: $(MAKE); $(unstage) | |
1562 | @r=`${PWD_COMMAND}`; export r; \ | |
1563 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ | |
1564 | IF raw_cxx +] | |
1565 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1566 | ELSE normal_cxx +] | |
1567 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1568 | ENDIF raw_cxx +] | |
1569 | (cd $(TARGET_SUBDIR)/[+module+] && \ | |
1570 | $(MAKE) $(TARGET_FLAGS_TO_PASS) [+extra_make_flags+] install-strip) | |
1571 | [+ ENDIF no_install +] | |
1572 | @endif target-[+module+] | |
1573 | ||
b5422ad7 | 1574 | # Other targets (info, dvi, pdf, etc.) |
295f4e42 NN |
1575 | [+ FOR recursive_targets +] |
1576 | .PHONY: maybe-[+make_target+]-target-[+module+] [+make_target+]-target-[+module+] | |
1577 | maybe-[+make_target+]-target-[+module+]: | |
60975492 PB |
1578 | @if target-[+module+] |
1579 | maybe-[+make_target+]-target-[+module+]: [+make_target+]-target-[+module+] | |
295f4e42 NN |
1580 | [+ IF (match-value? = "missing" (get "make_target") ) +] |
1581 | # [+module+] doesn't support [+make_target+]. | |
1582 | [+make_target+]-target-[+module+]: | |
1583 | [+ ELSE +] | |
1584 | [+make_target+]-target-[+module+]: [+ | |
1585 | FOR depend +]\ | |
1586 | [+depend+]-target-[+module+] [+ | |
1587 | ENDFOR depend +] | |
f41d6665 | 1588 | @: $(MAKE); $(unstage) |
fafb95a6 | 1589 | @[ -f $(TARGET_SUBDIR)/[+module+]/Makefile ] || exit 0; \ |
295f4e42 | 1590 | r=`${PWD_COMMAND}`; export r; \ |
0bff65e7 | 1591 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \[+ |
4fc4dd12 DJ |
1592 | IF raw_cxx +] |
1593 | $(RAW_CXX_TARGET_EXPORTS) \[+ | |
1594 | ELSE normal_cxx +] | |
1595 | $(NORMAL_TARGET_EXPORTS) \[+ | |
1596 | ENDIF raw_cxx +] | |
fafb95a6 | 1597 | echo "Doing [+make_target+] in $(TARGET_SUBDIR)/[+module+]"; \ |
295f4e42 NN |
1598 | for flag in $(EXTRA_TARGET_FLAGS); do \ |
1599 | eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \ | |
1600 | done; \ | |
1601 | (cd $(TARGET_SUBDIR)/[+module+] && \ | |
1602 | $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \ | |
1603 | "CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \ | |
1604 | "RANLIB=$${RANLIB}" \ | |
901119ae | 1605 | "DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \ |
a52a0a7f | 1606 | [+extra_make_flags+] [+make_target+]) \ |
295f4e42 NN |
1607 | || exit 1 |
1608 | [+ ENDIF +] | |
60975492 | 1609 | @endif target-[+module+] |
295f4e42 | 1610 | [+ ENDFOR recursive_targets +] |
4977bab6 | 1611 | [+ ENDFOR target_modules +] |
95ddd785 | 1612 | |
056d8580 JM |
1613 | @if target-libgomp |
1614 | .PHONY: check-target-libgomp-c++ | |
1615 | check-target-libgomp-c++: | |
1616 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libgomp | |
1617 | ||
9e03592e EB |
1618 | .PHONY: check-target-libgomp-fortran |
1619 | check-target-libgomp-fortran: | |
1620 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) fortran.exp" check-target-libgomp | |
1621 | ||
056d8580 JM |
1622 | @endif target-libgomp |
1623 | ||
1624 | @if target-libitm | |
1625 | .PHONY: check-target-libitm-c++ | |
1626 | check-target-libitm-c++: | |
1627 | $(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) c++.exp" check-target-libitm | |
1628 | ||
1629 | @endif target-libitm | |
1630 | ||
4977bab6 ZW |
1631 | # ---------- |
1632 | # GCC module | |
1633 | # ---------- | |
95ddd785 | 1634 | |
f516a7da | 1635 | @if gcc-no-bootstrap |
95ddd785 | 1636 | .PHONY: cross |
7c27e184 | 1637 | cross: all-build all-gas all-ld |
8c90b13a L |
1638 | @r=`${PWD_COMMAND}`; export r; \ |
1639 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
a52a0a7f | 1640 | $(HOST_EXPORTS) \ |
95ddd785 NN |
1641 | echo "Building the C and C++ compiler"; \ |
1642 | cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" | |
8c90b13a | 1643 | @r=`${PWD_COMMAND}`; export r; \ |
fafb95a6 | 1644 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
95ddd785 | 1645 | echo "Building runtime libraries"; \ |
ad6717df | 1646 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) LANGUAGES="c c++" all |
f516a7da | 1647 | @endif gcc-no-bootstrap |
95ddd785 | 1648 | |
60975492 | 1649 | @if gcc |
56ca59a0 LH |
1650 | |
1651 | .PHONY: gcc-site.exp | |
1652 | gcc-site.exp: | |
1653 | r=`${PWD_COMMAND}`; export r; \ | |
1654 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1655 | $(HOST_EXPORTS) \ | |
1656 | (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) site.exp); | |
1657 | ||
60911f14 SE |
1658 | [+ FOR languages +] |
1659 | .PHONY: check-gcc-[+language+] check-[+language+] | |
56ca59a0 | 1660 | check-gcc-[+language+]: gcc-site.exp |
60911f14 SE |
1661 | r=`${PWD_COMMAND}`; export r; \ |
1662 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1663 | $(HOST_EXPORTS) \ | |
1664 | (cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) [+gcc-check-target+]); | |
1ec601bf | 1665 | check-[+language+]: check-gcc-[+language+][+ FOR lib-check-target +] [+ lib-check-target +][+ ENDFOR lib-check-target +] |
60911f14 | 1666 | [+ ENDFOR languages +] |
95ddd785 | 1667 | |
8294b6fe OH |
1668 | # The gcc part of install-no-fixedincludes, which relies on an intimate |
1669 | # knowledge of how a number of gcc internal targets (inter)operate. Delegate. | |
1670 | .PHONY: gcc-install-no-fixedincludes | |
1671 | gcc-install-no-fixedincludes: | |
4977bab6 | 1672 | @if [ -f ./gcc/Makefile ]; then \ |
8c90b13a | 1673 | r=`${PWD_COMMAND}`; export r; \ |
8294b6fe | 1674 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ |
a52a0a7f | 1675 | $(HOST_EXPORTS) \ |
8294b6fe OH |
1676 | (cd ./gcc \ |
1677 | && $(MAKE) $(GCC_FLAGS_TO_PASS) install-no-fixedincludes); \ | |
4977bab6 | 1678 | else true; fi |
60975492 | 1679 | @endif gcc |
295f4e42 | 1680 | |
2805b53a NN |
1681 | # --------------------- |
1682 | # GCC bootstrap support | |
1683 | # --------------------- | |
1684 | ||
d32ab992 PB |
1685 | # We track the current stage (the one in 'gcc') in the stage_current file. |
1686 | # stage_last instead tracks the stage that was built last. These targets | |
1687 | # are dummy when toplevel bootstrap is not active. | |
1688 | ||
1061f99e | 1689 | # While making host and target tools, symlinks to the final stage must be |
f41d6665 DJ |
1690 | # there, so $(unstage) should be run at various points. To avoid excessive |
1691 | # recursive invocations of make, we "inline" them using a variable. These | |
1692 | # must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)" | |
1693 | # to avoid warnings from the GNU Make job server. | |
1061f99e PB |
1694 | |
1695 | unstage = : | |
1696 | stage = : | |
cc11cc9b | 1697 | current_stage = "" |
1061f99e | 1698 | |
d32ab992 | 1699 | @if gcc-bootstrap |
9bd6112c | 1700 | unstage = if [ -f stage_last ]; then [ -f stage_current ] || $(MAKE) `cat stage_last`-start || exit 1; else :; fi |
d19bca38 | 1701 | stage = if [ -f stage_current ]; then $(MAKE) `cat stage_current`-end || exit 1; else :; fi |
cc11cc9b | 1702 | current_stage = "`cat stage_current 2> /dev/null`" |
d32ab992 PB |
1703 | @endif gcc-bootstrap |
1704 | ||
1061f99e PB |
1705 | .PHONY: unstage stage |
1706 | unstage: | |
f41d6665 | 1707 | @: $(MAKE); $(unstage) |
d32ab992 | 1708 | stage: |
f41d6665 | 1709 | @: $(MAKE); $(stage) |
d32ab992 | 1710 | |
2d309510 PB |
1711 | # Disable commands for lean bootstrap. |
1712 | LEAN = false | |
1713 | ||
148907ea PB |
1714 | # We name the build directories for the various stages "stage1-gcc", |
1715 | # "stage2-gcc","stage3-gcc", etc. | |
1716 | ||
1717 | # Since the 'compare' process will fail (on debugging information) if any | |
1718 | # directory names are different, we need to link the gcc directory for | |
f41d6665 | 1719 | # the previous stage to a constant name ('prev-gcc'), and to make the name of |
148907ea PB |
1720 | # the build directories constant as well. For the latter, we use naked names |
1721 | # like 'gcc', because the scripts in that directory assume it. We use | |
1722 | # mv on platforms where symlinks to directories do not work or are not | |
1723 | # reliable. | |
1724 | ||
2805b53a NN |
1725 | # 'touch' doesn't work right on some platforms. |
1726 | STAMP = echo timestamp > | |
1727 | ||
148907ea PB |
1728 | # We only want to compare .o files, so set this! |
1729 | objext = .o | |
2805b53a | 1730 | |
148907ea | 1731 | [+ FOR bootstrap-stage +] |
f516a7da | 1732 | .PHONY: stage[+id+]-start stage[+id+]-end |
148907ea | 1733 | |
ad6717df | 1734 | stage[+id+]-start:: |
f41d6665 | 1735 | @: $(MAKE); $(stage); \ |
fafb95a6 | 1736 | echo stage[+id+] > stage_current; \ |
215c351a | 1737 | echo stage[+id+] > stage_last; \ |
f41d6665 | 1738 | $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)[+ |
215c351a | 1739 | FOR host_modules +][+ IF bootstrap +] |
7c27e184 | 1740 | @if [+ module +] |
215c351a PB |
1741 | @cd $(HOST_SUBDIR); [ -d stage[+id+]-[+module+] ] || \ |
1742 | mkdir stage[+id+]-[+module+]; \ | |
fafb95a6 | 1743 | mv stage[+id+]-[+module+] [+module+][+ IF prev +]; \ |
2d309510 | 1744 | mv stage[+prev+]-[+module+] prev-[+module+] || test -f stage[+prev+]-lean [+ ENDIF prev +] |
f41d6665 DJ |
1745 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +] |
1746 | @[ -d stage[+id+]-$(TARGET_SUBDIR) ] || \ | |
1747 | mkdir stage[+id+]-$(TARGET_SUBDIR); \ | |
fafb95a6 | 1748 | mv stage[+id+]-$(TARGET_SUBDIR) $(TARGET_SUBDIR)[+ IF prev +]; \ |
2d309510 | 1749 | mv stage[+prev+]-$(TARGET_SUBDIR) prev-$(TARGET_SUBDIR) || test -f stage[+prev+]-lean [+ ENDIF prev +] |
148907ea | 1750 | |
2d309510 | 1751 | stage[+id+]-end:: [+ FOR host_modules +][+ IF bootstrap +] |
7c27e184 | 1752 | @if [+ module +] |
fafb95a6 BRF |
1753 | @if test -d $(HOST_SUBDIR)/[+module+]; then \ |
1754 | cd $(HOST_SUBDIR); mv [+module+] stage[+id+]-[+module+][+ IF prev +]; \ | |
1755 | mv prev-[+module+] stage[+prev+]-[+module+]; : [+ ENDIF prev +]; \ | |
f41d6665 DJ |
1756 | fi |
1757 | @endif [+ module +][+ ENDIF bootstrap +][+ ENDFOR host_modules +] | |
fafb95a6 BRF |
1758 | @if test -d $(TARGET_SUBDIR); then \ |
1759 | mv $(TARGET_SUBDIR) stage[+id+]-$(TARGET_SUBDIR)[+ IF prev +]; \ | |
1760 | mv prev-$(TARGET_SUBDIR) stage[+prev+]-$(TARGET_SUBDIR); : [+ ENDIF prev +]; \ | |
f41d6665 | 1761 | fi |
2d309510 | 1762 | rm -f stage_current |
148907ea | 1763 | |
8024d75e | 1764 | # Bubble a bug fix through all the stages up to stage [+id+]. They are |
f41d6665 | 1765 | # remade, but not reconfigured. The next stage (if any) will not be |
cdce5c41 | 1766 | # reconfigured either. |
f516a7da | 1767 | .PHONY: stage[+id+]-bubble |
2d309510 | 1768 | stage[+id+]-bubble:: [+ IF prev +]stage[+prev+]-bubble[+ ENDIF +] |
e7c84bf8 PB |
1769 | @r=`${PWD_COMMAND}`; export r; \ |
1770 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1771 | if test -f stage[+id+]-lean [+ | |
fafb95a6 BRF |
1772 | IF prev +]|| test -f stage[+prev+]-lean [+ ENDIF prev +]; then \ |
1773 | echo Skipping rebuild of stage[+id+]; \ | |
ce521a9c | 1774 | else \ |
2d309510 PB |
1775 | $(MAKE) stage[+id+]-start; \[+IF lean +] |
1776 | if $(LEAN); then \ | |
fafb95a6 BRF |
1777 | rm -rf stage[+lean+]-*; \ |
1778 | $(STAMP) stage[+lean+]-lean; \ | |
2d309510 | 1779 | fi; \[+ ENDIF lean +] |
1061f99e | 1780 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage[+id+]; \ |
2abefe3d | 1781 | fi[+ IF compare-target +] |
d19bca38 | 1782 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) [+compare-target+][+ ENDIF compare-target +] |
7c27e184 | 1783 | |
45f366ab | 1784 | .PHONY: all-stage[+id+] clean-stage[+id+] |
45f366ab | 1785 | do-clean: clean-stage[+id+] |
2805b53a | 1786 | |
7c27e184 PB |
1787 | # FIXME: Will not need to be conditional when toplevel bootstrap is the |
1788 | # only possibility, but now it conflicts with no-bootstrap rules | |
1789 | @if gcc-bootstrap | |
148907ea | 1790 | [+ IF compare-target +] |
ce521a9c | 1791 | [+compare-target+]: |
e7c84bf8 PB |
1792 | @r=`${PWD_COMMAND}`; export r; \ |
1793 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1794 | if test -f stage[+prev+]-lean; then \ | |
fafb95a6 BRF |
1795 | echo Cannot compare object files as stage [+prev+] was deleted.; \ |
1796 | exit 0; \ | |
ce521a9c | 1797 | fi; \ |
f41d6665 | 1798 | : $(MAKE); $(stage); \ |
fafb95a6 BRF |
1799 | rm -f .bad_compare; \ |
1800 | echo Comparing stages [+prev+] and [+id+]; \ | |
70cb2d9f AO |
1801 | sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \ |
1802 | files=`find stage[+id+]-* -name "*$(objext)" -print | \ | |
fafb95a6 | 1803 | sed -n s,^stage$$sed-,,p`; \ |
5fe6af6d | 1804 | for file in $${files} ${extra-compare}; do \ |
70cb2d9f AO |
1805 | f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \ |
1806 | if test ! -f $$f1; then continue; fi; \ | |
bb286d71 | 1807 | $(do-[+compare-target+]) > /dev/null 2>&1; \ |
1061f99e PB |
1808 | if test $$? -eq 1; then \ |
1809 | case $$file in \ | |
f2689b09 | 1810 | @compare_exclusions@) \ |
1061f99e PB |
1811 | echo warning: $$file differs ;; \ |
1812 | *) \ | |
1813 | echo $$file differs >> .bad_compare ;; \ | |
fafb95a6 BRF |
1814 | esac; \ |
1815 | fi; \ | |
1816 | done; \ | |
2805b53a NN |
1817 | if [ -f .bad_compare ]; then \ |
1818 | echo "Bootstrap comparison failure!"; \ | |
1819 | cat .bad_compare; \ | |
1820 | exit 1; \ | |
1821 | else \ | |
cc11cc9b | 1822 | echo Comparison successful.; \ |
fafb95a6 | 1823 | fi; \ |
ce521a9c | 1824 | $(STAMP) [+compare-target+][+ IF prev +] |
2d309510 PB |
1825 | if $(LEAN); then \ |
1826 | rm -rf stage[+prev+]-*; \ | |
1827 | $(STAMP) stage[+prev+]-lean; \ | |
1828 | fi[+ ENDIF prev +] | |
148907ea PB |
1829 | [+ ENDIF compare-target +] |
1830 | ||
1831 | [+ IF bootstrap-target +] | |
2d309510 | 1832 | .PHONY: [+bootstrap-target+] [+bootstrap-target+]-lean |
2abefe3d PB |
1833 | [+bootstrap-target+]: |
1834 | echo stage[+id+] > stage_final | |
1835 | @r=`${PWD_COMMAND}`; export r; \ | |
1836 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1837 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble | |
f41d6665 | 1838 | @: $(MAKE); $(unstage) |
2abefe3d PB |
1839 | @r=`${PWD_COMMAND}`; export r; \ |
1840 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4a4a4e99 | 1841 | TFLAGS="$(STAGE[+id+]_TFLAGS)"; \ |
2abefe3d | 1842 | $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target |
2d309510 PB |
1843 | |
1844 | [+bootstrap-target+]-lean: | |
1845 | echo stage[+id+] > stage_final | |
1846 | @r=`${PWD_COMMAND}`; export r; \ | |
1847 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1848 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) LEAN=: stage[+id+]-bubble | |
1849 | @: $(MAKE); $(unstage) | |
1850 | @r=`${PWD_COMMAND}`; export r; \ | |
1851 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4a4a4e99 | 1852 | TFLAGS="$(STAGE[+id+]_TFLAGS)"; \ |
2d309510 | 1853 | $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target |
148907ea PB |
1854 | [+ ENDIF bootstrap-target +] |
1855 | ||
45f366ab | 1856 | # Rules to wipe a stage and all the following ones, also used for cleanstrap |
ad6717df | 1857 | [+ IF prev +]distclean-stage[+prev+]:: distclean-stage[+id+] [+ ENDIF prev +] |
45f366ab | 1858 | .PHONY: distclean-stage[+id+] |
ad6717df | 1859 | distclean-stage[+id+]:: |
f41d6665 | 1860 | @: $(MAKE); $(stage) |
a19e8f64 | 1861 | @test "`cat stage_last`" != stage[+id+] || rm -f stage_last |
ce521a9c | 1862 | rm -rf stage[+id+]-* [+ |
148907ea | 1863 | IF compare-target +][+compare-target+] [+ ENDIF compare-target +] |
148907ea PB |
1864 | |
1865 | [+ IF cleanstrap-target +] | |
1866 | .PHONY: [+cleanstrap-target+] | |
a19e8f64 PB |
1867 | [+cleanstrap-target+]: do-distclean local-clean |
1868 | echo stage[+id+] > stage_final | |
1869 | @r=`${PWD_COMMAND}`; export r; \ | |
1870 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
1871 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage[+id+]-bubble | |
1872 | @: $(MAKE); $(unstage) | |
1873 | @r=`${PWD_COMMAND}`; export r; \ | |
1874 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
4a4a4e99 | 1875 | TFLAGS="$(STAGE[+id+]_TFLAGS)"; \ |
a19e8f64 | 1876 | $(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target |
148907ea | 1877 | [+ ENDIF cleanstrap-target +] |
7c27e184 | 1878 | @endif gcc-bootstrap |
148907ea PB |
1879 | |
1880 | [+ ENDFOR bootstrap-stage +] | |
ad6717df | 1881 | |
c7870f5d PB |
1882 | stageprofile-end:: |
1883 | $(MAKE) distclean-stagefeedback | |
ad6717df | 1884 | |
c7870f5d | 1885 | stagefeedback-start:: |
ad6717df PB |
1886 | @r=`${PWD_COMMAND}`; export r; \ |
1887 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
684f6008 ML |
1888 | for i in prev-*; do \ |
1889 | j=`echo $$i | sed s/^prev-//`; \ | |
c7870f5d | 1890 | cd $$r/$$i && \ |
fafb95a6 BRF |
1891 | { find . -type d | sort | sed 's,.*,$(SHELL) '"$$s"'/mkinstalldirs "../'$$j'/&",' | $(SHELL); } && \ |
1892 | { find . -name '*.*da' | sed 's,.*,$(LN) -f "&" "../'$$j'/&",' | $(SHELL); }; \ | |
c7870f5d | 1893 | done |
03a91701 | 1894 | |
45f366ab | 1895 | @if gcc-bootstrap |
45f366ab | 1896 | do-distclean: distclean-stage1 |
cc11cc9b PB |
1897 | |
1898 | # Provide a GCC build when we're building target libraries. This does | |
1899 | # not work as a dependency, just as the minimum necessary to avoid errors. | |
1900 | stage_last: | |
ee04b574 AS |
1901 | @r=`${PWD_COMMAND}`; export r; \ |
1902 | s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \ | |
cc11cc9b | 1903 | $(MAKE) $(RECURSE_FLAGS_TO_PASS) stage1-bubble |
45f366ab | 1904 | |
3ff3adad PB |
1905 | # Same as unstage, but not phony and defaulting to stage1-start. We place |
1906 | # it in the dependency so that for example `make -j3 all-gcc' works. | |
1907 | stage_current: | |
1908 | @if test -f stage_last; then $(unstage); else $(MAKE) stage1-start; fi | |
1909 | ||
cc11cc9b | 1910 | .PHONY: restrap |
c6b196de | 1911 | restrap:: |
cc11cc9b | 1912 | @: $(MAKE); $(stage) |
4a4a4e99 AO |
1913 | rm -rf stage1-$(TARGET_SUBDIR)[+ FOR bootstrap-stage +][+ IF prev |
1914 | +] stage[+id+]-*[+ ENDIF prev +][+ ENDFOR bootstrap-stage +] | |
c6b196de | 1915 | restrap:: all |
e9a54b07 | 1916 | @endif gcc-bootstrap |
cc11cc9b | 1917 | |
4977bab6 ZW |
1918 | # -------------------------------------- |
1919 | # Dependencies between different modules | |
1920 | # -------------------------------------- | |
1921 | ||
3589b69e | 1922 | # Generic dependencies for target modules on host stuff, especially gcc |
cc11cc9b PB |
1923 | @if gcc-bootstrap[+ FOR target_modules +][+ IF bootstrap |
1924 | +][+ FOR bootstrap_stage +] | |
1925 | configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-gcc[+ | |
1926 | ENDFOR +][+ ELSE bootstrap +] | |
1927 | configure-target-[+module+]: stage_last[+ | |
1928 | ENDIF bootstrap +][+ ENDFOR target_modules +] | |
1929 | @endif gcc-bootstrap | |
1930 | ||
fa958513 | 1931 | @if gcc-no-bootstrap[+ FOR target_modules +] |
cc11cc9b | 1932 | configure-target-[+module+]: maybe-all-gcc[+ |
fa958513 | 1933 | ENDFOR target_modules +] |
cc11cc9b PB |
1934 | @endif gcc-no-bootstrap |
1935 | ||
3589b69e | 1936 | |
4977bab6 ZW |
1937 | # There are two types of dependencies here: 'hard' dependencies, where one |
1938 | # module simply won't build without the other; and 'soft' dependencies, where | |
1939 | # if the depended-on module is missing, the depending module will do without | |
1940 | # or find a substitute somewhere (perhaps installed). Soft dependencies | |
3589b69e | 1941 | # are made here to depend on a 'maybe-' target. If you're not sure, |
4977bab6 ZW |
1942 | # it's safer to use a soft dependency. |
1943 | ||
3589b69e PB |
1944 | [+ ;; These Scheme functions build the bulk of the dependencies. |
1945 | ;; dep-target builds a string like "maybe-all-MODULE_KIND-gcc", | |
cdce5c41 | 1946 | ;; where "maybe-" is only included if HARD is not true, and all-gcc |
3589b69e PB |
1947 | ;; is taken from VAR-NAME. |
1948 | (define dep-target (lambda (module-kind var-name hard) | |
1949 | (string-append | |
1950 | (if hard "" "maybe-") | |
1951 | (dep-subtarget var-name) | |
1952 | module-kind | |
1953 | (dep-module var-name) | |
1954 | ))) | |
1955 | ||
1956 | ;; make-dep builds a dependency from the MODULE and ON AutoGen vars. | |
7c27e184 | 1957 | (define make-dep (lambda (module-kind on-kind) |
3589b69e PB |
1958 | (string-append |
1959 | (dep-target module-kind "module" #t) ": " | |
7c27e184 | 1960 | (dep-target on-kind "on" (exist? "hard"))))) |
3589b69e PB |
1961 | |
1962 | ;; dep-subtarget extracts everything up to the first dash in the given | |
1963 | ;; AutoGen variable, for example it extracts "all-" out of "all-gcc". | |
1964 | (define dep-subtarget (lambda (var-name) | |
1965 | (substring (get var-name) 0 (+ 1 (string-index (get var-name) #\-))))) | |
1966 | ||
1967 | ;; dep-module extracts everything up to the first dash in the given | |
1968 | ;; AutoGen variable, for example it extracts "gcc" out of "all-gcc". | |
1969 | (define dep-module (lambda (var-name) | |
1970 | (substring (get var-name) (+ 1 (string-index (get var-name) #\-))))) | |
1971 | ||
1972 | ;; dep-stage builds a string for the prefix of a bootstrap stage. | |
1973 | (define dep-stage (lambda () | |
1974 | (string-append | |
1975 | "stage" | |
1976 | (get "id") | |
1977 | "-"))) | |
1978 | ||
1979 | ;; dep-maybe is the same as the AutoGen expression "- hard 'maybe-'" | |
1980 | ;; but is written in Scheme. | |
1981 | (define dep-maybe (lambda () | |
1982 | (if (exist? "hard") "" "maybe-"))) | |
1983 | ||
94792057 | 1984 | ;; dep-kind returns "prebootstrap" for configure or build |
da34ca3f AO |
1985 | ;; dependencies of bootstrapped modules on a build module |
1986 | ;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is | |
1987 | ;; on an "install" target, or if the dependence module is not | |
1988 | ;; bootstrapped; otherwise, it returns "bootstrap" or | |
1989 | ;; "postbootstrap" depending on whether the dependent module is | |
1990 | ;; bootstrapped. All this is only necessary for host and target | |
1991 | ;; modules. It might seem like, in order to avoid build races, we | |
1992 | ;; might need more elaborate detection between prebootstrap and | |
1993 | ;; postbootstrap modules, but there are no host prebootstrap | |
1994 | ;; modules. If there were any non-bootstrap host modules that | |
1995 | ;; bootstrap modules depended on, we'd get unsatisfied per-stage | |
1996 | ;; dependencies on them, which would be immediately noticed. | |
3589b69e | 1997 | (define dep-kind (lambda () |
da34ca3f AO |
1998 | (cond |
1999 | ((and (hash-ref boot-modules (dep-module "module")) | |
2000 | (=* (dep-module "on") "build-")) | |
2001 | "prebootstrap") | |
3589b69e | 2002 | |
da34ca3f AO |
2003 | ((or (= (dep-subtarget "on") "install-") |
2004 | (not (hash-ref boot-modules (dep-module "on")))) | |
2005 | "normal") | |
2006 | ||
2007 | ((hash-ref boot-modules (dep-module "module")) | |
2008 | "bootstrap") | |
2009 | ||
2010 | (1 "postbootstrap")))) | |
2011 | ||
2012 | (define make-postboot-dep (lambda () | |
2013 | (let ((target (dep-module "module")) (dep "stage_last")) | |
2014 | (unless (= (hash-ref postboot-targets target) dep) | |
2015 | (hash-create-handle! postboot-targets target dep) | |
2016 | ;; All non-bootstrap modules' configure target already | |
2017 | ;; depend on dep. | |
2018 | (unless (=* target "target-") | |
2019 | (string-append "configure-" target ": " dep "\n")))))) | |
3589b69e | 2020 | |
9a5e4aad JJ |
2021 | ;; Dependencies in between target modules if the dependencies |
2022 | ;; are bootstrap target modules and the target modules which | |
2023 | ;; depend on them are emitted inside of @unless gcc-bootstrap. | |
2024 | ;; Unfortunately, some target modules like libatomic or libbacktrace | |
2025 | ;; have bootstrap flag set, but whether they are actually built | |
2026 | ;; during bootstrap or after bootstrap depends on e.g. enabled languages; | |
2027 | ;; if d is enabled, libphobos is built as target module and depends | |
2028 | ;; on libatomic and libbacktrace, which are therefore also built as | |
2029 | ;; bootstrap modules. If d is not enabled but go is, libatomic and | |
2030 | ;; libbacktrace are just dependencies of libgo which is not a bootstrap | |
2031 | ;; target module, but we need dependencies on libatomic and libbacktrace | |
2032 | ;; in that case even when gcc-bootstrap. This lambda emits those. | |
2033 | (define make-postboot-target-dep (lambda () | |
2034 | (let ((target (dep-module "module")) (on (dep-module "on"))) | |
2035 | (when (=* on "target-") | |
2036 | (when (=* target "target-") | |
2037 | (string-append "@unless " on "-bootstrap\n" (make-dep "" "") | |
2038 | "\n@endunless " on "-bootstrap\n")))))) | |
2039 | ||
3589b69e PB |
2040 | ;; We now build the hash table that is used by dep-kind. |
2041 | (define boot-modules (make-hash-table 113)) | |
da34ca3f | 2042 | (define postboot-targets (make-hash-table 113)) |
3589b69e PB |
2043 | +] |
2044 | ||
2045 | [+ FOR host_modules +][+ | |
2046 | (if (exist? "bootstrap") | |
2047 | (hash-create-handle! boot-modules (get "module") #t)) | |
2048 | "" +][+ ENDFOR host_modules +] | |
2dfbef6d PB |
2049 | [+ FOR target_modules +][+ |
2050 | (if (exist? "bootstrap") | |
2051 | (hash-create-handle! boot-modules (string-append "target-" (get "module")) #t)) | |
2052 | "" +][+ ENDFOR target_modules +] | |
3589b69e PB |
2053 | |
2054 | # With all the machinery above in place, it is pretty easy to generate | |
2055 | # dependencies. Host dependencies are a bit more complex because we have | |
2056 | # to check for bootstrap/prebootstrap dependencies. To resolve | |
2057 | # prebootstrap dependencies, prebootstrap modules are gathered in | |
2058 | # a hash table. | |
da34ca3f AO |
2059 | [+ FOR dependencies +][+ CASE (dep-kind) +] |
2060 | [+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +] | |
2061 | [+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +] | |
2062 | [+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +] | |
2063 | [+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +] | |
2064 | [+ == "normal" +][+ (make-dep "" "") +] | |
2065 | [+ ESAC +][+ ENDFOR dependencies +] | |
2066 | ||
2067 | @if gcc-bootstrap | |
2068 | [+ FOR dependencies +][+ CASE (dep-kind) +] | |
2069 | [+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+ | |
2070 | ENDFOR dependencies +]@endif gcc-bootstrap | |
2071 | ||
9a5e4aad JJ |
2072 | @if gcc-bootstrap |
2073 | [+ FOR dependencies +][+ CASE (dep-kind) +] | |
2074 | [+ == "postbootstrap" +][+ (make-postboot-target-dep) +][+ ESAC +][+ | |
2075 | ENDFOR dependencies +]@endif gcc-bootstrap | |
2076 | ||
da34ca3f AO |
2077 | @unless gcc-bootstrap |
2078 | [+ FOR dependencies +][+ CASE (dep-kind) +] | |
2079 | [+ == "postbootstrap" +][+ (make-dep "" "") +] | |
2080 | [+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap | |
3589b69e | 2081 | |
fa958513 DJ |
2082 | # Dependencies for target modules on other target modules are |
2083 | # described by lang_env_dependencies; the defaults apply to anything | |
2084 | # not mentioned there. | |
2085 | [+ | |
2086 | ;; Predicate for whether LANG was specified in lang_env_dependencies. | |
2087 | (define lang-dep (lambda (lang) | |
2088 | (hash-ref lang-env-deps (string-append (get "module") "-" lang)))) | |
2089 | ||
2090 | ;; Build the hash table we will need. | |
2091 | (define lang-env-deps (make-hash-table 7)) | |
2092 | +][+ FOR lang_env_dependencies +][+ | |
2093 | (if (exist? "cxx") | |
2094 | (hash-create-handle! lang-env-deps | |
2095 | (string-append (get "module") "-" "cxx") #t)) | |
2096 | ||
2097 | (if (exist? "no_c") | |
2098 | (hash-create-handle! lang-env-deps | |
2099 | (string-append (get "module") "-" "no_c") #t)) | |
2100 | ||
2101 | (if (exist? "no_gcc") | |
2102 | (hash-create-handle! lang-env-deps | |
2103 | (string-append (get "module") "-" "no_gcc") #t)) | |
2104 | "" +][+ ENDFOR lang_env_dependencies +] | |
2105 | ||
2106 | @if gcc-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) | |
2107 | +][+ IF bootstrap +][+ FOR bootstrap_stage +] | |
2108 | configure-stage[+id+]-target-[+module+]: maybe-all-stage[+id+]-target-libgcc[+ | |
2109 | ENDFOR +][+ ENDIF bootstrap +][+ ENDIF +][+ ENDFOR target_modules +] | |
2110 | @endif gcc-bootstrap | |
2111 | ||
2112 | @if gcc-no-bootstrap[+ FOR target_modules +][+ IF (not (lang-dep "no_gcc")) +] | |
2113 | configure-target-[+module+]: maybe-all-target-libgcc[+ | |
2114 | ENDIF +][+ ENDFOR target_modules +] | |
2115 | @endif gcc-no-bootstrap | |
2116 | ||
2117 | [+ FOR target_modules +][+ IF (not (lang-dep "no_c")) +] | |
2118 | configure-target-[+module+]: maybe-all-target-newlib maybe-all-target-libgloss[+ | |
2119 | ENDIF +][+ IF (lang-dep "cxx") +] | |
2120 | configure-target-[+module+]: maybe-all-target-libstdc++-v3[+ | |
2121 | ENDIF +] | |
2122 | [+ ENDFOR target_modules +] | |
2123 | ||
ef9db8d5 | 2124 | CONFIGURE_GDB_TK = @CONFIGURE_GDB_TK@ |
0dffceed | 2125 | GDB_TK = @GDB_TK@ |
ef9db8d5 DJ |
2126 | INSTALL_GDB_TK = @INSTALL_GDB_TK@ |
2127 | configure-gdb: $(CONFIGURE_GDB_TK) | |
3589b69e | 2128 | all-gdb: $(gdbnlmrequirements) $(GDB_TK) |
ef9db8d5 | 2129 | install-gdb: $(INSTALL_GDB_TK) |
95ddd785 | 2130 | |
4977bab6 ZW |
2131 | # Serialization dependencies. Host configures don't work well in parallel to |
2132 | # each other, due to contention over config.cache. Target configures and | |
2133 | # build configures are similar. | |
2134 | @serialization_dependencies@ | |
95ddd785 | 2135 | |
4977bab6 ZW |
2136 | # -------------------------------- |
2137 | # Regenerating top level configury | |
2138 | # -------------------------------- | |
95ddd785 NN |
2139 | |
2140 | # Rebuilding Makefile.in, using autogen. | |
e245b0ea | 2141 | AUTOGEN = autogen |
ee03dc5e | 2142 | $(srcdir)/Makefile.in: @MAINT@ $(srcdir)/Makefile.tpl $(srcdir)/Makefile.def |
e245b0ea | 2143 | cd $(srcdir) && $(AUTOGEN) Makefile.def |
95ddd785 | 2144 | |
671aa708 | 2145 | # Rebuilding Makefile. |
e245b0ea AO |
2146 | Makefile: $(srcdir)/Makefile.in config.status |
2147 | CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status | |
2148 | ||
191dd2c9 | 2149 | config.status: configure |
e75f9147 | 2150 | CONFIG_SHELL="$(SHELL)" $(SHELL) ./config.status --recheck |
95ddd785 | 2151 | |
671aa708 | 2152 | # Rebuilding configure. |
e245b0ea | 2153 | AUTOCONF = autoconf |
18c04407 | 2154 | $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \ |
350216e3 AM |
2155 | $(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \ |
2156 | $(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \ | |
126f707e | 2157 | $(srcdir)/config/gcc-plugin.m4 \ |
350216e3 AM |
2158 | $(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \ |
2159 | $(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4 | |
e245b0ea | 2160 | cd $(srcdir) && $(AUTOCONF) |
95ddd785 | 2161 | |
93c834b7 NN |
2162 | # ------------------------------ |
2163 | # Special directives to GNU Make | |
2164 | # ------------------------------ | |
2165 | ||
93c834b7 NN |
2166 | # Don't pass command-line variables to submakes. |
2167 | .NOEXPORT: | |
2168 | MAKEOVERRIDES= | |
2169 | ||
95ddd785 | 2170 | # end of Makefile.in |