1 # Copyright (C) 1991, 1992 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Library General Public License as
6 # published by the Free Software Foundation; either version 2 of the
7 # License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Library General Public License for more details.
14 # You should have received a copy of the GNU Library General Public
15 # License along with the GNU C Library; see the file COPYING.LIB. If
16 # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 # Cambridge, MA 02139, USA.
20 # Makefile configuration options for the GNU C library.
23 This makefile requires GNU Make.
26 ifneq "$(origin +included-Makeconfig)" "file"
28 +included-Makeconfig := yes
34 # If config.make exists, the source directory was configured,
35 # so don't try to be clever and find another directory to build in.
36 ifneq (,$(wildcard $(..)config.make))
39 else # Not configured.
47 # Directory for object files and libc.a. If this is not defined, the
48 # object files live in the subdirectories where their sources live, and
49 # libc.a lives in the parent directory (this probably doesn't work any
52 ifeq ($(filter /%,$(ARCH)),)
53 objdir := $(..)$(ARCH)
59 # $(common-objdir) is the place to put objects and
60 # such that are not specific to a single subdir.
63 common-objpfx = $(objpfx)
64 common-objdir = $(objdir)
71 # This is a kludge. make wizards might grok.
72 common-objpfx = sysdeps/../
76 libc.a = $(common-objpfx)libc.a
79 # Get the values defined by options to `configure'.
80 include $(common-objpfx)config.make
82 # Force the user to configure before making.
84 @echo The GNU C library has not been configured. >&2
85 @echo Run \`configure\' to configure it before building. >&2
88 # Get the user's configuration parameters.
89 ifneq ($(wildcard $(..)configparms),)
90 include $(..)configparms
93 ifneq ($(wildcard $(objpfx)configparms),)
94 include $(objpfx)configparms
99 #### These are the configuration variables. You can define values for
100 #### the variables below in the file `configparms'.
101 #### Do NOT edit this file.
105 # Common prefix for machine-independent installation directories.
110 # Common prefix for machine-dependent installation directories.
112 exec_prefix = $(prefix)
115 # Where to install the library and object files.
117 libdir = $(exec_prefix)/lib
120 # Where to install the header files.
122 includedir = $(exec_prefix)/include
125 # Define if the library should install its own <stddef.h>.
126 # Do this unless you are using version 2.2 or later of GCC.
131 # Define if the library should install its own <stdarg.h>.
132 # Do this unless you are using version 2.3 or later of GCC.
134 stdarg.h := stdarg.h $(wildcard va-*.h)
137 # Where to install machine-independent data files.
138 # These are the timezone database, and eventually the locale database.
140 datadir = $(prefix)/lib
143 # Where to install programs.
145 bindir = $(exec_prefix)/bin
148 # What timezone should be the installed default (e.g., US/Eastern).
149 # Run `make -C time echo-zonenames' to see a list of available zone names.
150 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
155 # Where to install the "localtime" timezone file; this is the file
156 # whose contents $(localtime) specifies. If this is a relative
157 # pathname, it is relative to $(datadir)/zoneinfo.
158 ifndef localtime-file
159 localtime-file = $(prefix)/etc/localtime
162 # What timezone's DST rules should be used when a POSIX-style TZ
163 # environment variable doesn't specify any rules. For 1003.1 compliance
164 # this timezone must use rules that are as U.S. federal law defines DST.
165 # Run `make -C time echo-zonenames' to see a list of available zone names.
166 # This setting can be changed with `zic -p TIMEZONE' at any time.
168 posixrules = US/Eastern
171 # Where to install the "posixrules" timezone file; this is file
172 # whose contents $(posixrules) specifies. If this is a relative
173 # pathname, it is relative to $(datadir)/zoneinfo.
174 ifndef posixrules-file
175 posixrules-file = posixrules
179 # Directory where your system's native header files live.
180 # This is used on Unix systems to generate some GNU libc header files.
182 sysincludedir = /usr/include
186 # Commands to install files.
188 INSTALL_DATA = $(INSTALL) -m 644
190 ifndef INSTALL_PROGRAM
191 INSTALL_PROGRAM = $(INSTALL)
198 # The name of the C compiler.
199 # If you've got GCC, and it works, use it.
200 ifeq ($(origin CC),default)
204 # These are preprocessor macros we want to predefine. Define HAVE_GNU_LD
205 # if using GNU ld (which you should do if possible). If you do this, you
206 # may need the GNU assembler as well. If you don't do this, your library
207 # won't work as well (and won't be strictly compliant with the ANSI C
208 # and POSIX.1 standards).
209 +defines = $(config-defines) $(defines)
211 # Default flags to pass the C compiler.
212 ifndef default_cflags
213 +default_cflags := -g
216 # Flags to pass the C compiler when assembling preprocessed assembly code
217 # (`.S' files). On some systems the assembler doesn't understand the `#' line
218 # directives the preprocessor produces. If you have troubling compiling
219 # assembly code, try using -P here to suppress these directives.
224 # Command for linking programs with the C library.
226 +link = $(CC) -nostdlib -o $@ $(common-objpfx)start.o $(^:lib=$(libc.a)) \
241 # Define non-empty if the C compiler understands -v (print version).
242 +cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc
244 # Extra flags to pass to GCC.
245 +gccwarn := -Wall -Wwrite-strings
246 +gccopt := -fstrength-reduce
248 # This is the program that generates makefile
249 # dependencies from C source files.
254 # The program that makes Emacs-style TAGS files.
257 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
258 # perhaps others) to preprocess assembly code in some cases.
262 #### End of configuration variables.
265 # This tells some versions of GNU make before 3.63 not to export all variables.
268 # We want to echo the commands we're running without
269 # umpteem zillion filenames along with it (we use `...' instead)
270 # but we don't want this echoing done when the user has said
271 # he doesn't want to see commands echoed by using -s.
272 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
273 +cmdecho := echo >/dev/null
278 # These are the flags given to the compiler to tell
279 # it what sort of optimization and/or debugging output to do.
281 # If `CFLAGS' was defined, use that.
283 +cflags := $(filter-out -I%,$(CFLAGS))
287 # If none of the above worked, default to "-g".
288 ifeq "$(strip $(+cflags))" ""
289 +cflags := $(+default_cflags)
290 endif # $(+cflags) == ""
292 # If using gcc, add flags that only it will grok.
293 ifneq "$(findstring gcc,$(CC))" ""
294 +cflags := $(+cflags) $(+gccwarn)
295 ifneq "$(filter -O,$(+cflags))" ""
296 +cflags := $(+cflags) $(+gccopt)
303 # Don't duplicate options if we inherited variables from the parent.
304 +cflags := $(sort $(+cflags))
307 ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v
308 ifneq "$(strip $(+cc_version))" ""
309 # If Make is telling us version info, tell the compiler to do so as well.
314 # These are flags given to the C compiler to
315 # tell it to look for include files (including ones
316 # given in angle brackets) in the current directory
317 # and in the parent library source directory.
319 +includes = -I. -I$(patsubst %/,%,$(..)) $(includes)
321 +includes = -I. $(includes)
325 # These are the variables that the implicit compilation rules use.
326 CPPFLAGS = $(+includes) $(+defines) -DLIBC
327 override CFLAGS = $(+cflags)
330 # This is the macro that the implicit linking rules use.
331 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
336 ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
341 endif # Makeconfig not yet included