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