]>
Commit | Line | Data |
---|---|---|
e9433893 | 1 | # Copyright (C) 1991-2003,2004,2005,2006,2007,2008,2009,2010,2011 |
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 RM |
280 | |
281 | # Where to install default configuration files. These include the local | |
282 | # timezone specification and network data base files. | |
283 | ifndef sysconfdir | |
284 | sysconfdir = $(prefix)/etc | |
285 | endif | |
8d57beea | 286 | inst_sysconfdir = $(install_root)$(sysconfdir) |
28f540f4 RM |
287 | |
288 | # What timezone should be the installed default (e.g., US/Eastern). | |
289 | # Run `make -C time echo-zonenames' to see a list of available zone names. | |
290 | # The local timezone can be changed with `zic -l TIMEZONE' at any time. | |
291 | ifndef localtime | |
292 | localtime = Factory | |
293 | endif | |
294 | ||
295 | # Where to install the "localtime" timezone file; this is the file whose | |
296 | # contents $(localtime) specifies. If this is a relative pathname, it is | |
297 | # relative to $(zonedir). It is a good idea to put this somewhere | |
298 | # other than there, so the zoneinfo directory contains only universal data, | |
299 | # localizing the configuration data elsewhere. | |
300 | ifndef localtime-file | |
0d8733c4 UD |
301 | localtime-file = $(sysconfdir)/localtime |
302 | inst_localtime-file = $(install_root)$(localtime-file) | |
28f540f4 RM |
303 | endif |
304 | ||
59dd8641 RM |
305 | # What to use for leap second specifications in compiling the default |
306 | # timezone files. Set this to `/dev/null' for no leap second handling as | |
307 | # 1003.1 requires, or to `leapseconds' for proper leap second handling. | |
308 | # Both zone flavors are always available as `posix/ZONE' and `right/ZONE'. | |
309 | # This variable determines the default: if it's `/dev/null', | |
310 | # ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE. | |
311 | ifndef leapseconds | |
312 | leapseconds = /dev/null | |
313 | endif | |
314 | ||
28f540f4 RM |
315 | # What timezone's DST rules should be used when a POSIX-style TZ |
316 | # environment variable doesn't specify any rules. For 1003.1 compliance | |
317 | # this timezone must use rules that are as U.S. federal law defines DST. | |
318 | # Run `make -C time echo-zonenames' to see a list of available zone names. | |
319 | # This setting can be changed with `zic -p TIMEZONE' at any time. | |
320 | # If you want POSIX.1 compatibility, use `America/New_York'. | |
321 | ifndef posixrules | |
322 | posixrules = America/New_York | |
323 | endif | |
324 | ||
325 | # Where to install the "posixrules" timezone file; this is file | |
326 | # whose contents $(posixrules) specifies. If this is a relative | |
327 | # pathname, it is relative to $(zonedir). | |
328 | ifndef posixrules-file | |
329 | posixrules-file = posixrules | |
330 | endif | |
331 | ||
332 | ||
333 | # Directory where your system's native header files live. | |
334 | # This is used on Unix systems to generate some GNU libc header files. | |
335 | ifndef sysincludedir | |
336 | sysincludedir = /usr/include | |
337 | endif | |
338 | ||
339 | ||
340 | # Commands to install files. | |
341 | ifndef INSTALL_DATA | |
342 | INSTALL_DATA = $(INSTALL) -m 644 | |
343 | endif | |
07627f49 UD |
344 | ifndef INSTALL_SCRIPT |
345 | INSTALL_SCRIPT = $(INSTALL) | |
346 | endif | |
28f540f4 RM |
347 | ifndef INSTALL_PROGRAM |
348 | INSTALL_PROGRAM = $(INSTALL) | |
349 | endif | |
350 | ifndef INSTALL | |
351 | INSTALL = install | |
352 | endif | |
353 | ||
354 | ||
355 | # The name of the C compiler. | |
356 | # If you've got GCC, and it works, use it. | |
357 | ifeq ($(origin CC),default) | |
358 | CC := gcc | |
359 | endif | |
360 | ||
361 | # The name of the C compiler to use for compilations of programs to run on | |
362 | # the host that is building the library. If you set CC to a | |
363 | # cross-compiler, you must set this to the normal compiler. | |
364 | ifndef BUILD_CC | |
365 | BUILD_CC = $(CC) | |
366 | endif | |
367 | ||
368 | # Default flags to pass the C compiler. | |
369 | ifndef default_cflags | |
1d5c2feb UD |
370 | ifeq ($(release),stable) |
371 | default_cflags := -g -O2 | |
372 | else | |
a8922de8 | 373 | default_cflags := -g -O |
28f540f4 | 374 | endif |
1d5c2feb | 375 | endif |
28f540f4 RM |
376 | |
377 | # Flags to pass the C compiler when assembling preprocessed assembly code | |
378 | # (`.S' files). On some systems the assembler doesn't understand the `#' line | |
379 | # directives the preprocessor produces. If you have troubling compiling | |
380 | # assembly code, try using -P here to suppress these directives. | |
381 | ifndef asm-CPPFLAGS | |
382 | asm-CPPFLAGS = | |
383 | endif | |
384 | ||
9a0a462c UD |
385 | # ELF always supports init/fini sections |
386 | ifeq ($(elf),yes) | |
387 | have-initfini = yes | |
388 | endif | |
389 | ||
7e2b0c85 RM |
390 | ifeq ($(have-as-needed),yes) |
391 | as-needed := -Wl,--as-needed | |
392 | no-as-needed := -Wl,--no-as-needed | |
393 | else | |
394 | as-needed := | |
395 | no-as-needed := | |
396 | endif | |
397 | ||
779ae82e | 398 | # Installed name of the startup code. |
9a0a462c UD |
399 | ifneq ($(have-initfini),yes) |
400 | # When not having init/fini, there is just one startfile, called crt0.o. | |
779ae82e UD |
401 | start-installed-name = crt0.o |
402 | else | |
9a0a462c | 403 | # On systems having init/fini, crt0.o is called crt1.o, and there are |
779ae82e UD |
404 | # some additional bizarre files. |
405 | start-installed-name = crt1.o | |
779ae82e | 406 | endif |
af09bfb5 RM |
407 | # On systems that do not need a special startfile for statically linked |
408 | # binaries, simply set it to the normal name. | |
409 | ifndef static-start-installed-name | |
410 | static-start-installed-name = $(start-installed-name) | |
411 | endif | |
779ae82e | 412 | |
f13df7c7 UD |
413 | ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc)) |
414 | combreloc-LDFLAGS = -Wl,-z,combreloc | |
415 | LDFLAGS.so += $(combreloc-LDFLAGS) | |
416 | LDFLAGS-rtld += $(combreloc-LDFLAGS) | |
417 | endif | |
418 | ||
1c563add UD |
419 | relro-LDFLAGS = -Wl,-z,relro |
420 | LDFLAGS.so += $(relro-LDFLAGS) | |
421 | LDFLAGS-rtld += $(relro-LDFLAGS) | |
1c563add | 422 | |
871b9158 UD |
423 | ifeq (yes,$(have-hash-style)) |
424 | # For the time being we unconditionally use 'both'. At some time we | |
425 | # should declare statically linked code as 'out of luck' and compile | |
426 | # with --hash-style=gnu only. | |
427 | hashstyle-LDFLAGS = -Wl,--hash-style=both | |
428 | LDFLAGS.so += $(hashstyle-LDFLAGS) | |
429 | LDFLAGS-rtld += $(hashstyle-LDFLAGS) | |
430 | endif | |
431 | ||
28f540f4 RM |
432 | # Command for linking programs with the C library. |
433 | ifndef +link | |
8e3cc80f | 434 | +link = $(CC) -nostdlib -nostartfiles -o $@ \ |
482eec0d | 435 | $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
871b9158 | 436 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ |
779ae82e UD |
437 | $(addprefix $(csu-objpfx),$(start-installed-name)) \ |
438 | $(+preinit) $(+prector) \ | |
439 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
440 | $(start-installed-name))\ | |
441 | $(+preinit) $(link-extra-libs) \ | |
442 | $(common-objpfx)libc% $(+postinit),$^) \ | |
5ae9d168 | 443 | $(link-extra-libs) $(link-libc) $(+postctor) $(+postinit) |
28f540f4 | 444 | endif |
435aa54b L |
445 | # Command for linking PIE programs with the C library. |
446 | ifndef +link-pie | |
447 | +link-pie = $(CC) -pie -Wl,-O1 -nostdlib -nostartfiles -o $@ \ | |
448 | $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ | |
449 | $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ | |
450 | $(addprefix $(csu-objpfx),S$(start-installed-name)) \ | |
451 | $(+preinit) $(+prectorS) \ | |
452 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
453 | S$(start-installed-name))\ | |
454 | $(+preinit) $(link-extra-libs) \ | |
455 | $(common-objpfx)libc% $(+postinit),$^) \ | |
456 | $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit) | |
457 | endif | |
e1586792 UD |
458 | # Command for statically linking programs with the C library. |
459 | ifndef +link-static | |
460 | +link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \ | |
9f0d7b6d | 461 | $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ |
af09bfb5 | 462 | $(addprefix $(csu-objpfx),$(static-start-installed-name)) \ |
e1586792 UD |
463 | $(+preinit) $(+prector) \ |
464 | $(filter-out $(addprefix $(csu-objpfx),start.o \ | |
465 | $(start-installed-name))\ | |
466 | $(+preinit) $(link-extra-libs-static) \ | |
467 | $(common-objpfx)libc% $(+postinit),$^) \ | |
468 | $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit) | |
469 | endif | |
ac556388 GM |
470 | # Command for statically linking bounded-pointer programs with the C library. |
471 | ifndef +link-bounded | |
472 | +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \ | |
473 | $(sysdep-LDFLAGS) $(LDFLAGS) \ | |
474 | $(addprefix $(csu-objpfx),b$(static-start-installed-name)) \ | |
475 | $(+preinit) $(+prector) \ | |
4362aba5 | 476 | $(filter-out $(addprefix $(csu-objpfx),start.ob \ |
ac556388 GM |
477 | $(start-installed-name))\ |
478 | $(+preinit) $(link-extra-libs-bounded) \ | |
479 | $(common-objpfx)libc% $(+postinit),$^) \ | |
480 | $(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit) | |
481 | endif | |
b122c703 | 482 | ifndef config-LDFLAGS |
994431ed | 483 | ifeq (yesyes,$(build-shared)$(elf)) |
094bacdb | 484 | config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name) |
b122c703 RM |
485 | endif |
486 | endif | |
3fe9de0d RM |
487 | ifndef link-libc |
488 | ifeq (yes,$(build-shared)) | |
ad10cac8 | 489 | ifeq ($(elf),yes) |
aa1075ea RM |
490 | # We need the versioned name of libc.so in the deps of $(others) et al |
491 | # so that the symlink to libc.so is created before anything tries to | |
492 | # run the linked programs. | |
4d6acc61 | 493 | link-libc = -Wl,-rpath-link=$(rpath-link) \ |
aa1075ea | 494 | $(common-objpfx)libc.so$(libc.so-version) \ |
7e2b0c85 RM |
495 | $(common-objpfx)$(patsubst %,$(libtype.oS),c) \ |
496 | $(as-needed) $(common-objpfx)elf/ld.so $(no-as-needed) $(gnulib) | |
4d6acc61 | 497 | # This is how to find at build-time things that will be installed there. |
b11f5954 | 498 | rpath-dirs = math elf dlfcn nss nis rt resolv crypt |
ad10cac8 | 499 | endif |
e72bfd87 UD |
500 | rpath-link = \ |
501 | $(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%))) | |
47707456 | 502 | elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) |
3fe9de0d | 503 | else |
ce85d65b UD |
504 | nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) |
505 | resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv) | |
4ac5087b | 506 | link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib) |
3fe9de0d RM |
507 | endif |
508 | endif | |
900bec85 | 509 | |
ad10cac8 UD |
510 | # Differences in the linkers on the various platforms. |
511 | ifeq ($(elf),yes) | |
512 | LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN' | |
513 | LDFLAGS-soname-fname = -Wl,-soname,$(@F) | |
514 | LDFLAGS-rdynamic = -rdynamic | |
515 | LDFLAGS-Bsymbolic = -Bsymbolic | |
ad10cac8 UD |
516 | endif |
517 | ||
f01010de UD |
518 | # Choose the default search path for the dynamic linker based on |
519 | # where we will install libraries. | |
520 | ifneq ($(libdir),$(slibdir)) | |
521 | default-rpath = $(slibdir):$(libdir) | |
522 | else | |
523 | default-rpath = $(libdir) | |
524 | endif | |
525 | ||
57ba7bb4 | 526 | ifndef link-extra-libs |
1d038b6b RM |
527 | link-extra-libs = $(LDLIBS-$(@F)) |
528 | link-extra-libs-static = $(link-extra-libs) | |
529 | link-extra-libs-bounded = $(link-extra-libs) | |
57ba7bb4 | 530 | endif |
e1586792 UD |
531 | |
532 | # The static libraries. | |
66000494 | 533 | ifeq (yes,$(build-static)) |
b9af1301 | 534 | link-libc-static = -Wl,--start-group $(common-objpfx)libc.a $(static-gnulib) -Wl,--end-group |
66000494 UD |
535 | else |
536 | ifeq (yes,$(build-shared)) | |
537 | # We can try to link the programs with lib*_pic.a... | |
feca5e0b | 538 | link-libc-static = $(static-gnulib) $(common-objpfx)libc_pic.a |
66000494 UD |
539 | endif |
540 | endif | |
ac556388 | 541 | link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a |
e1586792 | 542 | |
28f540f4 | 543 | ifndef gnulib |
cbdb12de UD |
544 | ifneq ($(have-cc-with-libunwind),yes) |
545 | libunwind = | |
feca5e0b | 546 | else |
cbdb12de | 547 | libunwind = -lunwind |
feca5e0b | 548 | endif |
cbdb12de UD |
549 | ifneq ($(have-as-needed),yes) |
550 | libgcc_eh := -lgcc_eh $(libunwind) | |
26b30508 | 551 | else |
cbdb12de | 552 | libgcc_eh := -Wl,--as-needed -lgcc_s$(libgcc_s_suffix) $(libunwind) -Wl,--no-as-needed |
26b30508 | 553 | endif |
cbdb12de UD |
554 | gnulib := -lgcc $(libgcc_eh) |
555 | static-gnulib := -lgcc -lgcc_eh $(libunwind) | |
556 | libc.so-gnulib := -lgcc | |
28f540f4 | 557 | endif |
96f873b9 | 558 | ifeq ($(elf),yes) |
e75154a6 RM |
559 | +preinit = $(addprefix $(csu-objpfx),crti.o) |
560 | +postinit = $(addprefix $(csu-objpfx),crtn.o) | |
35e65999 RA |
561 | +prector = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbegin.o` |
562 | +postctor = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtend.o` | |
435aa54b | 563 | # Variants of the two previous definitions for linking PIE programs. |
35e65999 RA |
564 | +prectorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtbeginS.o` |
565 | +postctorS = `$(CC) $(sysdep-LDFLAGS) --print-file-name=crtendS.o` | |
66715f83 | 566 | +interp = $(addprefix $(elf-objpfx),interp.os) |
96f873b9 | 567 | endif |
6e953631 UD |
568 | csu-objpfx = $(common-objpfx)csu/ |
569 | elf-objpfx = $(common-objpfx)elf/ | |
28f540f4 | 570 | |
03a75825 RM |
571 | # How to run a program we just linked with our library. |
572 | # The program binary is assumed to be $(word 2,$^). | |
573 | built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^)) | |
ad10cac8 | 574 | ifeq (yesyes,$(build-shared)$(elf)) |
196980f5 | 575 | comma = , |
11336c16 UD |
576 | sysdep-library-path = \ |
577 | $(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\ | |
578 | $(filter -Wl$(comma)-rpath-link=%,\ | |
579 | $(sysdep-LDFLAGS))))) | |
27abf7a3 | 580 | run-program-prefix = $(if $(filter $(notdir $(built-program-file)),\ |
ccd8de9a | 581 | $(tests-static) $(xtests-static)),, \ |
85857f93 UD |
582 | $(elf-objpfx)$(rtld-installed-name) \ |
583 | --library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path))) | |
8658ceda UD |
584 | else |
585 | run-program-prefix = | |
586 | endif | |
ac556388 GM |
587 | # Never use $(run-program-prefix) for the statically-linked %-bp test programs |
588 | built-program-cmd = $(patsubst %,$(run-program-prefix),\ | |
589 | $(filter-out %-bp,$(built-program-file))) \ | |
590 | $(built-program-file) | |
03a75825 | 591 | |
28f540f4 RM |
592 | ifndef LD |
593 | LD := ld -X | |
594 | endif | |
595 | ||
28f540f4 | 596 | # Extra flags to pass to GCC. |
6cc7d725 | 597 | ifeq ($(all-warnings),yes) |
7735afa2 | 598 | +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 | 599 | else |
7735afa2 | 600 | +gccwarn := -Wall -Wwrite-strings -Winline |
6cc7d725 | 601 | endif |
7735afa2 | 602 | +gccwarn-c = -Wstrict-prototypes |
28f540f4 | 603 | |
dec36b4f UD |
604 | # We do not depend on the address of constants in different files to be |
605 | # actually different, so allow the compiler to merge them all. | |
606 | +merge-constants = -fmerge-all-constants | |
607 | ||
30077d51 RM |
608 | # This is the program that generates makefile dependencies from C source files. |
609 | # The -MP flag tells GCC >= 3.2 (which we now require) to produce dummy | |
610 | # targets for headers so that removed headers don't break the build. | |
28f540f4 | 611 | ifndef +mkdep |
30077d51 | 612 | +mkdep = $(CC) -M -MP |
28f540f4 RM |
613 | endif |
614 | ||
615 | # The program that makes Emacs-style TAGS files. | |
78759725 | 616 | ETAGS := etags |
28f540f4 | 617 | |
9de06f3c RM |
618 | # The `xgettext' program for producing .pot files from sources. |
619 | ifndef XGETTEXT | |
620 | XGETTEXT = xgettext | |
621 | endif | |
622 | ||
28f540f4 RM |
623 | # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and |
624 | # perhaps others) to preprocess assembly code in some cases. | |
625 | M4 = m4 | |
626 | ||
73237de3 UD |
627 | # To force installation of files even if they are older than the |
628 | # installed files. This variable is included in the dependency list | |
629 | # of all installation targets. | |
630 | ifeq ($(force-install),yes) | |
631 | +force = force-install | |
632 | else | |
633 | +force = | |
634 | endif | |
635 | ||
28f540f4 RM |
636 | #### |
637 | #### End of configuration variables. | |
638 | #### | |
639 | \f | |
640 | # This tells some versions of GNU make before 3.63 not to export all variables. | |
641 | .NOEXPORT: | |
642 | ||
643 | # We want to echo the commands we're running without | |
6d52618b | 644 | # umpteen zillion filenames along with it (we use `...' instead) |
28f540f4 RM |
645 | # but we don't want this echoing done when the user has said |
646 | # he doesn't want to see commands echoed by using -s. | |
647 | ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s | |
648 | +cmdecho := echo >/dev/null | |
649 | else # not -s | |
650 | +cmdecho := echo | |
651 | endif # -s | |
652 | ||
653 | # These are the flags given to the compiler to tell | |
654 | # it what sort of optimization and/or debugging output to do. | |
655 | ifndef +cflags | |
656 | # If `CFLAGS' was defined, use that. | |
657 | ifdef CFLAGS | |
658 | +cflags := $(filter-out -I%,$(CFLAGS)) | |
659 | endif # CFLAGS | |
660 | endif # +cflags | |
661 | ||
fd26970f | 662 | # If none of the above worked, default to "-g -O". |
28f540f4 RM |
663 | ifeq "$(strip $(+cflags))" "" |
664 | +cflags := $(default_cflags) | |
665 | endif # $(+cflags) == "" | |
666 | ||
2cf9ad57 | 667 | +cflags += $(cflags-cpu) $(+gccwarn) $(+merge-constants) |
28f540f4 | 668 | +gcc-nowarn := -w |
28f540f4 RM |
669 | |
670 | # Don't duplicate options if we inherited variables from the parent. | |
671 | +cflags := $(sort $(+cflags)) | |
672 | ||
b6ab06ce UD |
673 | # These are flags given to the C compiler to tell it to look for |
674 | # include files (including ones given in angle brackets) in the parent | |
675 | # library source directory, in the include directory, and in the | |
676 | # current directory. | |
e0a3ed4f RM |
677 | +sysdep-includes = $(addprefix -I,$(+sysdep_dirs)) |
678 | +includes = -I$(..)include $(if $(subdir),$(objpfx:%/=-I%)) \ | |
4ae73ca0 RM |
679 | $(+sysdep-includes) $(includes) \ |
680 | $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes) | |
28f540f4 | 681 | |
96aa2d94 | 682 | # Since libio has several internal header files, we use a -I instead |
762a2918 | 683 | # of many little headers in the include directory. |
96aa2d94 | 684 | libio-include = -I$(..)libio |
28f540f4 RM |
685 | |
686 | # These are the variables that the implicit compilation rules use. | |
ce460d04 RM |
687 | # Note that we can't use -std=* in CPPFLAGS, because it overrides |
688 | # the implicit -lang-asm and breaks cpp behavior for .S files--notably | |
689 | # it causes cpp to stop predefining __ASSEMBLER__. | |
3387a425 | 690 | CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \ |
ae8b36f7 | 691 | -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \ |
0a951d0e | 692 | $(CPPFLAGS-$(suffix $@)) \ |
d29724f8 | 693 | $(foreach lib,$(libof-$(basename $(@F))) \ |
bc96fbda | 694 | $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \ |
0a951d0e | 695 | $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F))) |
b037a293 | 696 | override CFLAGS = -std=gnu99 $(gnu89-inline-CFLAGS) \ |
7735afa2 UD |
697 | $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \ |
698 | $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \ | |
699 | $(CFLAGS-$(@F)) | |
ef226fec RM |
700 | override CXXFLAGS = $(c++-sysincludes) \ |
701 | $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \ | |
7735afa2 | 702 | $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F)) |
28f540f4 | 703 | |
cc3fa755 UD |
704 | # If everything is compiled with -fPIC (implicitly) we must tell this by |
705 | # defining the PIC symbol. | |
706 | ifeq (yes,$(build-pic-default)) | |
707 | pic-default = -DPIC | |
708 | endif | |
709 | ||
f0bf9cb9 RM |
710 | # Enable object files for different versions of the library. |
711 | # Various things use $(object-suffixes) to know what all to make. | |
712 | # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) | |
713 | # to pass different flags for each flavor. | |
91641c65 | 714 | libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o)) |
a35cb74d | 715 | all-object-suffixes := .o .os .op .og .ob .oS |
650425ce | 716 | object-suffixes := |
cc3fa755 | 717 | CPPFLAGS-.o = $(pic-default) |
14e9dd67 | 718 | CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) |
66000494 | 719 | ifeq (yes,$(build-static)) |
f0bf9cb9 | 720 | libtype.o := lib%.a |
650425ce UD |
721 | object-suffixes += .o |
722 | endif | |
f0bf9cb9 RM |
723 | ifeq (yes,$(build-shared)) |
724 | # Under --enable-shared, we will build a shared library of PIC objects. | |
40a55d20 UD |
725 | # The PIC object files are named foo.os. |
726 | object-suffixes += .os | |
b5567b2a | 727 | CPPFLAGS-.os = -DPIC -DSHARED |
14e9dd67 | 728 | CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag) |
40a55d20 | 729 | libtype.os := lib%_pic.a |
26b4d766 UD |
730 | # This can be changed by a sysdep makefile |
731 | pic-ccflag = -fPIC | |
231e88a4 UD |
732 | # This one should always stay like this unless there is a very good reason. |
733 | PIC-ccflag = -fPIC | |
f0bf9cb9 | 734 | endif |
7b91359b UD |
735 | # This can be changed by a sysdep makefile |
736 | pie-ccflag = -fpie | |
737 | # This one should always stay like this unless there is a very good reason. | |
738 | PIE-ccflag = -fPIE | |
f0bf9cb9 RM |
739 | ifeq (yes,$(build-profile)) |
740 | # Under --enable-profile, we will build a static library of profiled objects. | |
40a55d20 UD |
741 | # The profiled object files are named foo.op. |
742 | object-suffixes += .op | |
cc3fa755 | 743 | CPPFLAGS-.op = -DPROF $(pic-default) |
40a55d20 UD |
744 | CFLAGS-.op = -pg |
745 | libtype.op = lib%_p.a | |
f0bf9cb9 RM |
746 | endif |
747 | ifeq (yes,$(build-omitfp)) | |
ab95290c | 748 | # Under --enable-omitfp, we build the library optimized without |
f0bf9cb9 | 749 | # debugging information using -fomit-frame-pointer, and build an extra |
40a55d20 UD |
750 | # library with debugging information. The debuggable objects are named foo.og. |
751 | object-suffixes += .og | |
cc3fa755 | 752 | CPPFLAGS-.og = $(pic-default) |
40a55d20 | 753 | CFLAGS-.og = -g |
14e9dd67 UD |
754 | CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES |
755 | CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES | |
40a55d20 | 756 | libtype.og = lib%_g.a |
f0bf9cb9 | 757 | endif |
ab95290c UD |
758 | |
759 | bppfx = BP- | |
5a97622d UD |
760 | ifeq (yes,$(build-bounded)) |
761 | # Under --enable-bounded, we build the library with `-fbounded-pointers -g' | |
40a55d20 | 762 | # to runtime bounds checking. The bounded-pointer objects are named foo.ob. |
58ff985d GM |
763 | # We disable sibling-call optimizations so that stack traces will be complete |
764 | # and thus aid debugging, since after all, BPs are a debugging tool. | |
40a55d20 | 765 | object-suffixes += .ob |
ab95290c | 766 | CPPFLAGS-.ob = -fbounded-pointers $(pic-default) |
e64911d1 | 767 | CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing |
40a55d20 | 768 | libtype.ob = lib%_b.a |
5a97622d | 769 | endif |
f0bf9cb9 | 770 | |
9afc8a59 UD |
771 | object-suffixes-for-libc := $(object-suffixes) |
772 | ||
773 | ifeq (yes,$(build-shared)) | |
774 | # Build special library that contains the static-only routines for libc. | |
775 | object-suffixes-for-libc += .oS | |
776 | ||
777 | # Must build the routines as PIC, though, because they can end up in (users') | |
778 | # shared objects. We don't want to use CFLAGS-os because users may, for | |
779 | # example, make that processor-specific. | |
231e88a4 | 780 | CFLAGS-.oS = $(CFLAGS-.o) $(PIC-ccflag) |
06b31ad3 | 781 | CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC -DLIBC_NONSHARED=1 |
9afc8a59 UD |
782 | libtype.oS = lib%_nonshared.a |
783 | endif | |
784 | ||
073e82bf RM |
785 | # The assembler can generate debug information too. |
786 | ifndef ASFLAGS | |
787 | ifeq ($(have-cpp-asm-debuginfo),yes) | |
2e7c805d | 788 | ASFLAGS := $(filter -g% -fdebug-prefix-map=%,$(CFLAGS)) |
35915ec8 UD |
789 | else |
790 | ASFLAGS := | |
073e82bf RM |
791 | endif |
792 | endif | |
eb29449a | 793 | ASFLAGS += $(ASFLAGS-config) $(asflags-cpu) |
9afc8a59 | 794 | |
96bda0ea RM |
795 | ifndef BUILD_CC |
796 | BUILD_CC = $(CC) | |
797 | endif | |
e72bfd87 UD |
798 | |
799 | move-if-change = $(SHELL) $(..)scripts/move-if-change | |
a641835a | 800 | \f |
281e6031 UD |
801 | -include $(common-objpfx)sysd-sorted |
802 | subdirs = $(sorted-subdirs) | |
e0a3ed4f RM |
803 | subdir-srcdirs = $(foreach dir,$(subdirs),\ |
804 | $(firstword $($(dir)-srcdir) $(..)$(dir))) | |
9a0a462c | 805 | |
4de1d597 RM |
806 | ifeq (yes, $(build-shared)) |
807 | ||
f3787738 RM |
808 | # This is a pair of implicit rules to preprocess a file with # comments, |
809 | # %ifdef et al, based on config.h settings or other %include'd files. | |
810 | # We use chained rules instead of a pipeline here so that we can properly | |
811 | # check the exit status of cpp rather than using its bad output when there | |
812 | # is a preprocessing error. Another rule should depend on the output file | |
813 | # `FOO.v', and along with that `FOO.v.i' should be given dependencies | |
814 | # listing both its input files, and any header files that it may reference | |
815 | # (but no commands). | |
8744841f RM |
816 | %.v.i: $(common-objpfx)config.h $(..)Makeconfig |
817 | sed '/^[ ]*%/!s/#.*$$//;/^[ ]*$$/d;s/^[ ]*%/#/' \ | |
818 | $(filter-out FORCE %.h $(..)Makeconfig,$^) \ | |
02838201 | 819 | | $(CC) -E -undef $(CPPFLAGS) -x assembler-with-cpp - \ |
f3787738 RM |
820 | > $@T |
821 | mv -f $@T $@ | |
822 | %.v: %.v.i | |
823 | sed '/^[ ]*#/d;/^[ ]*$$/d' $< > $@T | |
824 | mv -f $@T $@ | |
480d827b | 825 | |
4de1d597 RM |
826 | # Process the shlib-versions file, which tells us what shared library |
827 | # version numbers to use when we install shared objects on this system. | |
281e6031 UD |
828 | # We need to wait until $(subdirs) is complete. |
829 | ifeq ($(sysd-sorted-done),t) | |
4de1d597 | 830 | -include $(common-objpfx)soversions.mk |
eca3eb3b | 831 | ifndef avoid-generated |
9632aaee RM |
832 | # This lets add-ons give more-specific matches that override defaults |
833 | # in the top-level file. | |
f3787738 | 834 | $(common-objpfx)shlib-versions.v.i: \ |
e0a3ed4f RM |
835 | $(wildcard $(+sysdep_dirs:=/shlib-versions) \ |
836 | $(subdir-srcdirs:=/shlib-versions)) \ | |
9632aaee | 837 | $(..)shlib-versions |
6d864d15 RM |
838 | |
839 | soversions-default-setname = $(patsubst %, %,\ | |
840 | $(filter-out %_default,\ | |
841 | $(oldest-abi:%=GLIBC_%))) | |
842 | $(common-objpfx)soversions.i: $(..)scripts/soversions.awk \ | |
843 | $(common-objpfx)shlib-versions.v | |
844 | $(AWK) -v default_setname='$(soversions-default-setname)' \ | |
91adb529 RM |
845 | -v cpu='$(config-machine)' \ |
846 | -v vendor='$(config-vendor)' \ | |
847 | -v os='$(config-os)' \ | |
6d864d15 | 848 | -f $^ > $@T |
ba7e89ec | 849 | mv -f $@T $@ |
3e1e123d RM |
850 | $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig |
851 | (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \ | |
852 | while read which lib number setname; do \ | |
853 | eval seen_$$which=1; \ | |
6fa16597 | 854 | test x"$$which" != xABI || echo abi-name = "$$lib"; \ |
91adb529 | 855 | test x"$$which" = xDEFAULT || continue; \ |
1bc777b8 UD |
856 | case $$number in \ |
857 | [0-9]*) echo "$$lib.so-version=.$$number"; \ | |
858 | echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\ | |
859 | *) echo "$$lib.so-version=$$number"; \ | |
860 | echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\ | |
861 | esac; \ | |
862 | done; \ | |
3e1e123d RM |
863 | case "$$seen_DEFAULT$$seen_WORDSIZE32$$seen_WORDSIZE64" in \ |
864 | 100) echo biarch = no;; \ | |
865 | 101) echo biarch = 32;; \ | |
866 | ?1?) echo biarch = 64;; \ | |
867 | *) echo >&2 BUG; exit 2;; \ | |
868 | esac; \ | |
1bc777b8 | 869 | echo soversions.mk-done = t;) < $< > $@T; exit 0 |
4de1d597 | 870 | mv -f $@T $@ |
eca3eb3b | 871 | endif |
281e6031 | 872 | endif |
eca3eb3b | 873 | |
f3787738 RM |
874 | postclean-generated += soversions.mk soversions.i \ |
875 | shlib-versions.v shlib-versions.v.i | |
4de1d597 | 876 | |
c0e45674 | 877 | # Generate the header containing the names of all shared libraries. |
5613ea18 | 878 | # We use a stamp file to avoid unnecessary recompilations. |
c0e45674 | 879 | before-compile += $(common-objpfx)gnu/lib-names.h |
1bc777b8 | 880 | ifeq ($(soversions.mk-done),t) |
60c34a30 | 881 | $(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @: |
91adb529 RM |
882 | $(common-objpfx)gnu/lib-names.stmp: $(..)scripts/lib-names.awk \ |
883 | $(common-objpfx)soversions.i | |
c0e45674 UD |
884 | $(make-target-directory) |
885 | @rm -f ${@:stmp=T} $@ | |
4facf4af | 886 | LC_ALL=C $(AWK) -f $^ > ${@:stmp=T} |
7e7a548e | 887 | $(move-if-change) ${@:stmp=T} ${@:stmp=h} |
c0e45674 | 888 | touch $@ |
1bc777b8 | 889 | endif |
c0e45674 UD |
890 | |
891 | common-generated += gnu/lib-names.h gnu/lib-names.stmp | |
d41c6f61 UD |
892 | |
893 | # The name under which the run-time dynamic linker is installed. | |
894 | # We are currently going for the convention that `/lib/ld.so.1' | |
895 | # names the SVR4/ELF ABI-compliant dynamic linker. | |
896 | ifndef rtld-installed-name | |
897 | ifdef ld.so-version | |
898 | rtld-installed-name = $(ld.so-version) | |
899 | else | |
900 | rtld-installed-name = ld.so.1 | |
901 | endif | |
902 | endif | |
903 | ||
1ef32c3d UD |
904 | ifndef rtld-version-installed-name |
905 | rtld-version-installed-name = ld-$(version).so | |
906 | endif | |
907 | ||
f649c201 UD |
908 | endif # build-shared |
909 | ||
cbdee279 | 910 | |
94e365c6 UD |
911 | ifeq ($(elf),yes) |
912 | dlfcn = dlfcn | |
913 | ifeq ($(build-shared),yes) | |
914 | libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version) | |
915 | else | |
916 | libdl = $(common-objpfx)dlfcn/libdl.a | |
917 | endif | |
918 | else | |
ad10cac8 UD |
919 | ifneq (,$(findstring aix,$(config-os))) |
920 | ifeq ($(build-shared),yes) | |
921 | dlfcn = dlfcn | |
922 | libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version) | |
923 | else | |
924 | # No libdl without shared libs on AIX | |
925 | dlfcn = | |
926 | libdl = | |
927 | endif | |
928 | else | |
929 | # No ELF, no AIX - no libdl, at least for now. | |
94e365c6 UD |
930 | dlfcn = |
931 | libdl = | |
932 | endif | |
ad10cac8 | 933 | endif |
94e365c6 | 934 | |
bb41a976 UD |
935 | # These are the subdirectories containing the library source. The order |
936 | # is more or less arbitrary. The sorting step will take care of the | |
e0a3ed4f | 937 | # dependencies. |
8d6f1731 | 938 | all-subdirs = csu assert ctype locale intl catgets math setjmp signal \ |
e0a3ed4f | 939 | stdlib stdio-common libio malloc string wcsmbs time dirent \ |
b0b67c47 | 940 | grp pwd posix io termios resource misc socket sysvipc gmon \ |
829fea46 | 941 | gnulib iconv iconvdata wctype manual shadow gshadow po argp \ |
e0a3ed4f RM |
942 | crypt nss localedata timezone rt conform debug \ |
943 | $(add-on-subdirs) $(dlfcn) $(binfmt-subdir) | |
b22fc5f5 | 944 | |
b7e2d9a5 | 945 | ifndef avoid-generated |
e0a3ed4f RM |
946 | all-Depend-files := $(wildcard $(foreach dir,$(all-subdirs),\ |
947 | $(firstword $($(dir)-srcdir) \ | |
948 | $(..)$(dir))/Depend)) | |
949 | $(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk \ | |
950 | $(common-objpfx)config.make $(..)Makeconfig \ | |
951 | $(wildcard $(sysdirs:=/Subdirs)) \ | |
952 | $(all-Depend-files) | |
953 | $(AWK) -f $< \ | |
954 | -v subdirs='$(all-subdirs)' \ | |
955 | -v srcpfx='$(..)' \ | |
956 | $(filter %/Subdirs %/Depend,$^) > $@-tmp | |
bb41a976 | 957 | mv -f $@-tmp $@ |
9de06f3c | 958 | $(all-Depend-files): ; |
b7e2d9a5 | 959 | endif |
bb41a976 | 960 | |
16cd816f RM |
961 | # This gives partial TARGET:SOURCE pattern pairs to have rules |
962 | # emitted into sysd-rules. A sysdeps Makeconfig fragment can | |
963 | # add its own special object file prefix to this list with e.g. foo-%:% | |
964 | # to have foo-*.? compiled from *.? using $(foo-CPPFLAGS). | |
bc96fbda | 965 | sysd-rules-patterns := %:% rtld-%:rtld-% rtld-%:% m_%:s_% |
16cd816f | 966 | |
083973f3 | 967 | # Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here. |
e0a3ed4f | 968 | sysdep-makeconfigs := $(wildcard $(+sysdep_dirs:=/Makeconfig)) |
083973f3 | 969 | ifneq (,$(sysdep-makeconfigs)) |
e0a3ed4f | 970 | include $(sysdep-makeconfigs) |
083973f3 RM |
971 | endif |
972 | ||
363a641b | 973 | # Compute just the target patterns. Makeconfig has set sysd-rules-patterns. |
bc96fbda AS |
974 | sysd-rules-targets := $(sort $(foreach p,$(sysd-rules-patterns),\ |
975 | $(firstword $(subst :, ,$p)))) | |
083973f3 | 976 | |
28f540f4 | 977 | endif # Makeconfig not yet included |
c238ecf7 UD |
978 | |
979 | # Local Variables: | |
980 | # mode: makefile | |
981 | # End: |