]>
Commit | Line | Data |
---|---|---|
bdeba135 | 1 | # Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 |
16cd816f | 2 | # Free Software Foundation, Inc. |
28f540f4 RM |
3 | # This file is part of the GNU C Library. |
4 | ||
5 | # The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
6 | # modify it under the terms of the GNU Lesser General Public |
7 | # License as published by the Free Software Foundation; either | |
8 | # version 2.1 of the License, or (at your option) any later version. | |
28f540f4 RM |
9 | |
10 | # The GNU C Library is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 13 | # Lesser General Public License for more details. |
28f540f4 | 14 | |
41bdb6e2 AJ |
15 | # You should have received a copy of the GNU Lesser General Public |
16 | # License along with the GNU C Library; if not, write to the Free | |
17 | # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | # 02111-1307 USA. | |
28f540f4 RM |
19 | |
20 | # | |
21 | # Makefile configuration options for the GNU C library. | |
22 | # | |
23 | ifneq (,) | |
24 | This makefile requires GNU Make. | |
25 | endif | |
26 | ||
3e5f5557 UD |
27 | all: # Make this the default goal |
28 | ||
28f540f4 RM |
29 | ifneq "$(origin +included-Makeconfig)" "file" |
30 | ||
31 | +included-Makeconfig := yes | |
32 | ||
33 | ifdef subdir | |
34 | .. := ../ | |
35 | endif | |
36 | ||
37 | # If config.make exists, the source directory was configured, | |
38 | # so don't try to be clever and find another directory to build in. | |
39 | ifneq (,$(wildcard $(..)config.make)) | |
40 | ARCH = | |
41 | machine = | |
42 | else # Not configured. | |
43 | ifndef ARCH | |
44 | ifdef machine | |
45 | ARCH = $(machine) | |
46 | endif # machine | |
47 | endif # ARCH | |
48 | endif # config.make | |
49 | ||
50 | # Directory for object files and libc.a. If this is not defined, the | |
51 | # object files live in the subdirectories where their sources live, and | |
52 | # libc.a lives in the parent directory (this probably doesn't work any | |
53 | # more). | |
54 | ifdef ARCH | |
55 | ifeq ($(filter /%,$(ARCH)),) | |
56 | objdir := $(..)$(ARCH) | |
57 | else | |
58 | objdir = $(ARCH) | |
59 | endif | |
60 | endif | |
61 | ||
094bacdb | 62 | # $(common-objdir) is the place to put objects and |
28f540f4 RM |
63 | # such that are not specific to a single subdir. |
64 | ifdef objdir | |
6e953631 UD |
65 | objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/) |
66 | common-objpfx = $(objdir)/ | |
28f540f4 RM |
67 | common-objdir = $(objdir) |
68 | else | |
69 | objpfx := | |
70 | ifdef .. | |
71 | common-objpfx = $(..) | |
72 | common-objdir = .. | |
73 | else | |
74 | # This is a kludge. make wizards might grok. | |
75 | common-objpfx = sysdeps/../ | |
76 | common-objdir = . | |
77 | endif | |
78 | endif | |
79 | ||
f332db02 RM |
80 | # Root of the sysdeps tree. |
81 | sysdep_dir := $(..)sysdeps | |
82 | export sysdep_dir := $(sysdep_dir) | |
83 | ||
28f540f4 RM |
84 | # Get the values defined by options to `configure'. |
85 | include $(common-objpfx)config.make | |
86 | ||
e07bb02a UD |
87 | # What flags to give to sources which call user provided callbacks |
88 | uses-callbacks = $(exceptions) | |
89 | ||
a4db3439 UD |
90 | # What flags to give to tests which test stack alignment |
91 | stack-align-test-flags = | |
92 | ||
0501d603 UD |
93 | # We have a special subdir for each binary format. |
94 | # For now, only ELF is fully supported. | |
95 | ifeq ($(elf),yes) | |
96 | binfmt-subdir = elf | |
97 | else | |
0a54e401 UD |
98 | # This is probably better than nothing. |
99 | binfmt-subdir = aout | |
0501d603 UD |
100 | endif |
101 | ||
57ba7bb4 | 102 | # Complete path to sysdep dirs. |
e0a3ed4f RM |
103 | # `configure' writes a definition of `config-sysdirs' in `config.make'. |
104 | sysdirs := $(foreach D,$(config-sysdirs),$(firstword $(filter /%,$D) $(..)$D)) | |
105 | ||
106 | # Add-ons that contribute sysdeps trees get added to the include list | |
107 | # after sysdeps/generic. This makes #include <sysdeps/...> work right | |
108 | # to find specific add-on files without assuming the add-on directory name. | |
109 | # It also means that headers can go into an add-on's base directory | |
110 | # instead of the add-on needing a sysdeps/generic of its own. | |
04dca8d3 RM |
111 | sysdeps-srcdirs := $(foreach add-on,$(sysdeps-add-ons),\ |
112 | $(firstword $(filter /%,$(add-on)) \ | |
113 | $(..)$(add-on))) | |
114 | +sysdep_dirs = $(sysdirs) $(sysdeps-srcdirs) | |
e0a3ed4f RM |
115 | ifdef objdir |
116 | +sysdep_dirs := $(objdir) $(+sysdep_dirs) | |
117 | endif | |
57ba7bb4 | 118 | |
273d56ce RM |
119 | # Run config.status to update config.make and config.h. We don't show the |
120 | # dependence of config.h to Make, because it is only touched when it | |
121 | # changes and so config.status would be run every time; the dependence of | |
122 | # config.make should suffice to force regeneration and re-exec, and the new | |
123 | # image will notice if config.h changed. | |
19361cb7 UD |
124 | $(common-objpfx)config.make: $(common-objpfx)config.status \ |
125 | $(..)config.make.in $(..)config.h.in | |
273d56ce RM |
126 | cd $(<D); $(SHELL) $(<F) |
127 | ||
8f73811b RM |
128 | # Find all the add-on and sysdeps configure fragments, to make sure we |
129 | # re-run configure when any of them changes. | |
5290baf0 | 130 | $(common-objpfx)config.status: $(..)version.h $(..)configure \ |
e0a3ed4f RM |
131 | $(foreach dir,$(sysdirs),\ |
132 | $(wildcard $(dir)/Implies) \ | |
f332db02 RM |
133 | $(patsubst %.in,%,\ |
134 | $(firstword $(wildcard \ | |
8f73811b RM |
135 | $(addprefix $(dir)/,configure configure.in))))) \ |
136 | $(patsubst %.in,%,\ | |
e0a3ed4f | 137 | $(foreach add-on,$(add-ons),\ |
8f73811b | 138 | $(firstword $(wildcard \ |
e0a3ed4f RM |
139 | $(addprefix $(firstword $(filter /%,$(add-on)) $(..)$(add-on))/,\ |
140 | configure configure.in))))) | |
273d56ce RM |
141 | @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \ |
142 | echo The GNU C library has not been configured. >&2; \ | |
143 | echo Run \`configure\' to configure it before building. >&2; \ | |
144 | echo Try \`configure --help\' for more details. >&2; \ | |
145 | exit 1; fi | |
28f540f4 | 146 | |
74015205 UD |
147 | # We don't want CPPFLAGS to be exported to the command running configure. |
148 | unexport CPPFLAGS | |
149 | ||
28f540f4 RM |
150 | # Get the user's configuration parameters. |
151 | ifneq ($(wildcard $(..)configparms),) | |
152 | include $(..)configparms | |
153 | endif | |
154 | ifneq ($(objpfx),) | |
6e953631 UD |
155 | ifneq ($(wildcard $(common-objpfx)configparms),) |
156 | include $(common-objpfx)configparms | |
28f540f4 RM |
157 | endif |
158 | endif | |
28f540f4 RM |
159 | \f |
160 | #### | |
161 | #### These are the configuration variables. You can define values for | |
162 | #### the variables below in the file `configparms'. | |
163 | #### Do NOT edit this file. | |
164 | #### | |
165 | ||
166 | ||
167 | # Common prefix for machine-independent installation directories. | |
487253ea | 168 | ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value. |
28f540f4 RM |
169 | prefix = /usr/local |
170 | endif | |
171 | ||
0413b54c UD |
172 | # Decide whether we shall build the programs or not. We always do this |
173 | # unless the user tells us (in configparms) or we are building for a | |
174 | # standalone target. | |
175 | ifndef build-programs | |
176 | ifneq ($(config-os),none) | |
177 | build-programs=yes | |
178 | else | |
179 | build-programs=no | |
180 | endif | |
181 | endif | |
182 | ||
28f540f4 | 183 | # Common prefix for machine-dependent installation directories. |
487253ea | 184 | ifeq ($(origin exec_prefix),undefined) |
28f540f4 RM |
185 | exec_prefix = $(prefix) |
186 | endif | |
187 | ||
188 | # Where to install the library and object files. | |
189 | ifndef libdir | |
190 | libdir = $(exec_prefix)/lib | |
191 | endif | |
8d57beea | 192 | inst_libdir = $(install_root)$(libdir) |
28f540f4 | 193 | |
094bacdb RM |
194 | # Where to install the shared library and dynamic linker. |
195 | ifndef slibdir | |
196 | slibdir = $(exec_prefix)/lib | |
197 | endif | |
8d57beea | 198 | inst_slibdir = $(install_root)$(slibdir) |
094bacdb | 199 | |
28f540f4 RM |
200 | # Prefix to put on files installed in $(libdir). For libraries `libNAME.a', |
201 | # the prefix is spliced between `lib' and the name, so the linker switch | |
202 | # `-l$(libprefix)NAME' finds the library; for other files the prefix is | |
203 | # just prepended to the whole file name. | |
487253ea | 204 | ifeq ($(origin libprefix),undefined) |
28f540f4 RM |
205 | libprefix = |
206 | endif | |
207 | ||
208 | # Where to install the header files. | |
209 | ifndef includedir | |
25c751d0 | 210 | includedir = $(prefix)/include |
28f540f4 | 211 | endif |
8d57beea | 212 | inst_includedir = $(install_root)$(includedir) |
28f540f4 | 213 | |
28f540f4 | 214 | # Where to install machine-independent data files. |
a2fe9c76 | 215 | # These are the timezone database, and the locale database. |
28f540f4 RM |
216 | ifndef datadir |
217 | datadir = $(prefix)/share | |
218 | endif | |
8d57beea | 219 | inst_datadir = $(install_root)$(datadir) |
28f540f4 RM |
220 | |
221 | # Where to install the timezone data files (which are machine-independent). | |
222 | ifndef zonedir | |
223 | zonedir = $(datadir)/zoneinfo | |
224 | endif | |
8d57beea | 225 | inst_zonedir = $(install_root)$(zonedir) |
28f540f4 | 226 | |
4a33c2f5 | 227 | # Where to install the locale files. |
a2fe9c76 | 228 | ifndef localedir |
4a33c2f5 | 229 | localedir = $(libdir)/locale |
a2fe9c76 | 230 | endif |
8d57beea | 231 | inst_localedir = $(install_root)$(localedir) |
a2fe9c76 | 232 | |
4a33c2f5 UD |
233 | # Where to install the message catalog data files (which are |
234 | # machine-independent). | |
235 | ifndef msgcatdir | |
236 | msgcatdir = $(datadir)/locale | |
237 | endif | |
238 | inst_msgcatdir = $(install_root)$(msgcatdir) | |
239 | ||
3ec41e03 | 240 | # Where to install the locale charmap source files. |
19bc17a9 RM |
241 | ifndef i18ndir |
242 | i18ndir = $(datadir)/i18n | |
a2fe9c76 | 243 | endif |
8d57beea | 244 | inst_i18ndir = $(install_root)$(i18ndir) |
a2fe9c76 | 245 | |
6973fc01 UD |
246 | # Where to install the shared object for charset transformation. |
247 | ifndef gconvdir | |
248 | gconvdir = $(libdir)/gconv | |
249 | endif | |
250 | inst_gconvdir = $(install_root)$(gconvdir) | |
251 | ||
28f540f4 RM |
252 | # Where to install programs. |
253 | ifndef bindir | |
254 | bindir = $(exec_prefix)/bin | |
255 | endif | |
8d57beea | 256 | inst_bindir = $(install_root)$(bindir) |
28f540f4 | 257 | |
7f0ff1b0 UD |
258 | # Where to install internal programs. |
259 | ifndef libexecdir | |
260 | libexecdir = $(exec_prefix)/libexec | |
261 | endif | |
262 | inst_libexecdir = $(install_root)$(libexecdir) | |
263 | ||
28f540f4 | 264 | # Where to install administrative programs. |
1ef32c3d UD |
265 | ifndef rootsbindir |
266 | rootsbindir = $(exec_prefix)/sbin | |
267 | endif | |
8d57beea | 268 | inst_rootsbindir = $(install_root)$(rootsbindir) |
1ef32c3d | 269 | |
28f540f4 RM |
270 | ifndef sbindir |
271 | sbindir = $(exec_prefix)/sbin | |
272 | endif | |
8d57beea | 273 | inst_sbindir = $(install_root)$(sbindir) |
28f540f4 RM |
274 | |
275 | # Where to install the Info files. | |
276 | ifndef infodir | |
277 | infodir = $(prefix)/info | |
278 | endif | |
8d57beea | 279 | inst_infodir = $(install_root)$(infodir) |
28f540f4 | 280 | |
a9171047 UD |
281 | # Where to install audit libraries. |
282 | ifndef auditdir | |
283 | auditdir = $(libdir)/audit | |
284 | endif | |
285 | inst_auditdir = $(install_root)$(auditdir) | |
286 | ||
28f540f4 RM |
287 | # Where to install default configuration files. These include the local |
288 | # timezone specification and network data base files. | |
289 | ifndef sysconfdir | |
290 | sysconfdir = $(prefix)/etc | |
291 | endif | |
8d57beea | 292 | inst_sysconfdir = $(install_root)$(sysconfdir) |
28f540f4 | 293 | |
77fb9117 UD |
294 | # Directory for the database files and Makefile for nss_db. |
295 | ifndef vardbdir | |
296 | vardbdir = /var/db | |
297 | endif | |
298 | inst_vardbdir = $(install_root)$(vardbdir) | |
299 | ||
28f540f4 RM |
300 | # What timezone should be the installed default (e.g., US/Eastern). |
301 | # Run `make -C time echo-zonenames' to see a list of available zone names. | |
302 | # The local timezone can be changed with `zic -l TIMEZONE' at any time. | |
303 | ifndef localtime | |
304 | localtime = Factory | |
305 | endif | |
306 | ||
307 | # Where to install the "localtime" timezone file; this is the file whose | |
308 | # contents $(localtime) specifies. If this is a relative pathname, it is | |
309 | # relative to $(zonedir). It is a good idea to put this somewhere | |
310 | # other than there, so the zoneinfo directory contains only universal data, | |
311 | # localizing the configuration data elsewhere. | |
312 | ifndef localtime-file | |
0d8733c4 UD |
313 | localtime-file = $(sysconfdir)/localtime |
314 | inst_localtime-file = $(install_root)$(localtime-file) | |
28f540f4 RM |
315 | endif |
316 | ||
59dd8641 RM |
317 | # What to use for leap second specifications in compiling the default |
318 | # timezone files. Set this to `/dev/null' for no leap second handling as | |
319 | # 1003.1 requires, or to `leapseconds' for proper leap second handling. | |
320 | # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'. | |
321 | # This variable determines the default: if it's `/dev/null', | |
322 | # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE. | |
323 | ifndef leapseconds | |
324 | leapseconds = /dev/null | |
325 | endif | |
326 | ||
28f540f4 RM |
327 | # What timezone's DST rules should be used when a POSIX-style TZ |
328 | # environment variable doesn't specify any rules. For 1003.1 compliance | |
329 | # this timezone must use rules that are as U.S. federal law defines DST. | |
330 | # Run `make -C time echo-zonenames' to see a list of available zone names. | |
331 | # This setting can be changed with `zic -p TIMEZONE' at any time. | |
332 | # If you want POSIX.1 compatibility, use `America/New_York'. | |
333 | ifndef posixrules | |
334 | posixrules = America/New_York | |
335 | endif | |
336 | ||
337 | # Where to install the "posixrules" timezone file; this is file | |
338 | # whose contents $(posixrules) specifies. If this is a relative | |
339 | # pathname, it is relative to $(zonedir). | |
340 | ifndef posixrules-file | |
341 | posixrules-file = posixrules | |
342 | endif | |
343 | ||
344 | ||
345 | # Directory where your system's native header files live. | |
346 | # This is used on Unix systems to generate some GNU libc header files. | |
347 | ifndef sysincludedir | |
348 | sysincludedir = /usr/include | |
349 | endif | |
350 | ||
351 | ||
352 | # Commands to install files. | |
353 | ifndef INSTALL_DATA | |
354 | INSTALL_DATA = $(INSTALL) -m 644 | |
355 | endif | |
07627f49 UD |
356 | ifndef INSTALL_SCRIPT |
357 | INSTALL_SCRIPT = $(INSTALL) | |
358 | endif | |
28f540f4 RM |
359 | ifndef INSTALL_PROGRAM |
360 | INSTALL_PROGRAM = $(INSTALL) | |
361 | endif | |
362 | ifndef INSTALL | |
363 | INSTALL = install | |
364 | endif | |
365 | ||
366 | ||
367 | # The name of the C compiler. | |
368 | # If you've got GCC, and it works, use it. | |
369 | ifeq ($(origin CC),default) | |
370 | CC := gcc | |
371 | endif | |
372 | ||
373 | # The name of the C compiler to use for compilations of programs to run on | |
374 | # the host that is building the library. If you set CC to a | |
375 | # cross-compiler, you must set this to the normal compiler. | |
376 | ifndef BUILD_CC | |
377 | BUILD_CC = $(CC) | |
378 | endif | |
379 | ||
380 | # Default flags to pass the C compiler. | |
381 | ifndef default_cflags | |
1d5c2feb UD |
382 | ifeq ($(release),stable) |
383 | default_cflags := -g -O2 | |
384 | else | |
a8922de8 | 385 | default_cflags := -g -O |
28f540f4 | 386 | endif |
1d5c2feb | 387 | endif |
28f540f4 RM |
388 | |
389 | # Flags to pass the C compiler when assembling preprocessed assembly code | |
390 | # (`.S' files). On some systems the assembler doesn't understand the `#' line | |
391 | # directives the preprocessor produces. If you have troubling compiling | |
392 | # assembly code, try using -P here to suppress these directives. | |
393 | ifndef asm-CPPFLAGS | |
394 | asm-CPPFLAGS = | |
395 | endif | |
396 | ||
9a0a462c UD |
397 | # ELF always supports init/fini sections |
398 | ifeq ($(elf),yes) | |
399 | have-initfini = yes | |
400 | endif | |
401 | ||
7e2b0c85 RM |
402 | ifeq ($(have-as-needed),yes) |
403 | as-needed := -Wl,--as-needed | |
404 | no-as-needed := -Wl,--no-as-needed | |
405 | else | |
406 | as-needed := | |
407 | no-as-needed := | |
408 | endif | |
409 | ||
3ce1f295 UD |
410 | # Must be supported by the linker. |
411 | no-whole-archive = -Wl,--no-whole-archive | |
412 | whole-archive = -Wl,--whole-archive | |
413 | ||
779ae82e | 414 | # Installed name of the startup code. |
9a0a462c UD |
415 | ifneq ($(have-initfini),yes) |
416 | # When not having init/fini, there is just one startfile, called crt0.o. | |
779ae82e UD |
417 | start-installed-name = crt0.o |
418 | else | |
9a0a462c | 419 | # On systems having init/fini, crt0.o is called crt1.o, and there are |
779ae82e UD |
420 | # some additional bizarre files. |
421 | start-installed-name = crt1.o | |
779ae82e | 422 | endif |
af09bfb5 RM |
423 | # On systems that do not need a special startfile for statically linked |
424 | # binaries, simply set it to the normal name. | |
425 | ifndef static-start-installed-name | |
426 | static-start-installed-name = $(start-installed-name) | |
427 | endif | |
779ae82e | 428 | |
f13df7c7 UD |
429 | ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc)) |
430 | combreloc-LDFLAGS = -Wl,-z,combreloc | |
431 | LDFLAGS.so += $(combreloc-LDFLAGS) | |
432 | LDFLAGS-rtld += $(combreloc-LDFLAGS) | |
433 | endif | |
434 | ||
1c563add UD |
435 | relro-LDFLAGS = -Wl,-z,relro |
436 | LDFLAGS.so += $(relro-LDFLAGS) | |
437 | LDFLAGS-rtld += $(relro-LDFLAGS) | |
1c563add | 438 | |
871b9158 UD |
439 | ifeq (yes,$(have-hash-style)) |
440 | # For the time being we unconditionally use 'both'. At some time we | |
441 | # should declare statically linked code as 'out of luck' and compile | |
442 | # with --hash-style=gnu only. | |
443 | hashstyle-LDFLAGS = -Wl,--hash-style=both | |
444 | LDFLAGS.so += $(hashstyle-LDFLAGS) | |
445 | LDFLAGS-rtld += $(hashstyle-LDFLAGS) | |
446 | endif | |
447 | ||
28f540f4 RM |
448 | # Command for linking programs with the C library. |
449 | ifndef +link | |
8e3cc80f | 450 | +link = $(CC) -nostdlib -nostartfiles -o $@ \ |
482eec0d | 451 | $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
871b9158 | 452 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ |
779ae82e UD |
453 | $(addprefix $(csu-objpfx),$(start-installed-name)) \ |
454 | $(+preinit) $(+prector) \ | |
455 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
456 | $(start-installed-name))\ | |
457 | $(+preinit) $(link-extra-libs) \ | |
458 | $(common-objpfx)libc% $(+postinit),$^) \ | |
5ae9d168 | 459 | $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) |
28f540f4 | 460 | endif |
435aa54b L |
461 | # Command for linking PIE programs with the C library. |
462 | ifndef +link-pie | |
463 | +link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ | |
464 | $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ | |
465 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ | |
466 | $(addprefix $(csu-objpfx),S$(start-installed-name)) \ | |
467 | $(+preinit) $(+prectorS) \ | |
468 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
da62f81b AS |
469 | S$(start-installed-name))\ |
470 | $(+preinit) $(link-extra-libs) \ | |
471 | $(common-objpfx)libc% $(+postinit),$^) \ | |
435aa54b L |
472 | $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit) |
473 | endif | |
e1586792 UD |
474 | # Command for statically linking programs with the C library. |
475 | ifndef +link-static | |
476 | +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ | |
9f0d7b6d | 477 | $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
af09bfb5 | 478 | $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ |
e1586792 UD |
479 | $(+preinit) $(+prector) \ |
480 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
481 | $(start-installed-name))\ | |
482 | $(+preinit) $(link-extra-libs-static) \ | |
483 | $(common-objpfx)libc% $(+postinit),$^) \ | |
484 | $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) | |
485 | endif | |
ac556388 GM |
486 | # Command for statically linking bounded-pointer programs with the C library. |
487 | ifndef +link-bounded | |
488 | +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \ | |
489 | $(sysdep-LDFLAGS) $(LDFLAGS) \ | |
490 | $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \ | |
491 | $(+preinit) $(+prector) \ | |
4362aba5 | 492 | $(filter-out $(addprefix $(csu-objpfx),start.ob \ |
ac556388 GM |
493 | $(start-installed-name))\ |
494 | $(+preinit) $(link-extra-libs-bounded) \ | |
495 | $(common-objpfx)libc% $(+postinit),$^) \ | |
496 | $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit) | |
497 | endif | |
b122c703 | 498 | ifndef config-LDFLAGS |
994431ed | 499 | ifeq (yesyes,$(build-shared)$(elf)) |
094bacdb | 500 | config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name) |
b122c703 RM |
501 | endif |
502 | endif | |
3fe9de0d RM |
503 | ifndef link-libc |
504 | ifeq (yes,$(build-shared)) | |
ad10cac8 | 505 | ifeq ($(elf),yes) |
aa1075ea RM |
506 | # We need the versioned name of libc.so in the deps of $(others) et al |
507 | # so that the symlink to libc.so is created before anything tries to | |
508 | # run the linked programs. | |
4d6acc61 | 509 | link-libc = -Wl,-rpath-link=$(rpath-link) \ |
aa1075ea | 510 | $(common-objpfx)libc.so$(libc.so-version) \ |
7e2b0c85 RM |
511 | $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ |
512 | $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) | |
4d6acc61 | 513 | # This is how to find at build-time things that will be installed there. |
b11f5954 | 514 | rpath-dirs = math elf dlfcn nss nis rt resolv crypt |
ad10cac8 | 515 | endif |
e72bfd87 UD |
516 | rpath-link = \ |
517 | $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) | |
47707456 | 518 | elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) |
3fe9de0d | 519 | else |
ce85d65b UD |
520 | nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) |
521 | resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) | |
4ac5087b | 522 | link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) |
3fe9de0d RM |
523 | endif |
524 | endif | |
900bec85 | 525 | |
ad10cac8 UD |
526 | # Differences in the linkers on the various platforms. |
527 | ifeq ($(elf),yes) | |
528 | LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN' | |
529 | LDFLAGS-soname-fname = -Wl,-soname,$(@F) | |
530 | LDFLAGS-rdynamic = -rdynamic | |
531 | LDFLAGS-Bsymbolic = -Bsymbolic | |
ad10cac8 UD |
532 | endif |
533 | ||
f01010de UD |
534 | # Choose the default search path for the dynamic linker based on |
535 | # where we will install libraries. | |
536 | ifneq ($(libdir),$(slibdir)) | |
537 | default-rpath = $(slibdir):$(libdir) | |
538 | else | |
539 | default-rpath = $(libdir) | |
540 | endif | |
541 | ||
57ba7bb4 | 542 | ifndef link-extra-libs |
1d038b6b RM |
543 | link-extra-libs = $(LDLIBS-$(@F)) |
544 | link-extra-libs-static = $(link-extra-libs) | |
545 | link-extra-libs-bounded = $(link-extra-libs) | |
57ba7bb4 | 546 | endif |
e1586792 UD |
547 | |
548 | # The static libraries. | |
66000494 | 549 | ifeq (yes,$(build-static)) |
b9af1301 | 550 | link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group |
66000494 UD |
551 | else |
552 | ifeq (yes,$(build-shared)) | |
553 | # We can try to link the programs with lib*_pic.a... | |
feca5e0b | 554 | link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a |
66000494 UD |
555 | endif |
556 | endif | |
ac556388 | 557 | link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a |
e1586792 | 558 | |
28f540f4 | 559 | ifndef gnulib |
cbdb12de UD |
560 | ifneq ($(have-cc-with-libunwind),yes) |
561 | libunwind = | |
feca5e0b | 562 | else |
cbdb12de | 563 | libunwind = -lunwind |
feca5e0b | 564 | endif |
cbdb12de UD |
565 | ifneq ($(have-as-needed),yes) |
566 | libgcc_eh := -lgcc_eh $(libunwind) | |
26b30508 | 567 | else |
cbdb12de | 568 | libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed |
26b30508 | 569 | endif |
cbdb12de UD |
570 | gnulib := -lgcc $(libgcc_eh) |
571 | static-gnulib := -lgcc -lgcc_eh $(libunwind) | |
572 | libc.so-gnulib := -lgcc | |
28f540f4 | 573 | endif |
96f873b9 | 574 | ifeq ($(elf),yes) |
e75154a6 RM |
575 | +preinit = $(addprefix $(csu-objpfx),crti.o) |
576 | +postinit = $(addprefix $(csu-objpfx),crtn.o) | |
35e65999 RA |
577 | +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` |
578 | +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` | |
435aa54b | 579 | # Variants of the two previous definitions for linking PIE programs. |
35e65999 RA |
580 | +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` |
581 | +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` | |
66715f83 | 582 | +interp = $(addprefix $(elf-objpfx),interp.os) |
96f873b9 | 583 | endif |
6e953631 UD |
584 | csu-objpfx = $(common-objpfx)csu/ |
585 | elf-objpfx = $(common-objpfx)elf/ | |
28f540f4 | 586 | |
03a75825 RM |
587 | # How to run a program we just linked with our library. |
588 | # The program binary is assumed to be $(word 2,$^). | |
589 | built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^)) | |
ad10cac8 | 590 | ifeq (yesyes,$(build-shared)$(elf)) |
196980f5 | 591 | comma = , |
11336c16 UD |
592 | sysdep-library-path = \ |
593 | $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\ | |
594 | $(filter -Wl$(comma)-rpath-link=%,\ | |
595 | $(sysdep-LDFLAGS))))) | |
27abf7a3 | 596 | run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\ |
ccd8de9a | 597 | $(tests-static) $(xtests-static)),, \ |
85857f93 UD |
598 | $(elf-objpfx)$(rtld-installed-name) \ |
599 | --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))) | |
8658ceda UD |
600 | else |
601 | run-program-prefix = | |
602 | endif | |
ac556388 GM |
603 | # Never use $(run-program-prefix) for the statically-linked %-bp test programs |
604 | built-program-cmd = $(patsubst %,$(run-program-prefix),\ | |
605 | $(filter-out %-bp,$(built-program-file))) \ | |
606 | $(built-program-file) | |
03a75825 | 607 | |
28f540f4 RM |
608 | ifndef LD |
609 | LD := ld -X | |
610 | endif | |
611 | ||
28f540f4 | 612 | # Extra flags to pass to GCC. |
6cc7d725 | 613 | ifeq ($(all-warnings),yes) |
7735afa2 | 614 | +gccwarn := -Wall -Wwrite-strings -Winline -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar |
6cc7d725 | 615 | else |
7735afa2 | 616 | +gccwarn := -Wall -Wwrite-strings -Winline |
6cc7d725 | 617 | endif |
7735afa2 | 618 | +gccwarn-c = -Wstrict-prototypes |
28f540f4 | 619 | |
dec36b4f UD |
620 | # We do not depend on the address of constants in different files to be |
621 | # actually different, so allow the compiler to merge them all. | |
622 | +merge-constants = -fmerge-all-constants | |
623 | ||
30077d51 RM |
624 | # This is the program that generates makefile dependencies from C source files. |
625 | # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy | |
626 | # targets for headers so that removed headers don't break the build. | |
28f540f4 | 627 | ifndef +mkdep |
30077d51 | 628 | +mkdep = $(CC) -M -MP |
28f540f4 RM |
629 | endif |
630 | ||
631 | # The program that makes Emacs-style TAGS files. | |
78759725 | 632 | ETAGS := etags |
28f540f4 | 633 | |
9de06f3c RM |
634 | # The `xgettext' program for producing .pot files from sources. |
635 | ifndef XGETTEXT | |
636 | XGETTEXT = xgettext | |
637 | endif | |
638 | ||
28f540f4 RM |
639 | # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and |
640 | # perhaps others) to preprocess assembly code in some cases. | |
641 | M4 = m4 | |
642 | ||
73237de3 UD |
643 | # To force installation of files even if they are older than the |
644 | # installed files. This variable is included in the dependency list | |
645 | # of all installation targets. | |
646 | ifeq ($(force-install),yes) | |
647 | +force = force-install | |
648 | else | |
649 | +force = | |
650 | endif | |
651 | ||
28f540f4 RM |
652 | #### |
653 | #### End of configuration variables. | |
654 | #### | |
655 | \f | |
656 | # This tells some versions of GNU make before 3.63 not to export all variables. | |
657 | .NOEXPORT: | |
658 | ||
659 | # We want to echo the commands we're running without | |
6d52618b | 660 | # umpteen zillion filenames along with it (we use `...' instead) |
28f540f4 RM |
661 | # but we don't want this echoing done when the user has said |
662 | # he doesn't want to see commands echoed by using -s. | |
663 | ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s | |
664 | +cmdecho := echo >/dev/null | |
665 | else # not -s | |
666 | +cmdecho := echo | |
667 | endif # -s | |
668 | ||
669 | # These are the flags given to the compiler to tell | |
670 | # it what sort of optimization and/or debugging output to do. | |
671 | ifndef +cflags | |
672 | # If `CFLAGS' was defined, use that. | |
673 | ifdef CFLAGS | |
674 | +cflags := $(filter-out -I%,$(CFLAGS)) | |
675 | endif # CFLAGS | |
676 | endif # +cflags | |
677 | ||
fd26970f | 678 | # If none of the above worked, default to "-g -O". |
28f540f4 RM |
679 | ifeq "$(strip $(+cflags))" "" |
680 | +cflags := $(default_cflags) | |
681 | endif # $(+cflags) == "" | |
682 | ||
2cf9ad57 | 683 | +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) |
28f540f4 | 684 | +gcc-nowarn := -w |
28f540f4 RM |
685 | |
686 | # Don't duplicate options if we inherited variables from the parent. | |
687 | +cflags := $(sort $(+cflags)) | |
688 | ||
b6ab06ce UD |
689 | # These are flags given to the C compiler to tell it to look for |
690 | # include files (including ones given in angle brackets) in the parent | |
691 | # library source directory, in the include directory, and in the | |
692 | # current directory. | |
e0a3ed4f RM |
693 | +sysdep-includes = $(addprefix -I,$(+sysdep_dirs)) |
694 | +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \ | |
4ae73ca0 RM |
695 | $(+sysdep-includes) $(includes) \ |
696 | $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) | |
28f540f4 | 697 | |
96aa2d94 | 698 | # Since libio has several internal header files, we use a -I instead |
762a2918 | 699 | # of many little headers in the include directory. |
96aa2d94 | 700 | libio-include = -I$(..)libio |
28f540f4 RM |
701 | |
702 | # These are the variables that the implicit compilation rules use. | |
ce460d04 RM |
703 | # Note that we can't use -std=* in CPPFLAGS, because it overrides |
704 | # the implicit -lang-asm and breaks cpp behavior for .S files--notably | |
705 | # it causes cpp to stop predefining __ASSEMBLER__. | |
1c3b002b | 706 | CPPFLAGS = $(CPPFLAGS-config) $($(subdir)-CPPFLAGS) $(+includes) $(defines) \ |
ae8b36f7 | 707 | -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \ |
0a951d0e | 708 | $(CPPFLAGS-$(suffix $@)) \ |
d29724f8 | 709 | $(foreach lib,$(libof-$(basename $(@F))) \ |
bc96fbda | 710 | $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \ |
0a951d0e | 711 | $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) |
b037a293 | 712 | override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \ |
7735afa2 UD |
713 | $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \ |
714 | $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \ | |
44f0a71e UD |
715 | $(CFLAGS-$(@F)) \ |
716 | $(foreach lib,$(libof-$(basename $(@F))) \ | |
717 | $(libof-$(<F)) $(libof-$(@F)),$(CFLAGS-$(lib))) | |
ef226fec RM |
718 | override CXXFLAGS = $(c++-sysincludes) \ |
719 | $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \ | |
7735afa2 | 720 | $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F)) |
28f540f4 | 721 | |
cc3fa755 UD |
722 | # If everything is compiled with -fPIC (implicitly) we must tell this by |
723 | # defining the PIC symbol. | |
724 | ifeq (yes,$(build-pic-default)) | |
725 | pic-default = -DPIC | |
726 | endif | |
727 | ||
f0bf9cb9 RM |
728 | # Enable object files for different versions of the library. |
729 | # Various things use $(object-suffixes) to know what all to make. | |
730 | # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) | |
731 | # to pass different flags for each flavor. | |
91641c65 | 732 | libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) |
a35cb74d | 733 | all-object-suffixes := .o .os .op .og .ob .oS |
650425ce | 734 | object-suffixes := |
cc3fa755 | 735 | CPPFLAGS-.o = $(pic-default) |
14e9dd67 | 736 | CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) |
66000494 | 737 | ifeq (yes,$(build-static)) |
f0bf9cb9 | 738 | libtype.o := lib%.a |
650425ce UD |
739 | object-suffixes += .o |
740 | endif | |
f0bf9cb9 RM |
741 | ifeq (yes,$(build-shared)) |
742 | # Under --enable-shared, we will build a shared library of PIC objects. | |
40a55d20 UD |
743 | # The PIC object files are named foo.os. |
744 | object-suffixes += .os | |
b5567b2a | 745 | CPPFLAGS-.os = -DPIC -DSHARED |
14e9dd67 | 746 | CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag) |
40a55d20 | 747 | libtype.os := lib%_pic.a |
26b4d766 UD |
748 | # This can be changed by a sysdep makefile |
749 | pic-ccflag = -fPIC | |
231e88a4 UD |
750 | # This one should always stay like this unless there is a very good reason. |
751 | PIC-ccflag = -fPIC | |
f0bf9cb9 | 752 | endif |
7b91359b UD |
753 | # This can be changed by a sysdep makefile |
754 | pie-ccflag = -fpie | |
755 | # This one should always stay like this unless there is a very good reason. | |
756 | PIE-ccflag = -fPIE | |
f0bf9cb9 RM |
757 | ifeq (yes,$(build-profile)) |
758 | # Under --enable-profile, we will build a static library of profiled objects. | |
40a55d20 UD |
759 | # The profiled object files are named foo.op. |
760 | object-suffixes += .op | |
cc3fa755 | 761 | CPPFLAGS-.op = -DPROF $(pic-default) |
40a55d20 UD |
762 | CFLAGS-.op = -pg |
763 | libtype.op = lib%_p.a | |
f0bf9cb9 | 764 | endif |
ab95290c UD |
765 | |
766 | bppfx = BP- | |
5a97622d UD |
767 | ifeq (yes,$(build-bounded)) |
768 | # Under --enable-bounded, we build the library with `-fbounded-pointers -g' | |
40a55d20 | 769 | # to runtime bounds checking. The bounded-pointer objects are named foo.ob. |
58ff985d GM |
770 | # We disable sibling-call optimizations so that stack traces will be complete |
771 | # and thus aid debugging, since after all, BPs are a debugging tool. | |
40a55d20 | 772 | object-suffixes += .ob |
ab95290c | 773 | CPPFLAGS-.ob = -fbounded-pointers $(pic-default) |
e64911d1 | 774 | CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing |
40a55d20 | 775 | libtype.ob = lib%_b.a |
5a97622d | 776 | endif |
f0bf9cb9 | 777 | |
9afc8a59 UD |
778 | object-suffixes-for-libc := $(object-suffixes) |
779 | ||
780 | ifeq (yes,$(build-shared)) | |
781 | # Build special library that contains the static-only routines for libc. | |
782 | object-suffixes-for-libc += .oS | |
783 | ||
784 | # Must build the routines as PIC, though, because they can end up in (users') | |
785 | # shared objects. We don't want to use CFLAGS-os because users may, for | |
786 | # example, make that processor-specific. | |
231e88a4 | 787 | CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) |
06b31ad3 | 788 | CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 |
9afc8a59 UD |
789 | libtype.oS = lib%_nonshared.a |
790 | endif | |
791 | ||
073e82bf RM |
792 | # The assembler can generate debug information too. |
793 | ifndef ASFLAGS | |
794 | ifeq ($(have-cpp-asm-debuginfo),yes) | |
2e7c805d | 795 | ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) |
35915ec8 UD |
796 | else |
797 | ASFLAGS := | |
073e82bf RM |
798 | endif |
799 | endif | |
eb29449a | 800 | ASFLAGS += $(ASFLAGS-config) $(asflags-cpu) |
9afc8a59 | 801 | |
96bda0ea RM |
802 | ifndef BUILD_CC |
803 | BUILD_CC = $(CC) | |
804 | endif | |
e72bfd87 UD |
805 | |
806 | move-if-change = $(SHELL) $(..)scripts/move-if-change | |
a641835a | 807 | \f |
281e6031 UD |
808 | -include $(common-objpfx)sysd-sorted |
809 | subdirs = $(sorted-subdirs) | |
e0a3ed4f RM |
810 | subdir-srcdirs = $(foreach dir,$(subdirs),\ |
811 | $(firstword $($(dir)-srcdir) $(..)$(dir))) | |
9a0a462c | 812 | |
4de1d597 RM |
813 | ifeq (yes, $(build-shared)) |
814 | ||
f3787738 RM |
815 | # This is a pair of implicit rules to preprocess a file with # comments, |
816 | # %ifdef et al, based on config.h settings or other %include'd files. | |
817 | # We use chained rules instead of a pipeline here so that we can properly | |
818 | # check the exit status of cpp rather than using its bad output when there | |
819 | # is a preprocessing error. Another rule should depend on the output file | |
820 | # `FOO.v', and along with that `FOO.v.i' should be given dependencies | |
821 | # listing both its input files, and any header files that it may reference | |
822 | # (but no commands). | |
8744841f RM |
823 | %.v.i: $(common-objpfx)config.h $(..)Makeconfig |
824 | sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ | |
825 | $(filter-out FORCE %.h $(..)Makeconfig,$^) \ | |
02838201 | 826 | | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \ |
f3787738 RM |
827 | > $@T |
828 | mv -f $@T $@ | |
829 | %.v: %.v.i | |
830 | sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T | |
831 | mv -f $@T $@ | |
480d827b | 832 | |
4de1d597 RM |
833 | # Process the shlib-versions file, which tells us what shared library |
834 | # version numbers to use when we install shared objects on this system. | |
281e6031 UD |
835 | # We need to wait until $(subdirs) is complete. |
836 | ifeq ($(sysd-sorted-done),t) | |
4de1d597 | 837 | -include $(common-objpfx)soversions.mk |
eca3eb3b | 838 | ifndef avoid-generated |
9632aaee RM |
839 | # This lets add-ons give more-specific matches that override defaults |
840 | # in the top-level file. | |
f3787738 | 841 | $(common-objpfx)shlib-versions.v.i: \ |
e0a3ed4f RM |
842 | $(wildcard $(+sysdep_dirs:=/shlib-versions) \ |
843 | $(subdir-srcdirs:=/shlib-versions)) \ | |
9632aaee | 844 | $(..)shlib-versions |
6d864d15 RM |
845 | |
846 | soversions-default-setname = $(patsubst %, %,\ | |
847 | $(filter-out %_default,\ | |
848 | $(oldest-abi:%=GLIBC_%))) | |
849 | $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \ | |
850 | $(common-objpfx)shlib-versions.v | |
851 | $(AWK) -v default_setname='$(soversions-default-setname)' \ | |
91adb529 RM |
852 | -v cpu='$(config-machine)' \ |
853 | -v vendor='$(config-vendor)' \ | |
854 | -v os='$(config-os)' \ | |
6d864d15 | 855 | -f $^ > $@T |
ba7e89ec | 856 | mv -f $@T $@ |
3e1e123d RM |
857 | $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig |
858 | (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \ | |
859 | while read which lib number setname; do \ | |
860 | eval seen_$$which=1; \ | |
6fa16597 | 861 | test x"$$which" != xABI || echo abi-name = "$$lib"; \ |
91adb529 | 862 | test x"$$which" = xDEFAULT || continue; \ |
1bc777b8 UD |
863 | case $$number in \ |
864 | [0-9]*) echo "$$lib.so-version=.$$number"; \ | |
865 | echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\ | |
866 | *) echo "$$lib.so-version=$$number"; \ | |
867 | echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\ | |
868 | esac; \ | |
869 | done; \ | |
3e1e123d RM |
870 | case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \ |
871 | 100) echo biarch = no;; \ | |
872 | 101) echo biarch = 32;; \ | |
873 | ?1?) echo biarch = 64;; \ | |
874 | *) echo >&2 BUG; exit 2;; \ | |
875 | esac; \ | |
1bc777b8 | 876 | echo soversions.mk-done = t;) < $< > $@T; exit 0 |
4de1d597 | 877 | mv -f $@T $@ |
eca3eb3b | 878 | endif |
281e6031 | 879 | endif |
eca3eb3b | 880 | |
f3787738 RM |
881 | postclean-generated += soversions.mk soversions.i \ |
882 | shlib-versions.v shlib-versions.v.i | |
4de1d597 | 883 | |
c0e45674 | 884 | # Generate the header containing the names of all shared libraries. |
5613ea18 | 885 | # We use a stamp file to avoid unnecessary recompilations. |
c0e45674 | 886 | before-compile += $(common-objpfx)gnu/lib-names.h |
1bc777b8 | 887 | ifeq ($(soversions.mk-done),t) |
60c34a30 | 888 | $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @: |
91adb529 RM |
889 | $(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \ |
890 | $(common-objpfx)soversions.i | |
c0e45674 UD |
891 | $(make-target-directory) |
892 | @rm -f ${@:stmp=T} $@ | |
4facf4af | 893 | LC_ALL=C $(AWK) -f $^ > ${@:stmp=T} |
7e7a548e | 894 | $(move-if-change) ${@:stmp=T} ${@:stmp=h} |
c0e45674 | 895 | touch $@ |
1bc777b8 | 896 | endif |
c0e45674 UD |
897 | |
898 | common-generated += gnu/lib-names.h gnu/lib-names.stmp | |
d41c6f61 UD |
899 | |
900 | # The name under which the run-time dynamic linker is installed. | |
901 | # We are currently going for the convention that `/lib/ld.so.1' | |
902 | # names the SVR4/ELF ABI-compliant dynamic linker. | |
903 | ifndef rtld-installed-name | |
904 | ifdef ld.so-version | |
905 | rtld-installed-name = $(ld.so-version) | |
906 | else | |
907 | rtld-installed-name = ld.so.1 | |
908 | endif | |
909 | endif | |
910 | ||
1ef32c3d UD |
911 | ifndef rtld-version-installed-name |
912 | rtld-version-installed-name = ld-$(version).so | |
913 | endif | |
914 | ||
f649c201 UD |
915 | endif # build-shared |
916 | ||
cbdee279 | 917 | |
94e365c6 UD |
918 | ifeq ($(elf),yes) |
919 | dlfcn = dlfcn | |
920 | ifeq ($(build-shared),yes) | |
921 | libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version) | |
922 | else | |
923 | libdl = $(common-objpfx)dlfcn/libdl.a | |
924 | endif | |
925 | else | |
ad10cac8 UD |
926 | ifneq (,$(findstring aix,$(config-os))) |
927 | ifeq ($(build-shared),yes) | |
928 | dlfcn = dlfcn | |
929 | libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version) | |
930 | else | |
931 | # No libdl without shared libs on AIX | |
932 | dlfcn = | |
933 | libdl = | |
934 | endif | |
935 | else | |
936 | # No ELF, no AIX - no libdl, at least for now. | |
94e365c6 UD |
937 | dlfcn = |
938 | libdl = | |
939 | endif | |
ad10cac8 | 940 | endif |
94e365c6 | 941 | |
bb41a976 UD |
942 | # These are the subdirectories containing the library source. The order |
943 | # is more or less arbitrary. The sorting step will take care of the | |
e0a3ed4f | 944 | # dependencies. |
8d6f1731 | 945 | all-subdirs = csu assert ctype locale intl catgets math setjmp signal \ |
e0a3ed4f | 946 | stdlib stdio-common libio malloc string wcsmbs time dirent \ |
b0b67c47 | 947 | grp pwd posix io termios resource misc socket sysvipc gmon \ |
829fea46 | 948 | gnulib iconv iconvdata wctype manual shadow gshadow po argp \ |
e0a3ed4f RM |
949 | crypt nss localedata timezone rt conform debug \ |
950 | $(add-on-subdirs) $(dlfcn) $(binfmt-subdir) | |
b22fc5f5 | 951 | |
b7e2d9a5 | 952 | ifndef avoid-generated |
e0a3ed4f RM |
953 | all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\ |
954 | $(firstword $($(dir)-srcdir) \ | |
955 | $(..)$(dir))/Depend)) | |
956 | $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \ | |
957 | $(common-objpfx)config.make $(..)Makeconfig \ | |
958 | $(wildcard $(sysdirs:=/Subdirs)) \ | |
959 | $(all-Depend-files) | |
960 | $(AWK) -f $< \ | |
961 | -v subdirs='$(all-subdirs)' \ | |
962 | -v srcpfx='$(..)' \ | |
963 | $(filter %/Subdirs %/Depend,$^) > $@-tmp | |
bb41a976 | 964 | mv -f $@-tmp $@ |
9de06f3c | 965 | $(all-Depend-files): ; |
b7e2d9a5 | 966 | endif |
bb41a976 | 967 | |
16cd816f RM |
968 | # This gives partial TARGET:SOURCE pattern pairs to have rules |
969 | # emitted into sysd-rules. A sysdeps Makeconfig fragment can | |
970 | # add its own special object file prefix to this list with e.g. foo-%:% | |
971 | # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS). | |
bc96fbda | 972 | sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_% |
16cd816f | 973 | |
083973f3 | 974 | # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here. |
e0a3ed4f | 975 | sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig)) |
083973f3 | 976 | ifneq (,$(sysdep-makeconfigs)) |
e0a3ed4f | 977 | include $(sysdep-makeconfigs) |
083973f3 RM |
978 | endif |
979 | ||
363a641b | 980 | # Compute just the target patterns. Makeconfig has set sysd-rules-patterns. |
bc96fbda AS |
981 | sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\ |
982 | $(firstword $(subst :, ,$p)))) | |
083973f3 | 983 | |
28f540f4 | 984 | endif # Makeconfig not yet included |
c238ecf7 UD |
985 | |
986 | # Local Variables: | |
987 | # mode: makefile | |
988 | # End: |