]>
Commit | Line | Data |
---|---|---|
bfff8b1b | 1 | # Copyright (C) 1991-2017 Free Software Foundation, Inc. |
28f540f4 RM |
2 | # This file is part of the GNU C Library. |
3 | ||
4 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | # modify it under the terms of the GNU Lesser General Public |
6 | # License as published by the Free Software Foundation; either | |
7 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
8 | |
9 | # The GNU C Library is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | # Lesser General Public License for more details. |
28f540f4 | 13 | |
41bdb6e2 | 14 | # You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | # License along with the GNU C Library; if not, see |
16 | # <http://www.gnu.org/licenses/>. | |
28f540f4 RM |
17 | |
18 | # | |
19 | # Makefile configuration options for the GNU C library. | |
20 | # | |
21 | ifneq (,) | |
22 | This makefile requires GNU Make. | |
23 | endif | |
24 | ||
3e5f5557 UD |
25 | all: # Make this the default goal |
26 | ||
28f540f4 RM |
27 | ifneq "$(origin +included-Makeconfig)" "file" |
28 | ||
29 | +included-Makeconfig := yes | |
30 | ||
31 | ifdef subdir | |
32 | .. := ../ | |
33 | endif | |
34 | ||
094bacdb | 35 | # $(common-objdir) is the place to put objects and |
28f540f4 RM |
36 | # such that are not specific to a single subdir. |
37 | ifdef objdir | |
6e953631 UD |
38 | objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/) |
39 | common-objpfx = $(objdir)/ | |
28f540f4 RM |
40 | common-objdir = $(objdir) |
41 | else | |
728e272a | 42 | objdir must be defined by the build-directory Makefile. |
28f540f4 RM |
43 | endif |
44 | ||
f332db02 RM |
45 | # Root of the sysdeps tree. |
46 | sysdep_dir := $(..)sysdeps | |
47 | export sysdep_dir := $(sysdep_dir) | |
48 | ||
28f540f4 RM |
49 | # Get the values defined by options to `configure'. |
50 | include $(common-objpfx)config.make | |
51 | ||
e07bb02a | 52 | # What flags to give to sources which call user provided callbacks |
56ab3869 | 53 | uses-callbacks = -fexceptions |
e07bb02a | 54 | |
a4db3439 UD |
55 | # What flags to give to tests which test stack alignment |
56 | stack-align-test-flags = | |
57 | ||
57ba7bb4 | 58 | # Complete path to sysdep dirs. |
e0a3ed4f RM |
59 | # `configure' writes a definition of `config-sysdirs' in `config.make'. |
60 | sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D)) | |
61 | ||
62 | # Add-ons that contribute sysdeps trees get added to the include list | |
63 | # after sysdeps/generic. This makes #include <sysdeps/...> work right | |
64 | # to find specific add-on files without assuming the add-on directory name. | |
65 | # It also means that headers can go into an add-on's base directory | |
66 | # instead of the add-on needing a sysdeps/generic of its own. | |
04dca8d3 RM |
67 | sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\ |
68 | $(firstword $(filter /%,$(add-on)) \ | |
69 | $(..)$(add-on))) | |
70 | +sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs) | |
e0a3ed4f RM |
71 | ifdef objdir |
72 | +sysdep_dirs := $(objdir) $(+sysdep_dirs) | |
73 | endif | |
57ba7bb4 | 74 | |
273d56ce RM |
75 | # Run config.status to update config.make and config.h. We don't show the |
76 | # dependence of config.h to Make, because it is only touched when it | |
77 | # changes and so config.status would be run every time; the dependence of | |
78 | # config.make should suffice to force regeneration and re-exec, and the new | |
79 | # image will notice if config.h changed. | |
19361cb7 UD |
80 | $(common-objpfx)config.make: $(common-objpfx)config.status \ |
81 | $(..)config.make.in $(..)config.h.in | |
273d56ce RM |
82 | cd $(<D); $(SHELL) $(<F) |
83 | ||
8f73811b RM |
84 | # Find all the add-on and sysdeps configure fragments, to make sure we |
85 | # re-run configure when any of them changes. | |
5290baf0 | 86 | $(common-objpfx)config.status: $(..)version.h $(..)configure \ |
e0a3ed4f RM |
87 | $(foreach dir,$(sysdirs),\ |
88 | $(wildcard $(dir)/Implies) \ | |
95afbbe5 | 89 | $(patsubst %.ac,%,\ |
f332db02 | 90 | $(firstword $(wildcard \ |
cb8a6dbd | 91 | $(addprefix $(dir)/,configure configure.ac))))) \ |
95afbbe5 | 92 | $(patsubst %.ac,%,\ |
cb8a6dbd | 93 | $(wildcard $(..)sysdeps/*/preconfigure $(..)sysdeps/*/preconfigure.ac)) \ |
95afbbe5 | 94 | $(patsubst %.ac,%,\ |
e0a3ed4f | 95 | $(foreach add-on,$(add-ons),\ |
8f73811b | 96 | $(firstword $(wildcard \ |
e0a3ed4f | 97 | $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\ |
cb8a6dbd | 98 | configure configure.ac))) \ |
222d7f00 | 99 | $(wildcard $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\ |
cb8a6dbd | 100 | sysdeps/*/preconfigure sysdeps/*/preconfigure.ac)))) |
273d56ce RM |
101 | @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \ |
102 | echo The GNU C library has not been configured. >&2; \ | |
103 | echo Run \`configure\' to configure it before building. >&2; \ | |
104 | echo Try \`configure --help\' for more details. >&2; \ | |
105 | exit 1; fi | |
28f540f4 | 106 | |
74015205 UD |
107 | # We don't want CPPFLAGS to be exported to the command running configure. |
108 | unexport CPPFLAGS | |
109 | ||
28f540f4 RM |
110 | # Get the user's configuration parameters. |
111 | ifneq ($(wildcard $(..)configparms),) | |
112 | include $(..)configparms | |
113 | endif | |
114 | ifneq ($(objpfx),) | |
6e953631 UD |
115 | ifneq ($(wildcard $(common-objpfx)configparms),) |
116 | include $(common-objpfx)configparms | |
28f540f4 RM |
117 | endif |
118 | endif | |
28f540f4 RM |
119 | \f |
120 | #### | |
121 | #### These are the configuration variables. You can define values for | |
122 | #### the variables below in the file `configparms'. | |
123 | #### Do NOT edit this file. | |
124 | #### | |
125 | ||
126 | ||
127 | # Common prefix for machine-independent installation directories. | |
487253ea | 128 | ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value. |
28f540f4 RM |
129 | prefix = /usr/local |
130 | endif | |
131 | ||
0413b54c UD |
132 | # Decide whether we shall build the programs or not. We always do this |
133 | # unless the user tells us (in configparms) or we are building for a | |
134 | # standalone target. | |
135 | ifndef build-programs | |
136 | ifneq ($(config-os),none) | |
137 | build-programs=yes | |
138 | else | |
139 | build-programs=no | |
140 | endif | |
141 | endif | |
142 | ||
28f540f4 | 143 | # Common prefix for machine-dependent installation directories. |
487253ea | 144 | ifeq ($(origin exec_prefix),undefined) |
28f540f4 RM |
145 | exec_prefix = $(prefix) |
146 | endif | |
147 | ||
148 | # Where to install the library and object files. | |
149 | ifndef libdir | |
150 | libdir = $(exec_prefix)/lib | |
151 | endif | |
8d57beea | 152 | inst_libdir = $(install_root)$(libdir) |
28f540f4 | 153 | |
aaa8cb4b | 154 | # Where to install the shared library. |
094bacdb RM |
155 | ifndef slibdir |
156 | slibdir = $(exec_prefix)/lib | |
157 | endif | |
8d57beea | 158 | inst_slibdir = $(install_root)$(slibdir) |
094bacdb | 159 | |
aaa8cb4b AS |
160 | # Where to install the dynamic linker. |
161 | ifndef rtlddir | |
162 | rtlddir = $(slibdir) | |
163 | endif | |
164 | inst_rtlddir = $(install_root)$(rtlddir) | |
165 | ||
28f540f4 RM |
166 | # Prefix to put on files installed in $(libdir). For libraries `libNAME.a', |
167 | # the prefix is spliced between `lib' and the name, so the linker switch | |
168 | # `-l$(libprefix)NAME' finds the library; for other files the prefix is | |
169 | # just prepended to the whole file name. | |
487253ea | 170 | ifeq ($(origin libprefix),undefined) |
28f540f4 RM |
171 | libprefix = |
172 | endif | |
173 | ||
174 | # Where to install the header files. | |
175 | ifndef includedir | |
25c751d0 | 176 | includedir = $(prefix)/include |
28f540f4 | 177 | endif |
8d57beea | 178 | inst_includedir = $(install_root)$(includedir) |
28f540f4 | 179 | |
28f540f4 | 180 | # Where to install machine-independent data files. |
a2fe9c76 | 181 | # These are the timezone database, and the locale database. |
28f540f4 RM |
182 | ifndef datadir |
183 | datadir = $(prefix)/share | |
184 | endif | |
8d57beea | 185 | inst_datadir = $(install_root)$(datadir) |
28f540f4 RM |
186 | |
187 | # Where to install the timezone data files (which are machine-independent). | |
188 | ifndef zonedir | |
189 | zonedir = $(datadir)/zoneinfo | |
190 | endif | |
8d57beea | 191 | inst_zonedir = $(install_root)$(zonedir) |
28f540f4 | 192 | |
90fe682d CD |
193 | # Where to install the compiled binary locale archive and compiled |
194 | # binary locale files. | |
195 | ifndef complocaledir | |
196 | complocaledir = $(libdir)/locale | |
a2fe9c76 | 197 | endif |
90fe682d | 198 | inst_complocaledir = $(install_root)$(complocaledir) |
a2fe9c76 | 199 | |
4a33c2f5 UD |
200 | # Where to install the message catalog data files (which are |
201 | # machine-independent). | |
314f6dee CD |
202 | ifndef localedir |
203 | localedir = $(datadir)/locale | |
4a33c2f5 | 204 | endif |
314f6dee | 205 | inst_localedir = $(install_root)$(localedir) |
4a33c2f5 | 206 | |
3ec41e03 | 207 | # Where to install the locale charmap source files. |
19bc17a9 RM |
208 | ifndef i18ndir |
209 | i18ndir = $(datadir)/i18n | |
a2fe9c76 | 210 | endif |
8d57beea | 211 | inst_i18ndir = $(install_root)$(i18ndir) |
a2fe9c76 | 212 | |
6973fc01 UD |
213 | # Where to install the shared object for charset transformation. |
214 | ifndef gconvdir | |
215 | gconvdir = $(libdir)/gconv | |
216 | endif | |
217 | inst_gconvdir = $(install_root)$(gconvdir) | |
218 | ||
28f540f4 RM |
219 | # Where to install programs. |
220 | ifndef bindir | |
221 | bindir = $(exec_prefix)/bin | |
222 | endif | |
8d57beea | 223 | inst_bindir = $(install_root)$(bindir) |
28f540f4 | 224 | |
7f0ff1b0 UD |
225 | # Where to install internal programs. |
226 | ifndef libexecdir | |
227 | libexecdir = $(exec_prefix)/libexec | |
228 | endif | |
229 | inst_libexecdir = $(install_root)$(libexecdir) | |
230 | ||
28f540f4 | 231 | # Where to install administrative programs. |
1ef32c3d UD |
232 | ifndef rootsbindir |
233 | rootsbindir = $(exec_prefix)/sbin | |
234 | endif | |
8d57beea | 235 | inst_rootsbindir = $(install_root)$(rootsbindir) |
1ef32c3d | 236 | |
28f540f4 RM |
237 | ifndef sbindir |
238 | sbindir = $(exec_prefix)/sbin | |
239 | endif | |
8d57beea | 240 | inst_sbindir = $(install_root)$(sbindir) |
28f540f4 RM |
241 | |
242 | # Where to install the Info files. | |
243 | ifndef infodir | |
244 | infodir = $(prefix)/info | |
245 | endif | |
8d57beea | 246 | inst_infodir = $(install_root)$(infodir) |
28f540f4 | 247 | |
a9171047 UD |
248 | # Where to install audit libraries. |
249 | ifndef auditdir | |
250 | auditdir = $(libdir)/audit | |
251 | endif | |
252 | inst_auditdir = $(install_root)$(auditdir) | |
253 | ||
28f540f4 RM |
254 | # Where to install default configuration files. These include the local |
255 | # timezone specification and network data base files. | |
256 | ifndef sysconfdir | |
257 | sysconfdir = $(prefix)/etc | |
258 | endif | |
8d57beea | 259 | inst_sysconfdir = $(install_root)$(sysconfdir) |
28f540f4 | 260 | |
77fb9117 UD |
261 | # Directory for the database files and Makefile for nss_db. |
262 | ifndef vardbdir | |
4248b1b1 | 263 | vardbdir = $(localstatedir)/db |
77fb9117 UD |
264 | endif |
265 | inst_vardbdir = $(install_root)$(vardbdir) | |
266 | ||
28f540f4 RM |
267 | # Where to install the "localtime" timezone file; this is the file whose |
268 | # contents $(localtime) specifies. If this is a relative pathname, it is | |
269 | # relative to $(zonedir). It is a good idea to put this somewhere | |
270 | # other than there, so the zoneinfo directory contains only universal data, | |
271 | # localizing the configuration data elsewhere. | |
272 | ifndef localtime-file | |
0d8733c4 | 273 | localtime-file = $(sysconfdir)/localtime |
28f540f4 RM |
274 | endif |
275 | ||
59dd8641 RM |
276 | # What to use for leap second specifications in compiling the default |
277 | # timezone files. Set this to `/dev/null' for no leap second handling as | |
278 | # 1003.1 requires, or to `leapseconds' for proper leap second handling. | |
279 | # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'. | |
280 | # This variable determines the default: if it's `/dev/null', | |
281 | # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE. | |
282 | ifndef leapseconds | |
283 | leapseconds = /dev/null | |
284 | endif | |
285 | ||
28f540f4 RM |
286 | # What timezone's DST rules should be used when a POSIX-style TZ |
287 | # environment variable doesn't specify any rules. For 1003.1 compliance | |
288 | # this timezone must use rules that are as U.S. federal law defines DST. | |
289 | # Run `make -C time echo-zonenames' to see a list of available zone names. | |
290 | # This setting can be changed with `zic -p TIMEZONE' at any time. | |
291 | # If you want POSIX.1 compatibility, use `America/New_York'. | |
292 | ifndef posixrules | |
293 | posixrules = America/New_York | |
294 | endif | |
295 | ||
296 | # Where to install the "posixrules" timezone file; this is file | |
297 | # whose contents $(posixrules) specifies. If this is a relative | |
298 | # pathname, it is relative to $(zonedir). | |
299 | ifndef posixrules-file | |
300 | posixrules-file = posixrules | |
301 | endif | |
302 | ||
303 | ||
304 | # Directory where your system's native header files live. | |
305 | # This is used on Unix systems to generate some GNU libc header files. | |
306 | ifndef sysincludedir | |
307 | sysincludedir = /usr/include | |
308 | endif | |
309 | ||
310 | ||
311 | # Commands to install files. | |
312 | ifndef INSTALL_DATA | |
313 | INSTALL_DATA = $(INSTALL) -m 644 | |
314 | endif | |
07627f49 UD |
315 | ifndef INSTALL_SCRIPT |
316 | INSTALL_SCRIPT = $(INSTALL) | |
317 | endif | |
28f540f4 RM |
318 | ifndef INSTALL_PROGRAM |
319 | INSTALL_PROGRAM = $(INSTALL) | |
320 | endif | |
321 | ifndef INSTALL | |
322 | INSTALL = install | |
323 | endif | |
324 | ||
325 | ||
326 | # The name of the C compiler. | |
327 | # If you've got GCC, and it works, use it. | |
328 | ifeq ($(origin CC),default) | |
329 | CC := gcc | |
330 | endif | |
331 | ||
332 | # The name of the C compiler to use for compilations of programs to run on | |
333 | # the host that is building the library. If you set CC to a | |
334 | # cross-compiler, you must set this to the normal compiler. | |
335 | ifndef BUILD_CC | |
336 | BUILD_CC = $(CC) | |
337 | endif | |
338 | ||
339 | # Default flags to pass the C compiler. | |
340 | ifndef default_cflags | |
1d5c2feb UD |
341 | ifeq ($(release),stable) |
342 | default_cflags := -g -O2 | |
343 | else | |
a8922de8 | 344 | default_cflags := -g -O |
28f540f4 | 345 | endif |
1d5c2feb | 346 | endif |
28f540f4 RM |
347 | |
348 | # Flags to pass the C compiler when assembling preprocessed assembly code | |
e4f5eae8 | 349 | # (`.S' files). |
28f540f4 RM |
350 | ifndef asm-CPPFLAGS |
351 | asm-CPPFLAGS = | |
352 | endif | |
353 | ||
7e2b0c85 RM |
354 | as-needed := -Wl,--as-needed |
355 | no-as-needed := -Wl,--no-as-needed | |
7e2b0c85 | 356 | |
3ce1f295 UD |
357 | # Must be supported by the linker. |
358 | no-whole-archive = -Wl,--no-whole-archive | |
359 | whole-archive = -Wl,--whole-archive | |
360 | ||
779ae82e | 361 | # Installed name of the startup code. |
26ecc33a | 362 | # The ELF convention is that the startfile is called crt1.o |
779ae82e | 363 | start-installed-name = crt1.o |
af09bfb5 RM |
364 | # On systems that do not need a special startfile for statically linked |
365 | # binaries, simply set it to the normal name. | |
366 | ifndef static-start-installed-name | |
367 | static-start-installed-name = $(start-installed-name) | |
368 | endif | |
779ae82e | 369 | |
0269750c | 370 | ifeq (yesyes,$(build-shared)$(have-z-combreloc)) |
f13df7c7 UD |
371 | combreloc-LDFLAGS = -Wl,-z,combreloc |
372 | LDFLAGS.so += $(combreloc-LDFLAGS) | |
373 | LDFLAGS-rtld += $(combreloc-LDFLAGS) | |
374 | endif | |
375 | ||
1c563add UD |
376 | relro-LDFLAGS = -Wl,-z,relro |
377 | LDFLAGS.so += $(relro-LDFLAGS) | |
378 | LDFLAGS-rtld += $(relro-LDFLAGS) | |
1c563add | 379 | |
871b9158 UD |
380 | ifeq (yes,$(have-hash-style)) |
381 | # For the time being we unconditionally use 'both'. At some time we | |
382 | # should declare statically linked code as 'out of luck' and compile | |
383 | # with --hash-style=gnu only. | |
384 | hashstyle-LDFLAGS = -Wl,--hash-style=both | |
385 | LDFLAGS.so += $(hashstyle-LDFLAGS) | |
386 | LDFLAGS-rtld += $(hashstyle-LDFLAGS) | |
387 | endif | |
388 | ||
2d6ab5df FW |
389 | # If lazy relocations are disabled, add the -z now flag. Use |
390 | # LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to | |
391 | # test modules. | |
392 | ifeq ($(bind-now),yes) | |
393 | LDFLAGS-lib.so += -Wl,-z,now | |
394 | endif | |
395 | ||
04f5a636 RM |
396 | # Command to run after every final link (executable or shared object). |
397 | # This is invoked with $(call after-link,...), so it should operate on | |
398 | # the file $1. This can be set to do some sort of post-processing on | |
399 | # binaries, or to perform some sort of static sanity check. | |
400 | ifndef after-link | |
401 | after-link = | |
402 | endif | |
403 | ||
c23de0aa FW |
404 | # Additional libraries to link into every test. |
405 | link-extra-libs-tests = $(libsupport) | |
406 | ||
435aa54b L |
407 | # Command for linking PIE programs with the C library. |
408 | ifndef +link-pie | |
740b3dbe L |
409 | +link-pie-before-libc = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ |
410 | $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ | |
435aa54b | 411 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ |
34d6a3cb | 412 | $(firstword $(CRT-$(@F)) $(csu-objpfx)S$(start-installed-name)) \ |
435aa54b L |
413 | $(+preinit) $(+prectorS) \ |
414 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
da62f81b AS |
415 | S$(start-installed-name))\ |
416 | $(+preinit) $(link-extra-libs) \ | |
417 | $(common-objpfx)libc% $(+postinit),$^) \ | |
740b3dbe L |
418 | $(link-extra-libs) |
419 | +link-pie-after-libc = $(+postctorS) $(+postinit) | |
04f5a636 RM |
420 | define +link-pie |
421 | $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-pie-after-libc) | |
422 | $(call after-link,$@) | |
423 | endef | |
424 | define +link-pie-tests | |
76dcbf42 FW |
425 | $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ |
426 | $(+link-pie-after-libc) | |
04f5a636 RM |
427 | $(call after-link,$@) |
428 | endef | |
23b5cae1 MG |
429 | define +link-pie-printers-tests |
430 | $(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ | |
431 | $(+link-pie-after-libc) | |
432 | $(call after-link,$@) | |
433 | endef | |
435aa54b | 434 | endif |
e1586792 UD |
435 | # Command for statically linking programs with the C library. |
436 | ifndef +link-static | |
95f5a9a8 | 437 | +link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ |
9f0d7b6d | 438 | $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
af09bfb5 | 439 | $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ |
a5055ad1 | 440 | $(+preinit) $(+prectorT) \ |
e1586792 UD |
441 | $(filter-out $(addprefix $(csu-objpfx),start.o \ |
442 | $(start-installed-name))\ | |
443 | $(+preinit) $(link-extra-libs-static) \ | |
444 | $(common-objpfx)libc% $(+postinit),$^) \ | |
d173d12e | 445 | $(link-extra-libs-static) |
a5055ad1 | 446 | +link-static-after-libc = $(+postctorT) $(+postinit) |
04f5a636 RM |
447 | define +link-static |
448 | $(+link-static-before-libc) $(link-libc-static) $(+link-static-after-libc) | |
449 | $(call after-link,$@) | |
450 | endef | |
451 | define +link-static-tests | |
76dcbf42 | 452 | $(+link-static-before-libc) $(link-libc-static-tests) $(+link-static-after-libc) |
04f5a636 RM |
453 | $(call after-link,$@) |
454 | endef | |
e1586792 | 455 | endif |
94b32c39 L |
456 | # Commands for linking programs with the C library. |
457 | ifndef +link | |
458 | ifeq (yes,$(build-shared)) | |
cc08749b L |
459 | ifeq (yes,$(build-pie-default)) |
460 | no-pie-ldflag = -no-pie | |
461 | +link = $(+link-pie) | |
462 | +link-tests = $(+link-pie-tests) | |
23b5cae1 MG |
463 | +link-printers-tests = $(+link-pie-printers-tests) |
464 | else # not build-pie-default | |
94b32c39 | 465 | +link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ |
740b3dbe | 466 | $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
94b32c39 | 467 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ |
6014c65d | 468 | $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \ |
94b32c39 L |
469 | $(+preinit) $(+prector) \ |
470 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
471 | $(start-installed-name))\ | |
472 | $(+preinit) $(link-extra-libs) \ | |
473 | $(common-objpfx)libc% $(+postinit),$^) \ | |
474 | $(link-extra-libs) | |
475 | +link-after-libc = $(+postctor) $(+postinit) | |
04f5a636 RM |
476 | define +link |
477 | $(+link-before-libc) $(rtld-LDFLAGS) $(link-libc) $(+link-after-libc) | |
478 | $(call after-link,$@) | |
479 | endef | |
480 | define +link-tests | |
76dcbf42 FW |
481 | $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ |
482 | $(+link-after-libc) | |
04f5a636 RM |
483 | $(call after-link,$@) |
484 | endef | |
23b5cae1 MG |
485 | define +link-printers-tests |
486 | $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ | |
487 | $(+link-after-libc) | |
488 | $(call after-link,$@) | |
489 | endef | |
490 | endif # build-pie-default | |
491 | else # build-static | |
94b32c39 L |
492 | +link = $(+link-static) |
493 | +link-tests = $(+link-static-tests) | |
23b5cae1 MG |
494 | +link-printers-tests = $(+link-static-tests) |
495 | endif # build-shared | |
496 | endif # +link | |
497 | ||
498 | # The pretty printer test programs need to be compiled without optimizations | |
499 | # so they won't confuse gdb. We could use either the 'GCC optimize' pragma | |
500 | # or the 'optimize' function attribute to achieve this; however, at least on | |
501 | # ARM, gcc always produces different debugging symbols when invoked with | |
502 | # a -O greater than 0 than when invoked with -O0, regardless of anything else | |
503 | # we're using to suppress optimizations. Therefore, we need to explicitly pass | |
504 | # -O0 to it through CFLAGS. | |
505 | # Additionally, the build system will try to -include $(common-objpfx)/config.h | |
506 | # when compiling the tests, which will throw an error if some special macros | |
507 | # (such as __OPTIMIZE__ and IS_IN_build) aren't defined. To avoid this, we | |
508 | # tell gcc to define IS_IN_build. | |
509 | CFLAGS-printers-tests := -O0 -ggdb3 -DIS_IN_build | |
510 | ||
0269750c | 511 | ifeq (yes,$(build-shared)) |
23b5cae1 MG |
512 | # These indicate whether to link using the built ld.so or the installed one. |
513 | installed-rtld-LDFLAGS = -Wl,-dynamic-linker=$(rtlddir)/$(rtld-installed-name) | |
514 | built-rtld-LDFLAGS = -Wl,-dynamic-linker=$(elf-objpfx)ld.so | |
515 | ||
740b3dbe | 516 | ifndef rtld-LDFLAGS |
23b5cae1 | 517 | rtld-LDFLAGS = $(installed-rtld-LDFLAGS) |
740b3dbe | 518 | endif |
23b5cae1 | 519 | |
740b3dbe L |
520 | ifndef rtld-tests-LDFLAGS |
521 | ifeq (yes,$(build-hardcoded-path-in-tests)) | |
23b5cae1 | 522 | rtld-tests-LDFLAGS = $(built-rtld-LDFLAGS) |
740b3dbe | 523 | else |
23b5cae1 MG |
524 | rtld-tests-LDFLAGS = $(installed-rtld-LDFLAGS) |
525 | endif # build-hardcoded-path-in-tests | |
526 | endif # rtld-tests-LDFLAGS | |
527 | ||
528 | endif # build-shared | |
529 | ||
3fe9de0d RM |
530 | ifndef link-libc |
531 | ifeq (yes,$(build-shared)) | |
aa1075ea RM |
532 | # We need the versioned name of libc.so in the deps of $(others) et al |
533 | # so that the symlink to libc.so is created before anything tries to | |
534 | # run the linked programs. | |
23b5cae1 | 535 | link-libc-rpath = -Wl,-rpath=$(rpath-link) |
740b3dbe | 536 | link-libc-rpath-link = -Wl,-rpath-link=$(rpath-link) |
23b5cae1 | 537 | |
740b3dbe | 538 | ifeq (yes,$(build-hardcoded-path-in-tests)) |
23b5cae1 | 539 | link-libc-tests-rpath-link = $(link-libc-rpath) |
740b3dbe L |
540 | else |
541 | link-libc-tests-rpath-link = $(link-libc-rpath-link) | |
23b5cae1 MG |
542 | endif # build-hardcoded-path-in-tests |
543 | ||
740b3dbe L |
544 | link-libc-before-gnulib = $(common-objpfx)libc.so$(libc.so-version) \ |
545 | $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ | |
4134b50d | 546 | $(as-needed) $(elf-objpfx)ld.so \ |
740b3dbe L |
547 | $(no-as-needed) |
548 | link-libc = $(link-libc-rpath-link) $(link-libc-before-gnulib) $(gnulib) | |
23b5cae1 MG |
549 | |
550 | link-libc-tests-after-rpath-link = $(link-libc-before-gnulib) $(gnulib-tests) | |
740b3dbe | 551 | link-libc-tests = $(link-libc-tests-rpath-link) \ |
23b5cae1 MG |
552 | $(link-libc-tests-after-rpath-link) |
553 | # Pretty printer test programs always require rpath instead of rpath-link. | |
554 | link-libc-printers-tests = $(link-libc-rpath) \ | |
555 | $(link-libc-tests-after-rpath-link) | |
556 | ||
4d6acc61 | 557 | # This is how to find at build-time things that will be installed there. |
c23de0aa | 558 | rpath-dirs = math elf dlfcn nss nis rt resolv crypt mathvec support |
e72bfd87 UD |
559 | rpath-link = \ |
560 | $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) | |
23b5cae1 | 561 | else # build-static |
4ac5087b | 562 | link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) |
95f5a9a8 | 563 | link-libc-tests = $(common-objpfx)libc.a $(otherlibs) $(gnulib-tests) $(common-objpfx)libc.a $(gnulib-tests) |
23b5cae1 MG |
564 | endif # build-shared |
565 | endif # link-libc | |
900bec85 | 566 | |
ad10cac8 | 567 | # Differences in the linkers on the various platforms. |
ad10cac8 UD |
568 | LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN' |
569 | LDFLAGS-soname-fname = -Wl,-soname,$(@F) | |
570 | LDFLAGS-rdynamic = -rdynamic | |
571 | LDFLAGS-Bsymbolic = -Bsymbolic | |
ad10cac8 | 572 | |
f01010de UD |
573 | # Choose the default search path for the dynamic linker based on |
574 | # where we will install libraries. | |
575 | ifneq ($(libdir),$(slibdir)) | |
576 | default-rpath = $(slibdir):$(libdir) | |
577 | else | |
578 | default-rpath = $(libdir) | |
579 | endif | |
580 | ||
57ba7bb4 | 581 | ifndef link-extra-libs |
1d038b6b RM |
582 | link-extra-libs = $(LDLIBS-$(@F)) |
583 | link-extra-libs-static = $(link-extra-libs) | |
57ba7bb4 | 584 | endif |
e1586792 UD |
585 | |
586 | # The static libraries. | |
b9af1301 | 587 | link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group |
95f5a9a8 | 588 | link-libc-static-tests = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib-tests) -Wl,--end-group |
e1586792 | 589 | |
95f5a9a8 JM |
590 | # How to link against libgcc. Some libgcc functions, such as those |
591 | # for "long long" arithmetic or software floating point, can always be | |
592 | # built without use of C library headers and do not have any global | |
593 | # state so can safely be linked statically into any executable or | |
594 | # shared library requiring them; these functions are in libgcc.a. | |
595 | # Other functions, relating to exception handling, may require C | |
596 | # library headers to build and it may not be safe to have more than | |
597 | # one copy of them in a process; these functions are only in | |
598 | # libgcc_s.so and libgcc_eh.a. | |
599 | # | |
600 | # To avoid circular dependencies when bootstrapping, it is desirable | |
601 | # to avoid use of libgcc_s and libgcc_eh in building glibc. Where any | |
602 | # glibc functionality (in particular, thread cancellation) requires | |
603 | # exception handling, this is implemented through dlopen of libgcc_s | |
604 | # to avoid unnecessary dependencies on libgcc_s by programs not using | |
605 | # that functionality; executables built with glibc do not use | |
606 | # exception handling other than through thread cancellation. | |
607 | # | |
608 | # Undefined references to functions from libgcc_eh or libgcc_s may | |
609 | # arise for code built with -fexceptions. In the case of statically | |
610 | # linked programs installed by glibc, unwinding will never actually | |
611 | # occur at runtime and the use of elf/static-stubs.c to resolve these | |
612 | # references is safe. In the case of statically linked test programs | |
613 | # and test programs built with -fexceptions, unwinding may occur in | |
614 | # some cases and it is preferable to link with libgcc_eh or libgcc_s | |
615 | # so that the testing is as similar as possible to how programs will | |
616 | # be built with the installed glibc. | |
617 | # | |
618 | # Some architectures have architecture-specific systems for exception | |
619 | # handling that may involve undefined references to | |
620 | # architecture-specific functions. On those architectures, | |
621 | # gnulib-arch and static-gnulib-arch may be defined in sysdeps | |
622 | # makefiles to use additional libraries for linking executables and | |
623 | # shared libraries built by glibc. | |
28f540f4 | 624 | ifndef gnulib |
cbdb12de UD |
625 | ifneq ($(have-cc-with-libunwind),yes) |
626 | libunwind = | |
feca5e0b | 627 | else |
cbdb12de | 628 | libunwind = -lunwind |
feca5e0b | 629 | endif |
a3cc4f48 | 630 | libgcc_eh := -Wl,--as-needed -lgcc_s $(libunwind) -Wl,--no-as-needed |
95f5a9a8 JM |
631 | gnulib-arch = |
632 | gnulib = -lgcc $(gnulib-arch) | |
633 | gnulib-tests := -lgcc $(libgcc_eh) | |
634 | static-gnulib-arch = | |
94b32c39 L |
635 | # By default, elf/static-stubs.o, instead of -lgcc_eh, is used to |
636 | # statically link programs. When --disable-shared is used, we use | |
637 | # -lgcc_eh since elf/static-stubs.o isn't sufficient. | |
638 | ifeq (yes,$(build-shared)) | |
95f5a9a8 | 639 | static-gnulib = -lgcc $(static-gnulib-arch) |
94b32c39 L |
640 | else |
641 | static-gnulib = -lgcc -lgcc_eh $(static-gnulib-arch) | |
642 | endif | |
95f5a9a8 | 643 | static-gnulib-tests := -lgcc -lgcc_eh $(libunwind) |
cbdb12de | 644 | libc.so-gnulib := -lgcc |
28f540f4 | 645 | endif |
e75154a6 RM |
646 | +preinit = $(addprefix $(csu-objpfx),crti.o) |
647 | +postinit = $(addprefix $(csu-objpfx),crtn.o) | |
35e65999 RA |
648 | +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` |
649 | +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` | |
435aa54b | 650 | # Variants of the two previous definitions for linking PIE programs. |
35e65999 RA |
651 | +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` |
652 | +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` | |
a5055ad1 L |
653 | # Variants of the two previous definitions for statically linking programs. |
654 | +prectorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginT.o` | |
189e935b | 655 | +postctorT = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` |
6e953631 UD |
656 | csu-objpfx = $(common-objpfx)csu/ |
657 | elf-objpfx = $(common-objpfx)elf/ | |
28f540f4 | 658 | |
cc1290d0 JM |
659 | # A command that, prepended to the name and arguments of a program, |
660 | # and run on the build system, causes that program with those | |
661 | # arguments to be run on the host for which the library is built. | |
662 | ifndef test-wrapper | |
663 | test-wrapper = | |
664 | endif | |
665 | # Likewise, but the name of the program is preceded by | |
666 | # <variable>=<value> assignments for environment variables. | |
667 | ifndef test-wrapper-env | |
668 | test-wrapper-env = $(test-wrapper) env | |
669 | endif | |
9162c01d RM |
670 | # Likewise, but the program's environment will be empty except for any |
671 | # explicit <variable>=<value> assignments preceding the program name. | |
672 | ifndef test-wrapper-env-only | |
673 | test-wrapper-env-only = $(test-wrapper) env -i | |
674 | endif | |
cc1290d0 | 675 | |
03ac099f JM |
676 | # Whether to run test programs built for the library's host system. |
677 | ifndef run-built-tests | |
cc1290d0 | 678 | ifeq (yes|,$(cross-compiling)|$(test-wrapper)) |
03ac099f JM |
679 | run-built-tests = no |
680 | else | |
681 | run-built-tests = yes | |
682 | endif | |
683 | endif | |
684 | ||
d6fe5e58 JM |
685 | # Whether to stop immediately when a test fails. Nonempty means to |
686 | # stop, empty means not to stop. | |
687 | ifndef stop-on-test-failure | |
688 | stop-on-test-failure = | |
689 | endif | |
690 | ||
03a75825 RM |
691 | # How to run a program we just linked with our library. |
692 | # The program binary is assumed to be $(word 2,$^). | |
693 | built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^)) | |
01dc6df9 SP |
694 | rtld-prefix = $(elf-objpfx)$(rtld-installed-name) \ |
695 | --library-path \ | |
696 | $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)) | |
0269750c | 697 | ifeq (yes,$(build-shared)) |
196980f5 | 698 | comma = , |
11336c16 UD |
699 | sysdep-library-path = \ |
700 | $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\ | |
701 | $(filter -Wl$(comma)-rpath-link=%,\ | |
702 | $(sysdep-LDFLAGS))))) | |
88866099 JM |
703 | # $(run-via-rtld-prefix) is a command that, when prepended to the name |
704 | # of a program built with the newly built library, produces a command | |
705 | # that, executed on the host for which the library is built, runs that | |
daaa7713 JM |
706 | # program. For tests listed in tests-static or xtests-static, it is |
707 | # empty. | |
88866099 JM |
708 | run-via-rtld-prefix = \ |
709 | $(if $(strip $(filter $(notdir $(built-program-file)), \ | |
01dc6df9 | 710 | $(tests-static) $(xtests-static))),, $(rtld-prefix)) |
8658ceda | 711 | else |
88866099 JM |
712 | run-via-rtld-prefix = |
713 | endif | |
8540f6d2 JM |
714 | # $(run-program-env) is the default environment variable settings to |
715 | # use when running a program built with the newly built library. | |
716 | run-program-env = GCONV_PATH=$(common-objpfx)iconvdata \ | |
717 | LOCPATH=$(common-objpfx)localedata LC_ALL=C | |
25fe8932 | 718 | # $(run-program-prefix) is a command that, when prepended to the name |
88866099 JM |
719 | # of a program built with the newly built library, produces a command |
720 | # that, executed on the build system on which "make" is run, runs that | |
8540f6d2 JM |
721 | # program. $(run-program-prefix-before-env) and |
722 | # $(run-program-prefix-after-env) are similar, but separate parts | |
723 | # before and after a list of environment variables. | |
724 | run-program-prefix-before-env = $(test-wrapper-env) | |
725 | run-program-prefix-after-env = $(run-via-rtld-prefix) | |
726 | run-program-prefix = $(run-program-prefix-before-env) $(run-program-env) \ | |
727 | $(run-program-prefix-after-env) | |
88866099 JM |
728 | # $(built-program-cmd) is a command that, executed on the build system |
729 | # on which "make" is run, runs the newly built program that is the | |
730 | # second dependency of the makefile target in which | |
8540f6d2 JM |
731 | # $(built-program-cmd) is used. $(built-program-cmd-before-env) and |
732 | # $(built-program-cmd-after-env) are similar, before and after a list | |
733 | # of environment variables. | |
734 | built-program-cmd-before-env = $(test-wrapper-env) | |
735 | built-program-cmd-after-env = $(run-via-rtld-prefix) $(built-program-file) | |
736 | built-program-cmd = $(built-program-cmd-before-env) $(run-program-env) \ | |
737 | $(built-program-cmd-after-env) | |
166bca24 JB |
738 | # $(host-built-program-cmd) is a command that, executed on the host |
739 | # for which the library is built, runs the newly built program that is | |
740 | # the second dependency of the makefile target in which | |
741 | # $(host-built-program-cmd) is used. | |
742 | host-built-program-cmd = $(run-via-rtld-prefix) $(built-program-file) | |
03a75825 | 743 | |
28f540f4 RM |
744 | ifndef LD |
745 | LD := ld -X | |
746 | endif | |
747 | ||
740b3dbe L |
748 | # $(test-via-rtld-prefix) is a command that, when prepended to the name |
749 | # of a test program built with the newly built library, produces a command | |
750 | # that, executed on the host for which the library is built, runs that | |
daaa7713 JM |
751 | # program. For tests listed in tests-static or xtests-static as well |
752 | # as when test programs are hardcoded to the newly built libraries, it | |
753 | # is empty. | |
740b3dbe L |
754 | |
755 | # $(test-program-prefix) is a command that, when prepended to the name | |
756 | # of a test program built with the newly built library, produces a command | |
757 | # that, executed on the build system on which "make" is run, runs that | |
8540f6d2 JM |
758 | # test program. $(test-program-prefix-before-env) and |
759 | # $(test-program-prefix-after-env) are similar, before and after a | |
760 | # list of environment variables. | |
740b3dbe L |
761 | |
762 | # $(test-program-cmd) is a command that, executed on the build system | |
763 | # on which "make" is run, runs the newly built test program that is the | |
764 | # second dependency of the makefile target in which | |
8540f6d2 JM |
765 | # $(test-program-cmd) is used. $(test-program-cmd-before-env) and |
766 | # $(test-program-cmd-after-env) are similar, before and after a list | |
767 | # of environment variables. | |
740b3dbe L |
768 | |
769 | # $(host-test-program-cmd) is a command that, executed on the host | |
770 | # for which the library is built, runs the newly built test program that | |
771 | # is the second dependency of the makefile target in which | |
772 | # $(host-test-program-cmd) is used. | |
773 | ||
774 | ifeq (yes,$(build-hardcoded-path-in-tests)) | |
775 | test-via-rtld-prefix = | |
8540f6d2 JM |
776 | test-program-prefix-before-env = $(test-wrapper-env) |
777 | test-program-prefix-after-env = | |
778 | test-program-prefix = $(test-program-prefix-before-env) $(run-program-env) \ | |
779 | $(test-program-prefix-after-env) | |
780 | test-program-cmd-before-env = $(test-wrapper-env) | |
781 | test-program-cmd-after-env = $(built-program-file) | |
782 | test-program-cmd = $(test-program-cmd-before-env) $(run-program-env) \ | |
783 | $(test-program-cmd-after-env) | |
740b3dbe L |
784 | host-test-program-cmd = $(built-program-file) |
785 | else | |
786 | test-via-rtld-prefix = $(run-via-rtld-prefix) | |
8540f6d2 JM |
787 | test-program-prefix-before-env = $(run-program-prefix-before-env) |
788 | test-program-prefix-after-env = $(run-program-prefix-after-env) | |
740b3dbe | 789 | test-program-prefix = $(run-program-prefix) |
8540f6d2 JM |
790 | test-program-cmd-before-env = $(built-program-cmd-before-env) |
791 | test-program-cmd-after-env = $(built-program-cmd-after-env) | |
740b3dbe L |
792 | test-program-cmd = $(built-program-cmd) |
793 | host-test-program-cmd = $(host-built-program-cmd) | |
794 | endif | |
795 | ||
28f540f4 | 796 | # Extra flags to pass to GCC. |
6cc7d725 | 797 | ifeq ($(all-warnings),yes) |
ed159672 | 798 | +gccwarn := -Wall -Wwrite-strings -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar |
6cc7d725 | 799 | else |
ed159672 | 800 | +gccwarn := -Wall -Wwrite-strings |
6cc7d725 | 801 | endif |
498a2233 | 802 | +gccwarn += -Wundef |
a4ecc9eb | 803 | ifeq ($(enable-werror),yes) |
48bb14bd | 804 | +gccwarn += -Werror |
a4ecc9eb | 805 | endif |
8e2f7c68 | 806 | +gccwarn-c = -Wstrict-prototypes -Wold-style-definition |
28f540f4 | 807 | |
dec36b4f UD |
808 | # We do not depend on the address of constants in different files to be |
809 | # actually different, so allow the compiler to merge them all. | |
810 | +merge-constants = -fmerge-all-constants | |
811 | ||
29ba805c AJ |
812 | # We have to assume that glibc functions are called in any rounding |
813 | # mode and also change the rounding mode in a few functions. So, | |
814 | # disable any optimization that assume default rounding mode. | |
815 | +math-flags = -frounding-math | |
816 | ||
cecbc796 NA |
817 | # We might want to compile with some stack-protection flag. |
818 | ifneq ($(stack-protector),) | |
819 | +stack-protector=$(stack-protector) | |
820 | endif | |
821 | ||
30077d51 RM |
822 | # This is the program that generates makefile dependencies from C source files. |
823 | # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy | |
824 | # targets for headers so that removed headers don't break the build. | |
28f540f4 | 825 | ifndef +mkdep |
30077d51 | 826 | +mkdep = $(CC) -M -MP |
28f540f4 RM |
827 | endif |
828 | ||
829 | # The program that makes Emacs-style TAGS files. | |
78759725 | 830 | ETAGS := etags |
28f540f4 | 831 | |
9de06f3c RM |
832 | # The `xgettext' program for producing .pot files from sources. |
833 | ifndef XGETTEXT | |
834 | XGETTEXT = xgettext | |
835 | endif | |
836 | ||
28f540f4 RM |
837 | # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and |
838 | # perhaps others) to preprocess assembly code in some cases. | |
839 | M4 = m4 | |
840 | ||
73237de3 UD |
841 | # To force installation of files even if they are older than the |
842 | # installed files. This variable is included in the dependency list | |
843 | # of all installation targets. | |
844 | ifeq ($(force-install),yes) | |
845 | +force = force-install | |
846 | else | |
847 | +force = | |
848 | endif | |
849 | ||
28f540f4 RM |
850 | #### |
851 | #### End of configuration variables. | |
852 | #### | |
853 | \f | |
854 | # This tells some versions of GNU make before 3.63 not to export all variables. | |
855 | .NOEXPORT: | |
856 | ||
857 | # We want to echo the commands we're running without | |
6d52618b | 858 | # umpteen zillion filenames along with it (we use `...' instead) |
28f540f4 RM |
859 | # but we don't want this echoing done when the user has said |
860 | # he doesn't want to see commands echoed by using -s. | |
861 | ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s | |
862 | +cmdecho := echo >/dev/null | |
863 | else # not -s | |
864 | +cmdecho := echo | |
865 | endif # -s | |
866 | ||
867 | # These are the flags given to the compiler to tell | |
868 | # it what sort of optimization and/or debugging output to do. | |
869 | ifndef +cflags | |
870 | # If `CFLAGS' was defined, use that. | |
871 | ifdef CFLAGS | |
872 | +cflags := $(filter-out -I%,$(CFLAGS)) | |
873 | endif # CFLAGS | |
874 | endif # +cflags | |
875 | ||
fd26970f | 876 | # If none of the above worked, default to "-g -O". |
28f540f4 RM |
877 | ifeq "$(strip $(+cflags))" "" |
878 | +cflags := $(default_cflags) | |
879 | endif # $(+cflags) == "" | |
880 | ||
cecbc796 NA |
881 | +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) $(+math-flags) \ |
882 | $(+stack-protector) | |
28f540f4 | 883 | +gcc-nowarn := -w |
28f540f4 RM |
884 | |
885 | # Don't duplicate options if we inherited variables from the parent. | |
886 | +cflags := $(sort $(+cflags)) | |
887 | ||
b84660a8 RM |
888 | # Each sysdeps directory can contain header files that both will be |
889 | # used to compile and will be installed. Each can also contain an | |
890 | # include/ subdirectory, whose header files will be used to compile | |
891 | # but will not be installed, and will take precedence over the | |
892 | # installed files. This mirrors the top-level include/ subdirectory. | |
893 | +sysdep-includes := $(foreach dir,$(+sysdep_dirs),\ | |
894 | $(addprefix -I,$(wildcard $(dir)/include) $(dir))) | |
895 | ||
b6ab06ce UD |
896 | # These are flags given to the C compiler to tell it to look for |
897 | # include files (including ones given in angle brackets) in the parent | |
898 | # library source directory, in the include directory, and in the | |
899 | # current directory. | |
e0a3ed4f | 900 | +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \ |
4ae73ca0 RM |
901 | $(+sysdep-includes) $(includes) \ |
902 | $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) | |
28f540f4 | 903 | |
96aa2d94 | 904 | # Since libio has several internal header files, we use a -I instead |
762a2918 | 905 | # of many little headers in the include directory. |
96aa2d94 | 906 | libio-include = -I$(..)libio |
28f540f4 | 907 | |
130ac68c SP |
908 | # List of non-library modules that we build. |
909 | built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \ | |
910 | libSegFault libpcprofile librpcsvc locale-programs \ | |
7c3018f9 ZW |
911 | memusagestat nonlib nscd extramodules libnldbl libsupport \ |
912 | testsuite | |
130ac68c | 913 | |
9cd47470 SP |
914 | in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \ |
915 | $(libof-$(<F)) \ | |
916 | $(libof-$(@F)) \ | |
917 | libc)) | |
918 | ||
e400f3cc SP |
919 | # Build ld.so, libc.so and libpthread.so with -ftls-model=initial-exec |
920 | tls-model = $(if $(filter libpthread rtld \ | |
921 | libc,$(in-module)),-ftls-model=initial-exec,) | |
922 | ||
130ac68c | 923 | module-cppflags-real = -include $(common-objpfx)libc-modules.h \ |
279bc5b3 | 924 | -DMODULE_NAME=$(in-module) |
130ac68c | 925 | |
8a257e2c RM |
926 | # We don't need libc-modules.h and the MODULE_NAME definition for .v.i |
927 | # files. These targets don't (and will likely never need to) use the IS_IN | |
928 | # facility. In fact, shlib-versions should not use it because that will | |
929 | # create a circular dependency as libc-modules.h is generated from | |
930 | # shlib-versions. | |
931 | module-cppflags = $(if $(filter %.v.i,$(@F)),,$(module-cppflags-real)) | |
130ac68c | 932 | |
28f540f4 | 933 | # These are the variables that the implicit compilation rules use. |
ce460d04 RM |
934 | # Note that we can't use -std=* in CPPFLAGS, because it overrides |
935 | # the implicit -lang-asm and breaks cpp behavior for .S files--notably | |
936 | # it causes cpp to stop predefining __ASSEMBLER__. | |
7ffa9423 AZ |
937 | CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \ |
938 | $($(subdir)-CPPFLAGS) \ | |
130ac68c | 939 | $(+includes) $(defines) $(module-cppflags) \ |
ae8b36f7 | 940 | -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \ |
130ac68c | 941 | $(CPPFLAGS-$(suffix $@)) \ |
d29724f8 | 942 | $(foreach lib,$(libof-$(basename $(@F))) \ |
bc96fbda | 943 | $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \ |
0a951d0e | 944 | $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) |
67e58f39 | 945 | |
6765d5d3 | 946 | ifneq (no,$(have-tunables)) |
67e58f39 SP |
947 | CPPFLAGS += -DTOP_NAMESPACE=glibc |
948 | endif | |
949 | ||
783dd2d3 | 950 | override CFLAGS = -std=gnu11 -fgnu89-inline $(config-extra-cflags) \ |
7735afa2 UD |
951 | $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \ |
952 | $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \ | |
e400f3cc | 953 | $(CFLAGS-$(@F)) $(tls-model) \ |
44f0a71e UD |
954 | $(foreach lib,$(libof-$(basename $(@F))) \ |
955 | $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib))) | |
83212868 L |
956 | # Use our copies of cstdlib and cmath. |
957 | override CXXFLAGS = -I$(common-objpfx) $(c++-sysincludes) \ | |
ef226fec | 958 | $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \ |
7735afa2 | 959 | $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F)) |
28f540f4 | 960 | |
cc3fa755 UD |
961 | # If everything is compiled with -fPIC (implicitly) we must tell this by |
962 | # defining the PIC symbol. | |
963 | ifeq (yes,$(build-pic-default)) | |
964 | pic-default = -DPIC | |
965 | endif | |
966 | ||
f0bf9cb9 RM |
967 | # Enable object files for different versions of the library. |
968 | # Various things use $(object-suffixes) to know what all to make. | |
969 | # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) | |
970 | # to pass different flags for each flavor. | |
91641c65 | 971 | libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) |
612148c6 FW |
972 | # .op may be added to all-object-suffixes below. |
973 | all-object-suffixes := .o .os .oS | |
650425ce | 974 | object-suffixes := |
cc3fa755 | 975 | CPPFLAGS-.o = $(pic-default) |
14e9dd67 | 976 | CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) |
f0bf9cb9 | 977 | libtype.o := lib%.a |
650425ce | 978 | object-suffixes += .o |
f0bf9cb9 RM |
979 | ifeq (yes,$(build-shared)) |
980 | # Under --enable-shared, we will build a shared library of PIC objects. | |
40a55d20 UD |
981 | # The PIC object files are named foo.os. |
982 | object-suffixes += .os | |
b5567b2a | 983 | CPPFLAGS-.os = -DPIC -DSHARED |
14e9dd67 | 984 | CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag) |
40a55d20 | 985 | libtype.os := lib%_pic.a |
26b4d766 UD |
986 | # This can be changed by a sysdep makefile |
987 | pic-ccflag = -fPIC | |
231e88a4 UD |
988 | # This one should always stay like this unless there is a very good reason. |
989 | PIC-ccflag = -fPIC | |
f0bf9cb9 | 990 | endif |
7b91359b UD |
991 | # This can be changed by a sysdep makefile |
992 | pie-ccflag = -fpie | |
993 | # This one should always stay like this unless there is a very good reason. | |
994 | PIE-ccflag = -fPIE | |
f0bf9cb9 RM |
995 | ifeq (yes,$(build-profile)) |
996 | # Under --enable-profile, we will build a static library of profiled objects. | |
40a55d20 | 997 | # The profiled object files are named foo.op. |
612148c6 | 998 | all-object-suffixes += .op |
40a55d20 | 999 | object-suffixes += .op |
cc3fa755 | 1000 | CPPFLAGS-.op = -DPROF $(pic-default) |
40a55d20 UD |
1001 | CFLAGS-.op = -pg |
1002 | libtype.op = lib%_p.a | |
f0bf9cb9 | 1003 | endif |
ab95290c | 1004 | |
c1487492 RM |
1005 | # Convenience variable for when we want to treat shared-library cases |
1006 | # differently from the rest. | |
1007 | object-suffixes-noshared := $(filter-out .os,$(object-suffixes)) | |
1008 | ||
9afc8a59 UD |
1009 | object-suffixes-for-libc := $(object-suffixes) |
1010 | ||
1011 | ifeq (yes,$(build-shared)) | |
1012 | # Build special library that contains the static-only routines for libc. | |
1013 | object-suffixes-for-libc += .oS | |
1014 | ||
1015 | # Must build the routines as PIC, though, because they can end up in (users') | |
1016 | # shared objects. We don't want to use CFLAGS-os because users may, for | |
1017 | # example, make that processor-specific. | |
231e88a4 | 1018 | CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) |
06b31ad3 | 1019 | CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 |
9afc8a59 UD |
1020 | libtype.oS = lib%_nonshared.a |
1021 | endif | |
1022 | ||
073e82bf RM |
1023 | # The assembler can generate debug information too. |
1024 | ifndef ASFLAGS | |
2e7c805d | 1025 | ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) |
073e82bf | 1026 | endif |
96a15749 | 1027 | ASFLAGS += -Werror=undef $(ASFLAGS-config) $(asflags-cpu) |
9afc8a59 | 1028 | |
96bda0ea RM |
1029 | ifndef BUILD_CC |
1030 | BUILD_CC = $(CC) | |
1031 | endif | |
e72bfd87 UD |
1032 | |
1033 | move-if-change = $(SHELL) $(..)scripts/move-if-change | |
a641835a | 1034 | \f |
281e6031 UD |
1035 | -include $(common-objpfx)sysd-sorted |
1036 | subdirs = $(sorted-subdirs) | |
e0a3ed4f RM |
1037 | subdir-srcdirs = $(foreach dir,$(subdirs),\ |
1038 | $(firstword $($(dir)-srcdir) $(..)$(dir))) | |
9a0a462c | 1039 | |
f3787738 RM |
1040 | # This is a pair of implicit rules to preprocess a file with # comments, |
1041 | # %ifdef et al, based on config.h settings or other %include'd files. | |
1042 | # We use chained rules instead of a pipeline here so that we can properly | |
1043 | # check the exit status of cpp rather than using its bad output when there | |
1044 | # is a preprocessing error. Another rule should depend on the output file | |
1045 | # `FOO.v', and along with that `FOO.v.i' should be given dependencies | |
1046 | # listing both its input files, and any header files that it may reference | |
1047 | # (but no commands). | |
8744841f RM |
1048 | %.v.i: $(common-objpfx)config.h $(..)Makeconfig |
1049 | sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ | |
90f42071 | 1050 | $(filter-out FORCE %.h $(..)Makeconfig,$^) \ |
02838201 | 1051 | | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \ |
f3787738 RM |
1052 | > $@T |
1053 | mv -f $@T $@ | |
1054 | %.v: %.v.i | |
1055 | sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T | |
1056 | mv -f $@T $@ | |
480d827b | 1057 | |
7e80ddb8 RM |
1058 | ifeq (yes, $(build-shared)) |
1059 | ||
0ab0291b L |
1060 | # To generate a header to support more than one ABI for different |
1061 | # architecture variants, the CPU/Makefile defines abi-variants to be a | |
1062 | # list of names for those variants (e.g. 32 64), and, for each variant, | |
1063 | # defines abi-$(variant)-condition to be the condition for those options | |
1064 | # to use in a C #if condition. abi-includes may be defined to a list of | |
1065 | # headers to include in the generated header, if the default does not | |
88a4576f JM |
1066 | # suffice. default-abi is defined to be the ABI for the current glibc |
1067 | # build. | |
0ab0291b L |
1068 | |
1069 | ifndef abi-includes | |
1070 | abi-includes := bits/wordsize.h | |
1071 | endif | |
1072 | ||
4de1d597 RM |
1073 | # Process the shlib-versions file, which tells us what shared library |
1074 | # version numbers to use when we install shared objects on this system. | |
281e6031 UD |
1075 | # We need to wait until $(subdirs) is complete. |
1076 | ifeq ($(sysd-sorted-done),t) | |
4de1d597 | 1077 | -include $(common-objpfx)soversions.mk |
eca3eb3b | 1078 | ifndef avoid-generated |
9632aaee RM |
1079 | # This lets add-ons give more-specific matches that override defaults |
1080 | # in the top-level file. | |
f3787738 | 1081 | $(common-objpfx)shlib-versions.v.i: \ |
e0a3ed4f RM |
1082 | $(wildcard $(+sysdep_dirs:=/shlib-versions) \ |
1083 | $(subdir-srcdirs:=/shlib-versions)) \ | |
9632aaee | 1084 | $(..)shlib-versions |
6d864d15 | 1085 | |
6d864d15 RM |
1086 | $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \ |
1087 | $(common-objpfx)shlib-versions.v | |
af296fcd | 1088 | $(AWK) -f $^ > $@T |
ba7e89ec | 1089 | mv -f $@T $@ |
3e1e123d | 1090 | $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig |
0ab0291b | 1091 | (while read which lib number setname; do \ |
3e1e123d | 1092 | eval seen_$$which=1; \ |
91adb529 | 1093 | test x"$$which" = xDEFAULT || continue; \ |
1bc777b8 UD |
1094 | case $$number in \ |
1095 | [0-9]*) echo "$$lib.so-version=.$$number"; \ | |
1096 | echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\ | |
93ae1eba | 1097 | *) echo "$$lib.so-version=$$number"; \ |
1bc777b8 UD |
1098 | echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\ |
1099 | esac; \ | |
1100 | done; \ | |
1101 | echo soversions.mk-done = t;) < $< > $@T; exit 0 | |
4de1d597 | 1102 | mv -f $@T $@ |
eca3eb3b | 1103 | endif |
281e6031 | 1104 | endif |
eca3eb3b | 1105 | |
f3787738 RM |
1106 | postclean-generated += soversions.mk soversions.i \ |
1107 | shlib-versions.v shlib-versions.v.i | |
4de1d597 | 1108 | |
130ac68c | 1109 | before-compile += $(common-objpfx)libc-modules.h |
65b6d8b7 | 1110 | common-generated += libc-modules.h libc-modules.stmp |
130ac68c SP |
1111 | ifeq ($(soversions.mk-done),t) |
1112 | # Generate a header with macro definitions for use with the IS_IN macro. | |
279bc5b3 | 1113 | # These are the possible values for the MODULE_NAME macro defined when building |
130ac68c SP |
1114 | # sources, to identify which module the translation unit is going to be built |
1115 | # into. | |
1116 | $(common-objpfx)libc-modules.h: $(common-objpfx)libc-modules.stmp; @: | |
1117 | $(common-objpfx)libc-modules.stmp: $(..)scripts/gen-libc-modules.awk \ | |
1118 | $(common-objpfx)soversions.i | |
1119 | $(AWK) -v buildlist="$(subst -,_,$(built-modules))" -f $^ > ${@:stmp=T} | |
1120 | $(move-if-change) ${@:stmp=T} ${@:stmp=h} | |
1121 | touch $@ | |
1122 | ||
1123 | endif | |
1124 | ||
67e58f39 SP |
1125 | # Build the tunables list header early since it could be used by any module in |
1126 | # glibc. | |
6765d5d3 | 1127 | ifneq (no,$(have-tunables)) |
67e58f39 | 1128 | before-compile += $(common-objpfx)dl-tunable-list.h |
65b6d8b7 ZW |
1129 | common-generated += dl-tunable-list.h dl-tunable-list.stmp |
1130 | ||
1131 | $(common-objpfx)dl-tunable-list.h: $(common-objpfx)dl-tunable-list.stmp; @: | |
1132 | $(common-objpfx)dl-tunable-list.stmp: \ | |
1133 | $(..)scripts/gen-tunables.awk \ | |
1134 | $(..)elf/dl-tunables.list \ | |
1135 | $(wildcard $(subdirs:%=$(..)%/dl-tunables.list)) \ | |
1136 | $(wildcard $(sysdirs:%=%/dl-tunables.list)) | |
1137 | $(AWK) -f $^ > ${@:stmp=T} | |
1138 | $(move-if-change) ${@:stmp=T} ${@:stmp=h} | |
1139 | touch $@ | |
67e58f39 SP |
1140 | endif |
1141 | ||
d41c6f61 UD |
1142 | # The name under which the run-time dynamic linker is installed. |
1143 | # We are currently going for the convention that `/lib/ld.so.1' | |
1144 | # names the SVR4/ELF ABI-compliant dynamic linker. | |
1145 | ifndef rtld-installed-name | |
1146 | ifdef ld.so-version | |
1147 | rtld-installed-name = $(ld.so-version) | |
1148 | else | |
1149 | rtld-installed-name = ld.so.1 | |
1150 | endif | |
1151 | endif | |
1152 | ||
1ef32c3d UD |
1153 | ifndef rtld-version-installed-name |
1154 | rtld-version-installed-name = ld-$(version).so | |
1155 | endif | |
1156 | ||
f649c201 UD |
1157 | endif # build-shared |
1158 | ||
cbdee279 | 1159 | |
94e365c6 UD |
1160 | ifeq ($(build-shared),yes) |
1161 | libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version) | |
1162 | else | |
1163 | libdl = $(common-objpfx)dlfcn/libdl.a | |
1164 | endif | |
94e365c6 | 1165 | |
6ee65ed6 UD |
1166 | ifeq ($(build-shared),yes) |
1167 | libm = $(common-objpfx)math/libm.so$(libm.so-version) | |
5695d46f | 1168 | libmvec = $(common-objpfx)mathvec/libmvec.so$(libmvec.so-version) |
6ee65ed6 UD |
1169 | else |
1170 | libm = $(common-objpfx)math/libm.a | |
5695d46f | 1171 | libmvec = $(common-objpfx)mathvec/libmvec.a |
6ee65ed6 UD |
1172 | endif |
1173 | ||
c23de0aa FW |
1174 | ifeq ($(build-shared),yes) |
1175 | libsupport = $(common-objpfx)support/libsupport_nonshared.a | |
1176 | else | |
1177 | libsupport = $(common-objpfx)support/libsupport.a | |
1178 | endif | |
1179 | ||
bb41a976 UD |
1180 | # These are the subdirectories containing the library source. The order |
1181 | # is more or less arbitrary. The sorting step will take care of the | |
e0a3ed4f | 1182 | # dependencies. |
8d6f1731 | 1183 | all-subdirs = csu assert ctype locale intl catgets math setjmp signal \ |
e0a3ed4f | 1184 | stdlib stdio-common libio malloc string wcsmbs time dirent \ |
b0b67c47 | 1185 | grp pwd posix io termios resource misc socket sysvipc gmon \ |
829fea46 | 1186 | gnulib iconv iconvdata wctype manual shadow gshadow po argp \ |
c23de0aa | 1187 | crypt localedata timezone rt conform debug mathvec support \ |
c10f90dc | 1188 | $(add-on-subdirs) dlfcn elf |
b22fc5f5 | 1189 | |
b7e2d9a5 | 1190 | ifndef avoid-generated |
7bd642f5 RM |
1191 | # sysd-sorted itself will contain rules making the sysd-sorted target |
1192 | # depend on Depend files. But if you just added a Depend file to an | |
1193 | # existing directory not in all-subdirs, then sysd-sorted needs to | |
1194 | # be regenerated, so it depends on existing $(sorted-subdirs:=/Depend) files. | |
1195 | all-Depend-files := $(wildcard $(sort \ | |
95afbbe5 | 1196 | $(foreach dir,$(all-subdirs),\ |
7bd642f5 RM |
1197 | $(firstword $($(dir)-srcdir) \ |
1198 | $(..)$(dir))/Depend) \ | |
1199 | $(sorted-subdirs:=/Depend))) | |
e0a3ed4f RM |
1200 | $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \ |
1201 | $(common-objpfx)config.make $(..)Makeconfig \ | |
1202 | $(wildcard $(sysdirs:=/Subdirs)) \ | |
1203 | $(all-Depend-files) | |
1204 | $(AWK) -f $< \ | |
1205 | -v subdirs='$(all-subdirs)' \ | |
1206 | -v srcpfx='$(..)' \ | |
1207 | $(filter %/Subdirs %/Depend,$^) > $@-tmp | |
bb41a976 | 1208 | mv -f $@-tmp $@ |
9de06f3c | 1209 | $(all-Depend-files): ; |
b7e2d9a5 | 1210 | endif |
bb41a976 | 1211 | |
16cd816f RM |
1212 | # This gives partial TARGET:SOURCE pattern pairs to have rules |
1213 | # emitted into sysd-rules. A sysdeps Makeconfig fragment can | |
1214 | # add its own special object file prefix to this list with e.g. foo-%:% | |
1215 | # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS). | |
bc96fbda | 1216 | sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_% |
16cd816f | 1217 | |
083973f3 | 1218 | # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here. |
e0a3ed4f | 1219 | sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig)) |
083973f3 | 1220 | ifneq (,$(sysdep-makeconfigs)) |
e0a3ed4f | 1221 | include $(sysdep-makeconfigs) |
083973f3 RM |
1222 | endif |
1223 | ||
363a641b | 1224 | # Compute just the target patterns. Makeconfig has set sysd-rules-patterns. |
bc96fbda AS |
1225 | sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\ |
1226 | $(firstword $(subst :, ,$p)))) | |
083973f3 | 1227 | |
c75ccd4c RM |
1228 | # A sysdeps Makeconfig fragment may set libc-reentrant to yes. |
1229 | ifeq (yes,$(libc-reentrant)) | |
1230 | defines += -D_LIBC_REENTRANT | |
1231 | ||
1232 | libio-mtsafe = -D_IO_MTSAFE_IO | |
1233 | endif | |
1234 | ||
591aeaf7 TD |
1235 | # The name to give to a test in test results summaries. |
1236 | test-name = $(strip $(patsubst %.out, %, $(patsubst $(common-objpfx)%, %, $@))) | |
1237 | ||
54ee292d JM |
1238 | # Likewise, in XFAIL variable names. |
1239 | test-xfail-name = $(strip $(patsubst %.out, %, $(patsubst $(objpfx)%, %, $@))) | |
1240 | ||
f8c17e79 | 1241 | # Command to output a test status line (such as PASS: test-name). If |
54ee292d | 1242 | # test-xfail-$(test-xfail-name) has a nonempty value, the status will be |
f8c17e79 | 1243 | # XPASS or XFAIL rather than PASS or FAIL. |
591aeaf7 | 1244 | evaluate-test = $(..)scripts/evaluate-test.sh $(test-name) $$? \ |
54ee292d | 1245 | $(if $(test-xfail-$(test-xfail-name)),true,false) \ |
d6fe5e58 | 1246 | $(if $(stop-on-test-failure),true,false) \ |
591aeaf7 TD |
1247 | > $(common-objpfx)$(test-name).test-result |
1248 | ||
28f540f4 | 1249 | endif # Makeconfig not yet included |
c238ecf7 UD |
1250 | |
1251 | # Local Variables: | |
1252 | # mode: makefile | |
1253 | # End: |