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