mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
937 lines
30 KiB
Plaintext
937 lines
30 KiB
Plaintext
# Copyright (C) 1991-2000, 2001 Free Software Foundation, Inc.
|
||
# This file is part of the GNU C Library.
|
||
|
||
# The GNU C Library is free software; you can redistribute it and/or
|
||
# modify it under the terms of the GNU Lesser General Public
|
||
# License as published by the Free Software Foundation; either
|
||
# version 2.1 of the License, or (at your option) any later version.
|
||
|
||
# The GNU C Library is distributed in the hope that it will be useful,
|
||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
# Lesser General Public License for more details.
|
||
|
||
# You should have received a copy of the GNU Lesser General Public
|
||
# License along with the GNU C Library; if not, write to the Free
|
||
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||
# 02111-1307 USA.
|
||
|
||
#
|
||
# Makefile configuration options for the GNU C library.
|
||
#
|
||
ifneq (,)
|
||
This makefile requires GNU Make.
|
||
endif
|
||
|
||
all: # Make this the default goal
|
||
|
||
ifneq "$(origin +included-Makeconfig)" "file"
|
||
|
||
+included-Makeconfig := yes
|
||
|
||
ifdef subdir
|
||
.. := ../
|
||
endif
|
||
|
||
# If config.make exists, the source directory was configured,
|
||
# so don't try to be clever and find another directory to build in.
|
||
ifneq (,$(wildcard $(..)config.make))
|
||
ARCH =
|
||
machine =
|
||
else # Not configured.
|
||
ifndef ARCH
|
||
ifdef machine
|
||
ARCH = $(machine)
|
||
endif # machine
|
||
endif # ARCH
|
||
endif # config.make
|
||
|
||
# Directory for object files and libc.a. If this is not defined, the
|
||
# object files live in the subdirectories where their sources live, and
|
||
# libc.a lives in the parent directory (this probably doesn't work any
|
||
# more).
|
||
ifdef ARCH
|
||
ifeq ($(filter /%,$(ARCH)),)
|
||
objdir := $(..)$(ARCH)
|
||
else
|
||
objdir = $(ARCH)
|
||
endif
|
||
endif
|
||
|
||
# $(common-objdir) is the place to put objects and
|
||
# such that are not specific to a single subdir.
|
||
ifdef objdir
|
||
objpfx := $(patsubst %//,%/,$(objdir)/$(subdir)/)
|
||
common-objpfx = $(objdir)/
|
||
common-objdir = $(objdir)
|
||
else
|
||
objpfx :=
|
||
ifdef ..
|
||
common-objpfx = $(..)
|
||
common-objdir = ..
|
||
else
|
||
# This is a kludge. make wizards might grok.
|
||
common-objpfx = sysdeps/../
|
||
common-objdir = .
|
||
endif
|
||
endif
|
||
|
||
# Root of the sysdeps tree.
|
||
sysdep_dir := $(..)sysdeps
|
||
export sysdep_dir := $(sysdep_dir)
|
||
|
||
# Get the values defined by options to `configure'.
|
||
include $(common-objpfx)config.make
|
||
|
||
# We have a special subdir for each binary format.
|
||
# For now, only ELF is fully supported.
|
||
ifeq ($(elf),yes)
|
||
binfmt-subdir = elf
|
||
else
|
||
# This is probably better than nothing.
|
||
binfmt-subdir = aout
|
||
endif
|
||
|
||
# Complete path to sysdep dirs.
|
||
export full_config_sysdirs := $(addprefix $(..),$(config-sysdirs))
|
||
|
||
# Run config.status to update config.make and config.h. We don't show the
|
||
# dependence of config.h to Make, because it is only touched when it
|
||
# changes and so config.status would be run every time; the dependence of
|
||
# config.make should suffice to force regeneration and re-exec, and the new
|
||
# image will notice if config.h changed.
|
||
$(common-objpfx)config.make: $(common-objpfx)config.status \
|
||
$(..)config.make.in $(..)config.h.in
|
||
cd $(<D); $(SHELL) $(<F)
|
||
|
||
# Find all the sysdeps configure fragments, to make sure we re-run
|
||
# configure when any of them changes.
|
||
$(common-objpfx)config.status: $(..)version.h $(..)configure \
|
||
$(foreach dir,$(full_config_sysdirs),\
|
||
$(wildcard \
|
||
$(dir)/Implies) \
|
||
$(patsubst %.in,%,\
|
||
$(firstword $(wildcard \
|
||
$(addprefix $(dir)/,configure configure.in)))))
|
||
@cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
|
||
echo The GNU C library has not been configured. >&2; \
|
||
echo Run \`configure\' to configure it before building. >&2; \
|
||
echo Try \`configure --help\' for more details. >&2; \
|
||
exit 1; fi
|
||
|
||
# We don't want CPPFLAGS to be exported to the command running configure.
|
||
unexport CPPFLAGS
|
||
|
||
# Get the user's configuration parameters.
|
||
ifneq ($(wildcard $(..)configparms),)
|
||
include $(..)configparms
|
||
endif
|
||
ifneq ($(objpfx),)
|
||
ifneq ($(wildcard $(common-objpfx)configparms),)
|
||
include $(common-objpfx)configparms
|
||
endif
|
||
endif
|
||
|
||
####
|
||
#### These are the configuration variables. You can define values for
|
||
#### the variables below in the file `configparms'.
|
||
#### Do NOT edit this file.
|
||
####
|
||
|
||
|
||
# Set this to either `stdio' or `libio', to compile in either GNU stdio
|
||
# or GNU libio.
|
||
ifndef stdio
|
||
stdio = stdio
|
||
endif
|
||
|
||
# Common prefix for machine-independent installation directories.
|
||
ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
|
||
prefix = /usr/local
|
||
endif
|
||
|
||
# Decide whether we shall build the programs or not. We always do this
|
||
# unless the user tells us (in configparms) or we are building for a
|
||
# standalone target.
|
||
ifndef build-programs
|
||
ifneq ($(config-os),none)
|
||
build-programs=yes
|
||
else
|
||
build-programs=no
|
||
endif
|
||
endif
|
||
|
||
# Common prefix for machine-dependent installation directories.
|
||
ifeq ($(origin exec_prefix),undefined)
|
||
exec_prefix = $(prefix)
|
||
endif
|
||
|
||
# Where to install the library and object files.
|
||
ifndef libdir
|
||
libdir = $(exec_prefix)/lib
|
||
endif
|
||
inst_libdir = $(install_root)$(libdir)
|
||
|
||
# Where to install the shared library and dynamic linker.
|
||
ifndef slibdir
|
||
slibdir = $(exec_prefix)/lib
|
||
endif
|
||
inst_slibdir = $(install_root)$(slibdir)
|
||
|
||
# Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
|
||
# the prefix is spliced between `lib' and the name, so the linker switch
|
||
# `-l$(libprefix)NAME' finds the library; for other files the prefix is
|
||
# just prepended to the whole file name.
|
||
ifeq ($(origin libprefix),undefined)
|
||
libprefix =
|
||
endif
|
||
|
||
# Where to install the header files.
|
||
ifndef includedir
|
||
includedir = $(exec_prefix)/include
|
||
endif
|
||
inst_includedir = $(install_root)$(includedir)
|
||
|
||
# Where to install machine-independent data files.
|
||
# These are the timezone database, and the locale database.
|
||
ifndef datadir
|
||
datadir = $(prefix)/share
|
||
endif
|
||
inst_datadir = $(install_root)$(datadir)
|
||
|
||
# Where to install the timezone data files (which are machine-independent).
|
||
ifndef zonedir
|
||
zonedir = $(datadir)/zoneinfo
|
||
endif
|
||
inst_zonedir = $(install_root)$(zonedir)
|
||
|
||
# Where to install the locale files.
|
||
ifndef localedir
|
||
localedir = $(libdir)/locale
|
||
endif
|
||
inst_localedir = $(install_root)$(localedir)
|
||
|
||
# Where to install the message catalog data files (which are
|
||
# machine-independent).
|
||
ifndef msgcatdir
|
||
msgcatdir = $(datadir)/locale
|
||
endif
|
||
inst_msgcatdir = $(install_root)$(msgcatdir)
|
||
|
||
# Where to install the locale charmap source files.
|
||
ifndef i18ndir
|
||
i18ndir = $(datadir)/i18n
|
||
endif
|
||
inst_i18ndir = $(install_root)$(i18ndir)
|
||
|
||
# Where to install the shared object for charset transformation.
|
||
ifndef gconvdir
|
||
gconvdir = $(libdir)/gconv
|
||
endif
|
||
inst_gconvdir = $(install_root)$(gconvdir)
|
||
|
||
# Where to install programs.
|
||
ifndef bindir
|
||
bindir = $(exec_prefix)/bin
|
||
endif
|
||
inst_bindir = $(install_root)$(bindir)
|
||
|
||
# Where to install internal programs.
|
||
ifndef libexecdir
|
||
libexecdir = $(exec_prefix)/libexec
|
||
endif
|
||
inst_libexecdir = $(install_root)$(libexecdir)
|
||
|
||
# Where to install administrative programs.
|
||
ifndef rootsbindir
|
||
rootsbindir = $(exec_prefix)/sbin
|
||
endif
|
||
inst_rootsbindir = $(install_root)$(rootsbindir)
|
||
|
||
ifndef sbindir
|
||
sbindir = $(exec_prefix)/sbin
|
||
endif
|
||
inst_sbindir = $(install_root)$(sbindir)
|
||
|
||
# Where to install the Info files.
|
||
ifndef infodir
|
||
infodir = $(prefix)/info
|
||
endif
|
||
inst_infodir = $(install_root)$(infodir)
|
||
|
||
# Where to install default configuration files. These include the local
|
||
# timezone specification and network data base files.
|
||
ifndef sysconfdir
|
||
sysconfdir = $(prefix)/etc
|
||
endif
|
||
inst_sysconfdir = $(install_root)$(sysconfdir)
|
||
|
||
# What timezone should be the installed default (e.g., US/Eastern).
|
||
# Run `make -C time echo-zonenames' to see a list of available zone names.
|
||
# The local timezone can be changed with `zic -l TIMEZONE' at any time.
|
||
ifndef localtime
|
||
localtime = Factory
|
||
endif
|
||
|
||
# Where to install the "localtime" timezone file; this is the file whose
|
||
# contents $(localtime) specifies. If this is a relative pathname, it is
|
||
# relative to $(zonedir). It is a good idea to put this somewhere
|
||
# other than there, so the zoneinfo directory contains only universal data,
|
||
# localizing the configuration data elsewhere.
|
||
ifndef localtime-file
|
||
localtime-file = $(sysconfdir)/localtime
|
||
inst_localtime-file = $(install_root)$(localtime-file)
|
||
endif
|
||
|
||
# What to use for leap second specifications in compiling the default
|
||
# timezone files. Set this to `/dev/null' for no leap second handling as
|
||
# 1003.1 requires, or to `leapseconds' for proper leap second handling.
|
||
# Both zone flavors are always available as `posix/ZONE' and `right/ZONE'.
|
||
# This variable determines the default: if it's `/dev/null',
|
||
# ZONE==posix/ZONE; if it's `leapseconds', ZONE==right/ZONE.
|
||
ifndef leapseconds
|
||
leapseconds = /dev/null
|
||
endif
|
||
|
||
# What timezone's DST rules should be used when a POSIX-style TZ
|
||
# environment variable doesn't specify any rules. For 1003.1 compliance
|
||
# this timezone must use rules that are as U.S. federal law defines DST.
|
||
# Run `make -C time echo-zonenames' to see a list of available zone names.
|
||
# This setting can be changed with `zic -p TIMEZONE' at any time.
|
||
# If you want POSIX.1 compatibility, use `America/New_York'.
|
||
ifndef posixrules
|
||
posixrules = America/New_York
|
||
endif
|
||
|
||
# Where to install the "posixrules" timezone file; this is file
|
||
# whose contents $(posixrules) specifies. If this is a relative
|
||
# pathname, it is relative to $(zonedir).
|
||
ifndef posixrules-file
|
||
posixrules-file = posixrules
|
||
endif
|
||
|
||
|
||
# Directory where your system's native header files live.
|
||
# This is used on Unix systems to generate some GNU libc header files.
|
||
ifndef sysincludedir
|
||
sysincludedir = /usr/include
|
||
endif
|
||
|
||
|
||
# Commands to install files.
|
||
ifndef INSTALL_DATA
|
||
INSTALL_DATA = $(INSTALL) -m 644
|
||
endif
|
||
ifndef INSTALL_SCRIPT
|
||
INSTALL_SCRIPT = $(INSTALL)
|
||
endif
|
||
ifndef INSTALL_PROGRAM
|
||
INSTALL_PROGRAM = $(INSTALL)
|
||
endif
|
||
ifndef INSTALL
|
||
INSTALL = install
|
||
endif
|
||
|
||
|
||
# The name of the C compiler.
|
||
# If you've got GCC, and it works, use it.
|
||
ifeq ($(origin CC),default)
|
||
CC := gcc
|
||
endif
|
||
|
||
# The name of the C compiler to use for compilations of programs to run on
|
||
# the host that is building the library. If you set CC to a
|
||
# cross-compiler, you must set this to the normal compiler.
|
||
ifndef BUILD_CC
|
||
BUILD_CC = $(CC)
|
||
endif
|
||
|
||
# Default flags to pass the C compiler.
|
||
ifndef default_cflags
|
||
ifeq ($(release),stable)
|
||
default_cflags := -g -O2
|
||
else
|
||
default_cflags := -g -O
|
||
endif
|
||
endif
|
||
|
||
# Flags to pass the C compiler when assembling preprocessed assembly code
|
||
# (`.S' files). On some systems the assembler doesn't understand the `#' line
|
||
# directives the preprocessor produces. If you have troubling compiling
|
||
# assembly code, try using -P here to suppress these directives.
|
||
ifndef asm-CPPFLAGS
|
||
asm-CPPFLAGS =
|
||
endif
|
||
|
||
# ELF always supports init/fini sections
|
||
ifeq ($(elf),yes)
|
||
have-initfini = yes
|
||
endif
|
||
|
||
# Installed name of the startup code.
|
||
ifneq ($(have-initfini),yes)
|
||
# When not having init/fini, there is just one startfile, called crt0.o.
|
||
start-installed-name = crt0.o
|
||
else
|
||
# On systems having init/fini, crt0.o is called crt1.o, and there are
|
||
# some additional bizarre files.
|
||
start-installed-name = crt1.o
|
||
endif
|
||
# On systems that do not need a special startfile for statically linked
|
||
# binaries, simply set it to the normal name.
|
||
ifndef static-start-installed-name
|
||
static-start-installed-name = $(start-installed-name)
|
||
endif
|
||
|
||
ifeq (yesyesyes,$(build-shared)$(elf)$(have-z-combreloc))
|
||
combreloc-LDFLAGS = -Wl,-z,combreloc
|
||
LDFLAGS.so += $(combreloc-LDFLAGS)
|
||
LDFLAGS-rtld += $(combreloc-LDFLAGS)
|
||
endif
|
||
|
||
# Command for linking programs with the C library.
|
||
ifndef +link
|
||
+link = $(CC) -nostdlib -nostartfiles -o $@ \
|
||
$(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
|
||
$(combreloc-LDFLAGS) \
|
||
$(addprefix $(csu-objpfx),$(start-installed-name)) \
|
||
$(+preinit) $(+prector) \
|
||
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||
$(start-installed-name))\
|
||
$(+preinit) $(link-extra-libs) \
|
||
$(common-objpfx)libc% $(+postinit),$^) \
|
||
$(link-extra-libs) $(link-libc) $(+postctor) $(+postinit)
|
||
endif
|
||
# Command for statically linking programs with the C library.
|
||
ifndef +link-static
|
||
+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
|
||
$(sysdep-LDFLAGS) $(LDFLAGS) \
|
||
$(addprefix $(csu-objpfx),$(static-start-installed-name)) \
|
||
$(+preinit) $(+prector) \
|
||
$(filter-out $(addprefix $(csu-objpfx),start.o \
|
||
$(start-installed-name))\
|
||
$(+preinit) $(link-extra-libs-static) \
|
||
$(common-objpfx)libc% $(+postinit),$^) \
|
||
$(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
|
||
endif
|
||
# Command for statically linking bounded-pointer programs with the C library.
|
||
ifndef +link-bounded
|
||
+link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
|
||
$(sysdep-LDFLAGS) $(LDFLAGS) \
|
||
$(addprefix $(csu-objpfx),b$(static-start-installed-name)) \
|
||
$(+preinit) $(+prector) \
|
||
$(filter-out $(addprefix $(csu-objpfx),start.ob \
|
||
$(start-installed-name))\
|
||
$(+preinit) $(link-extra-libs-bounded) \
|
||
$(common-objpfx)libc% $(+postinit),$^) \
|
||
$(link-extra-libs-bounded) $(link-libc-bounded) $(+postctor) $(+postinit)
|
||
endif
|
||
ifndef config-LDFLAGS
|
||
ifeq (yesyes,$(build-shared)$(elf))
|
||
config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
|
||
endif
|
||
endif
|
||
ifndef link-libc
|
||
ifeq (yes,$(build-shared))
|
||
ifeq ($(elf),yes)
|
||
# We need the versioned name of libc.so in the deps of $(others) et al
|
||
# so that the symlink to libc.so is created before anything tries to
|
||
# run the linked programs.
|
||
link-libc = -Wl,-rpath-link=$(rpath-link) \
|
||
$(common-objpfx)libc.so$(libc.so-version) \
|
||
$(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
|
||
# This is how to find at build-time things that will be installed there.
|
||
rpath-dirs = math elf dlfcn nss nis rt resolv crypt
|
||
else
|
||
ifneq (,$(findstring aix,$(config-os)))
|
||
link-libc = $(common-objpfx)libc.a \
|
||
$(common-objpfx)$(patsubst %,$(libtype.oS),c) $(gnulib)
|
||
rpath-dirs = math dlfcn nss nis rt resolv crypt
|
||
endif
|
||
endif
|
||
rpath-link = \
|
||
$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
|
||
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
|
||
else
|
||
nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
|
||
resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
|
||
link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
|
||
endif
|
||
endif
|
||
|
||
# Differences in the linkers on the various platforms.
|
||
ifeq ($(elf),yes)
|
||
LDFLAGS-rpath-ORIGIN = -Wl,-rpath,'$$ORIGIN'
|
||
LDFLAGS-soname-fname = -Wl,-soname,$(@F)
|
||
LDFLAGS-rdynamic = -rdynamic
|
||
LDFLAGS-Bsymbolic = -Bsymbolic
|
||
else
|
||
ifneq (,$(findstring aix,$(config-os)))
|
||
LDFLAGS-rpath-ORIGIN =
|
||
LDFLAGS-soname-fname =
|
||
LDFLAGS-rdynamic = -Wl,-bdynamic
|
||
LDFLAGS-Bsymbolic = -Wl,-bsymbolic
|
||
endif
|
||
endif
|
||
|
||
# Choose the default search path for the dynamic linker based on
|
||
# where we will install libraries.
|
||
ifneq ($(libdir),$(slibdir))
|
||
default-rpath = $(slibdir):$(libdir)
|
||
else
|
||
default-rpath = $(libdir)
|
||
endif
|
||
|
||
ifndef link-extra-libs
|
||
ifeq (yes,$(build-shared))
|
||
ifneq ($(common-objpfx),$(objpfx))
|
||
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),\
|
||
$(wildcard $(common-objpfx)$(lib).so$($(notdir $(lib)).so-version) \
|
||
$(objpfx)$(lib).so$($(notdir $(lib)).so-version)))
|
||
else
|
||
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).so$($(notdir $(lib)).so-version))
|
||
endif
|
||
else
|
||
link-extra-libs = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
|
||
endif
|
||
endif
|
||
|
||
# The static libraries.
|
||
ifeq (yes,$(build-static))
|
||
link-libc-static = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
|
||
link-extra-libs-static = $(foreach lib,$(LDLIBS-$(@F)),$(common-objpfx)$(lib).a)
|
||
else
|
||
ifeq (yes,$(build-shared))
|
||
# We can try to link the programs with lib*_pic.a...
|
||
link-libc-static = $(gnulib) $(common-objpfx)libc_pic.a
|
||
link-extra-libs-static = $(link-extra-libs)
|
||
endif
|
||
endif
|
||
link-libc-bounded = $(common-objpfx)libc_b.a $(gnulib) $(common-objpfx)libc_b.a
|
||
link-extra-libs-bounded = $(foreach lib,$(LDLIBS-$(@F:%-bp=%)),$(common-objpfx)$(lib)_b.a)
|
||
|
||
ifndef gnulib
|
||
gnulib := -lgcc
|
||
endif
|
||
ifeq ($(elf),yes)
|
||
+preinit = $(addprefix $(csu-objpfx),crti.o)
|
||
+postinit = $(addprefix $(csu-objpfx),crtn.o)
|
||
+prector = `$(CC) --print-file-name=crtbegin.o`
|
||
+postctor = `$(CC) --print-file-name=crtend.o`
|
||
+interp = $(addprefix $(elf-objpfx),interp.os)
|
||
endif
|
||
csu-objpfx = $(common-objpfx)csu/
|
||
elf-objpfx = $(common-objpfx)elf/
|
||
|
||
# How to run a program we just linked with our library.
|
||
# The program binary is assumed to be $(word 2,$^).
|
||
built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
|
||
ifeq (yesyes,$(build-shared)$(elf))
|
||
comma = ,
|
||
sysdep-library-path = \
|
||
$(subst $(empty) ,:,$(strip $(patsubst -Wl$(comma)-rpath-link=%, %,\
|
||
$(filter -Wl$(comma)-rpath-link=%,\
|
||
$(sysdep-LDFLAGS)))))
|
||
run-program-prefix = $(if $(findstring $(notdir $(built-program-file)), $(tests-static)),, \
|
||
$(elf-objpfx)$(rtld-installed-name) \
|
||
--library-path $(rpath-link)$(patsubst %,:%,$(sysdep-library-path)))
|
||
else
|
||
run-program-prefix =
|
||
endif
|
||
# Never use $(run-program-prefix) for the statically-linked %-bp test programs
|
||
built-program-cmd = $(patsubst %,$(run-program-prefix),\
|
||
$(filter-out %-bp,$(built-program-file))) \
|
||
$(built-program-file)
|
||
|
||
ifndef LD
|
||
LD := ld -X
|
||
endif
|
||
|
||
ifndef RANLIB
|
||
RANLIB = ranlib
|
||
endif
|
||
|
||
# Extra flags to pass to GCC.
|
||
ifeq ($(all-warnings),yes)
|
||
+gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes -Wcast-qual -Wbad-function-cast -Wmissing-noreturn -Wmissing-prototypes -Wmissing-declarations -Wcomment -Wcomments -Wtrigraphs -Wsign-compare -Wfloat-equal -Wmultichar
|
||
else
|
||
+gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes
|
||
endif
|
||
|
||
# This is the program that generates makefile
|
||
# dependencies from C source files.
|
||
ifndef +mkdep
|
||
+mkdep = $(CC) -M
|
||
endif
|
||
|
||
# The program that makes Emacs-style TAGS files.
|
||
ETAGS := etags
|
||
|
||
# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
|
||
# perhaps others) to preprocess assembly code in some cases.
|
||
M4 = m4
|
||
|
||
# To force installation of files even if they are older than the
|
||
# installed files. This variable is included in the dependency list
|
||
# of all installation targets.
|
||
ifeq ($(force-install),yes)
|
||
+force = force-install
|
||
else
|
||
+force =
|
||
endif
|
||
|
||
####
|
||
#### End of configuration variables.
|
||
####
|
||
|
||
# This tells some versions of GNU make before 3.63 not to export all variables.
|
||
.NOEXPORT:
|
||
|
||
# We want to echo the commands we're running without
|
||
# umpteen zillion filenames along with it (we use `...' instead)
|
||
# but we don't want this echoing done when the user has said
|
||
# he doesn't want to see commands echoed by using -s.
|
||
ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
|
||
+cmdecho := echo >/dev/null
|
||
else # not -s
|
||
+cmdecho := echo
|
||
endif # -s
|
||
|
||
# These are the flags given to the compiler to tell
|
||
# it what sort of optimization and/or debugging output to do.
|
||
ifndef +cflags
|
||
# If `CFLAGS' was defined, use that.
|
||
ifdef CFLAGS
|
||
+cflags := $(filter-out -I%,$(CFLAGS))
|
||
endif # CFLAGS
|
||
endif # +cflags
|
||
|
||
# If none of the above worked, default to "-g -O".
|
||
ifeq "$(strip $(+cflags))" ""
|
||
+cflags := $(default_cflags)
|
||
endif # $(+cflags) == ""
|
||
|
||
+cflags := $(+cflags) $(+gccwarn)
|
||
+gcc-nowarn := -w
|
||
|
||
# Don't duplicate options if we inherited variables from the parent.
|
||
+cflags := $(sort $(+cflags))
|
||
|
||
|
||
# These are flags given to the C compiler to tell it to look for include
|
||
# files (including ones given in angle brackets) in the current directory,
|
||
# in the parent library source directory and in the include directory.
|
||
# `+sysdep-includes' will be defined by Makerules.
|
||
+includes = -I$(..)include -I. \
|
||
$(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
|
||
$($(stdio)-include) $(includes) \
|
||
$(+sysdep-includes) $(last-includes) $(sysincludes)
|
||
|
||
# Since libio has several internal header files, we use a -I instead
|
||
# of many little headers in the include directory.
|
||
libio-include = -I$(..)libio
|
||
|
||
# These are the variables that the implicit compilation rules use.
|
||
CPPFLAGS = $($(subdir)-CPPFLAGS) $(+includes) $(defines) \
|
||
-include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \
|
||
$(CPPFLAGS-$(suffix $@)) $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F))
|
||
override CFLAGS = $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
|
||
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
|
||
|
||
# If everything is compiled with -fPIC (implicitly) we must tell this by
|
||
# defining the PIC symbol.
|
||
ifeq (yes,$(build-pic-default))
|
||
pic-default = -DPIC
|
||
endif
|
||
|
||
# Enable object files for different versions of the library.
|
||
# Various things use $(object-suffixes) to know what all to make.
|
||
# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
|
||
# to pass different flags for each flavor.
|
||
libtypes = $(foreach o,$(object-suffixes-for-libc),$(libtype$o))
|
||
all-object-suffixes := .o .os .op .og .ob .oS
|
||
object-suffixes :=
|
||
CPPFLAGS-.o = $(pic-default)
|
||
CFLAGS-.o = $(filter %frame-pointer,$(+cflags))
|
||
ifeq (yes,$(build-static))
|
||
libtype.o := lib%.a
|
||
object-suffixes += .o
|
||
endif
|
||
ifeq (yes,$(build-shared))
|
||
# Under --enable-shared, we will build a shared library of PIC objects.
|
||
# The PIC object files are named foo.os.
|
||
object-suffixes += .os
|
||
CPPFLAGS-.os = -DPIC -DSHARED
|
||
CFLAGS-.os = $(filter %frame-pointer,$(+cflags)) $(pic-ccflag)
|
||
libtype.os := lib%_pic.a
|
||
# This can be changed by a sysdep makefile
|
||
pic-ccflag = -fPIC
|
||
endif
|
||
ifeq (yes,$(build-profile))
|
||
# Under --enable-profile, we will build a static library of profiled objects.
|
||
# The profiled object files are named foo.op.
|
||
object-suffixes += .op
|
||
CPPFLAGS-.op = -DPROF $(pic-default)
|
||
CFLAGS-.op = -pg
|
||
libtype.op = lib%_p.a
|
||
endif
|
||
ifeq (yes,$(build-omitfp))
|
||
# Under --enable-omitfp, we build the library optimized without
|
||
# debugging information using -fomit-frame-pointer, and build an extra
|
||
# library with debugging information. The debuggable objects are named foo.og.
|
||
object-suffixes += .og
|
||
CPPFLAGS-.og = $(pic-default)
|
||
CFLAGS-.og = -g
|
||
CFLAGS-.o = $(filter %frame-pointer,$(+cflags)) -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
|
||
CFLAGS-.os += -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES
|
||
libtype.og = lib%_g.a
|
||
endif
|
||
|
||
bppfx = BP-
|
||
ifeq (yes,$(build-bounded))
|
||
# Under --enable-bounded, we build the library with `-fbounded-pointers -g'
|
||
# to runtime bounds checking. The bounded-pointer objects are named foo.ob.
|
||
# We disable sibling-call optimizations so that stack traces will be complete
|
||
# and thus aid debugging, since after all, BPs are a debugging tool.
|
||
object-suffixes += .ob
|
||
CPPFLAGS-.ob = -fbounded-pointers $(pic-default)
|
||
CFLAGS-.ob = -g -O2 -fno-optimize-sibling-calls -fno-strict-aliasing
|
||
libtype.ob = lib%_b.a
|
||
endif
|
||
|
||
object-suffixes-for-libc := $(object-suffixes)
|
||
|
||
ifeq (yes,$(build-shared))
|
||
# Build special library that contains the static-only routines for libc.
|
||
object-suffixes-for-libc += .oS
|
||
|
||
# Must build the routines as PIC, though, because they can end up in (users')
|
||
# shared objects. We don't want to use CFLAGS-os because users may, for
|
||
# example, make that processor-specific.
|
||
CFLAGS-.oS = $(CFLAGS-.o) $(pic-ccflag)
|
||
CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
|
||
libtype.oS = lib%_nonshared.a
|
||
endif
|
||
|
||
|
||
+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
|
||
|
||
ifndef BUILD_CC
|
||
BUILD_CC = $(CC)
|
||
endif
|
||
|
||
move-if-change = $(SHELL) $(..)scripts/move-if-change
|
||
|
||
-include $(common-objpfx)sysd-dirs
|
||
|
||
ifeq ($(sysd-dirs-done),t)
|
||
-include $(common-objpfx)sysd-sorted
|
||
subdirs = $(sorted-subdirs)
|
||
endif
|
||
|
||
ifeq (yes, $(build-shared))
|
||
|
||
# Commands to put in a pipeline to preprocess a file with # comments
|
||
# %ifdef et al based on config.h settings or other %include'd files.
|
||
define preprocess-versions
|
||
sed '/^[ ]*#/d;s/^[ ]*%/#/' \
|
||
| $(CC) -E -undef -I$(common-objdir) -I$(..)include \
|
||
-include $(common-objpfx)config.h \
|
||
-x assembler-with-cpp - \
|
||
| sed '/^[ ]*#/d;/^[ ]*$$/d'
|
||
endef
|
||
|
||
# Process the shlib-versions file, which tells us what shared library
|
||
# version numbers to use when we install shared objects on this system.
|
||
# We need to wait until $(subdirs) is complete.
|
||
ifeq ($(sysd-sorted-done),t)
|
||
-include $(common-objpfx)soversions.mk
|
||
ifndef avoid-generated
|
||
$(common-objpfx)soversions.i: $(..)shlib-versions $(..)Makeconfig \
|
||
$(wildcard $(patsubst %, $(..)%/shlib-versions,\
|
||
$(add-ons) \
|
||
$(subdirs))) \
|
||
$(common-objpfx)config.make
|
||
cat $(filter-out $(..)Makeconfig $(common-objpfx)config.make,$^) \
|
||
| $(preprocess-versions) \
|
||
| while read conf version setname; do \
|
||
test -n "$$version" && \
|
||
test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
|
||
: "$$conf"` != 0 || continue; \
|
||
if test "x$$version" = xDEFAULT; then \
|
||
default_setname="$$setname"; \
|
||
else \
|
||
lib=`echo $$version | sed 's/=.*$$//'`; \
|
||
if eval test -z "\$${versioned_$${lib}}"; then \
|
||
eval versioned_$${lib}=yes; \
|
||
number=`echo $$version | sed "s/^.*=//"`; \
|
||
echo $$lib $$number $${setname:-$${default_setname}}; \
|
||
fi; \
|
||
fi; \
|
||
done > $@T; exit 0
|
||
mv -f $@T $@
|
||
$(common-objpfx)soversions.mk: $(common-objpfx)soversions.i
|
||
(while read lib number setname; do \
|
||
case $$number in \
|
||
[0-9]*) echo "$$lib.so-version=.$$number"; \
|
||
echo "all-sonames+=$$lib=$$lib.so\$$($$lib.so-version)";;\
|
||
*) echo "$$lib.so-version=$$number"; \
|
||
echo "all-sonames+=$$lib=\$$($$lib.so-version)";;\
|
||
esac; \
|
||
done; \
|
||
echo soversions.mk-done = t;) < $< > $@T; exit 0
|
||
mv -f $@T $@
|
||
endif
|
||
endif
|
||
|
||
postclean-generated += soversions.mk
|
||
|
||
# Generate the header containing the names of all shared libraries.
|
||
# We use a stamp file to avoid uncessary recompilations.
|
||
before-compile += $(common-objpfx)gnu/lib-names.h
|
||
ifeq ($(soversions.mk-done),t)
|
||
$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
|
||
ifneq (,$(findstring aix,$(config-os)))
|
||
$(common-objpfx)gnu/lib-names.stmp: $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h
|
||
$(make-target-directory)
|
||
@rm -f ${@:stmp=T} $@
|
||
@cp $(..)sysdeps/unix/sysv/aix/gnu/lib-names.h $(common-objpfx)gnu
|
||
touch $@
|
||
else
|
||
$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
|
||
$(make-target-directory)
|
||
@rm -f ${@:stmp=T} $@
|
||
(echo '/* This file is automatically generated.';\
|
||
echo ' It defines macros to allow user program to find the shared';\
|
||
echo ' library files which come as part of GNU libc. */';\
|
||
echo '#ifndef __GNU_LIB_NAMES_H'; \
|
||
echo '#define __GNU_LIB_NAMES_H 1'; \
|
||
echo; \
|
||
(libs='$(all-sonames)';\
|
||
for l in $$libs; do \
|
||
name=`echo $$l | sed 's/.*=//'`; \
|
||
upname=`echo $$l | sed 's/=.*//' | \
|
||
tr 'abcdefghijklmnopqrstuvwxyz-' \
|
||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
|
||
upname2=`echo $$name | sed 's/[.]so.*//' | \
|
||
tr 'abcdefghijklmnopqrstuvwxyz-' \
|
||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
|
||
echo "#define $${upname}_SO \"$$name\""; \
|
||
if test $$upname != $$upname2; then \
|
||
echo "#define $${upname2}_SO \"$$name\""; \
|
||
fi; \
|
||
done;) | sort; \
|
||
echo; \
|
||
echo '#endif /* gnu/lib-names.h */';) > ${@:stmp=T}
|
||
$(move-if-change) ${@:stmp=T} ${@:stmp=h}
|
||
touch $@
|
||
endif
|
||
endif
|
||
|
||
common-generated += gnu/lib-names.h gnu/lib-names.stmp
|
||
|
||
# The name under which the run-time dynamic linker is installed.
|
||
# We are currently going for the convention that `/lib/ld.so.1'
|
||
# names the SVR4/ELF ABI-compliant dynamic linker.
|
||
ifndef rtld-installed-name
|
||
ifdef ld.so-version
|
||
rtld-installed-name = $(ld.so-version)
|
||
else
|
||
rtld-installed-name = ld.so.1
|
||
endif
|
||
endif
|
||
|
||
ifndef rtld-version-installed-name
|
||
rtld-version-installed-name = ld-$(version).so
|
||
endif
|
||
|
||
endif # build-shared
|
||
|
||
|
||
ifeq ($(elf),yes)
|
||
dlfcn = dlfcn
|
||
ifeq ($(build-shared),yes)
|
||
libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
|
||
else
|
||
libdl = $(common-objpfx)dlfcn/libdl.a
|
||
endif
|
||
else
|
||
ifneq (,$(findstring aix,$(config-os)))
|
||
ifeq ($(build-shared),yes)
|
||
dlfcn = dlfcn
|
||
libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
|
||
else
|
||
# No libdl without shared libs on AIX
|
||
dlfcn =
|
||
libdl =
|
||
endif
|
||
else
|
||
# No ELF, no AIX - no libdl, at least for now.
|
||
dlfcn =
|
||
libdl =
|
||
endif
|
||
endif
|
||
|
||
# These are the subdirectories containing the library source. The order
|
||
# is more or less arbitrary. The sorting step will take care of the
|
||
# dependencies. Only the $(binfmt-subdir) should always be kept at the
|
||
# end of the list.
|
||
all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
|
||
stdlib stdio-common $(stdio) malloc string wcsmbs time dirent \
|
||
grp pwd posix io termios resource misc socket sysvipc gmon \
|
||
gnulib iconv iconvdata wctype manual shadow po argp \
|
||
crypt $(add-ons) nss localedata timezone rt conform debug \
|
||
$(sysdep-subdirs) $(dlfcn) $(binfmt-subdir)
|
||
all-subdirs := $(filter-out $(sysdep-inhibit-subdirs),$(all-subdirs))
|
||
|
||
# The mach and hurd subdirectories have many generated header files which
|
||
# much of the rest of the library depends on, so it is best to build them
|
||
# first (and mach before hurd, at that). The before-compile additions in
|
||
# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
|
||
# not to exist when making in other directories, but it will be slower that
|
||
# way with more somewhat expensive `make' invocations.
|
||
subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
|
||
$(filter-out mach hurd,$(subdirs))
|
||
|
||
ifndef avoid-generated
|
||
all-Subdirs-files = $(wildcard $(config-sysdirs:%=$(..)%/Subdirs))
|
||
$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
|
||
$(AWK) 'BEGIN { subdirs = ""; inhibit = "" }; \
|
||
/^#/ { next }; \
|
||
/^[^-]/ { subdirs = subdirs " " $$0 }; \
|
||
/^-/ { inhibit = inhibit " " substr($$0, 2) }; \
|
||
END { printf "sysdep-subdirs =%s\n", subdirs; \
|
||
printf "sysdep-inhibit-subdirs =%s\n", inhibit; \
|
||
print "sysd-dirs-done = t" }' \
|
||
$(patsubst $<,/dev/null,$^) > $@-tmp
|
||
mv -f $@-tmp $@
|
||
|
||
all-Depend-files = $(wildcard $(..)*/Depend)
|
||
$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk $(all-Depend-files) \
|
||
$(common-objpfx)sysd-dirs $(..)Makeconfig
|
||
{ { dirs='$(patsubst $(..)%/Depend,$(..)%,$(filter %/Depend,$^))';\
|
||
for d in $$dirs; do \
|
||
while read on; do \
|
||
echo "depend $$d $$on"; \
|
||
done < $$d/Depend; \
|
||
done; \
|
||
for f in $(all-subdirs); do \
|
||
echo $$f; \
|
||
done; \
|
||
} | $(AWK) -f $< && \
|
||
echo sysd-sorted-done = t; \
|
||
} > $@-tmp
|
||
mv -f $@-tmp $@
|
||
endif
|
||
|
||
# Let sysdeps/ subdirs contain a Makeconfig fragment for us to include here.
|
||
sysdep-makeconfigs := $(wildcard $(patsubst %,$(..)%/Makeconfig,\
|
||
$(config-sysdirs) $(add-ons)))
|
||
|
||
ifneq (,$(sysdep-makeconfigs))
|
||
include $(sysdep-makeconfigs)
|
||
endif
|
||
|
||
|
||
endif # Makeconfig not yet included
|