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