1 # Copyright (C) 1991, 1992, 1993 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/../
77 libc.a = $(common-objpfx)libc.a
80 # Get the values defined by options to `configure'.
81 include $(common-objpfx)config.make
83 # Force the user to configure before making.
84 $(common-objpfx)config.make:
85 @echo The GNU C library has not been configured. >&2
86 @echo Run \`configure\' to configure it before building. >&2
89 # Get the user's configuration parameters.
90 ifneq ($(wildcard $(..)configparms),)
91 include $(..)configparms
94 ifneq ($(wildcard $(objpfx)configparms),)
95 include $(objpfx)configparms
100 #### These are the configuration variables. You can define values for
101 #### the variables below in the file `configparms'.
102 #### Do NOT edit this file.
106 # Common prefix for machine-independent installation directories.
111 # Common prefix for machine-dependent installation directories.
113 exec_prefix = $(prefix)
116 # Where to install the library and object files.
118 libdir = $(exec_prefix)/lib
121 # Where to install the header files.
123 includedir = $(exec_prefix)/include
126 # Define if the library should install its own <stddef.h>.
127 # Do this unless you are using version 2.2 or later of GCC.
132 # Define if the library should install its own <stdarg.h>.
133 # Do this unless you are using version 2.3 or later of GCC.
135 stdarg.h := stdarg.h $(wildcard va-*.h)
138 # Where to install machine-independent data files.
139 # These are the timezone database, and eventually the locale database.
141 datadir = $(prefix)/lib
144 # Where to install the timezone data files (which are machine-independent).
146 zonedir = $(datadir)/zoneinfo
149 # Where to install programs.
151 bindir = $(exec_prefix)/bin
154 # Where to install the Info files.
156 infodir = $(prefix)/info
159 # What timezone should be the installed default (e.g., US/Eastern).
160 # Run `make -C time echo-zonenames' to see a list of available zone names.
161 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
166 # Where to install the "localtime" timezone file; this is the file whose
167 # contents $(localtime) specifies. If this is a relative pathname, it is
168 # relative to $(zonedir). It is a good idea to put this somewhere
169 # other than there, so the zoneinfo directory contains only universal data,
170 # localizing the configuration data elsewhere.
171 ifndef localtime-file
172 localtime-file = $(prefix)/etc/localtime
175 # What timezone's DST rules should be used when a POSIX-style TZ
176 # environment variable doesn't specify any rules. For 1003.1 compliance
177 # this timezone must use rules that are as U.S. federal law defines DST.
178 # Run `make -C time echo-zonenames' to see a list of available zone names.
179 # This setting can be changed with `zic -p TIMEZONE' at any time.
181 posixrules = US/Eastern
184 # Where to install the "posixrules" timezone file; this is file
185 # whose contents $(posixrules) specifies. If this is a relative
186 # pathname, it is relative to $(zonedir).
187 ifndef posixrules-file
188 posixrules-file = posixrules
192 # Directory where your system's native header files live.
193 # This is used on Unix systems to generate some GNU libc header files.
195 sysincludedir = /usr/include
199 # Commands to install files.
201 INSTALL_DATA = $(INSTALL) -m 644
203 ifndef INSTALL_PROGRAM
204 INSTALL_PROGRAM = $(INSTALL)
211 # The name of the C compiler.
212 # If you've got GCC, and it works, use it.
213 ifeq ($(origin CC),default)
217 # These are preprocessor macros we want to predefine. Define HAVE_GNU_LD
218 # if using GNU ld (which you should do if possible). If you do this, you
219 # may need the GNU assembler as well. If you don't do this, your library
220 # won't work as well (and won't be strictly compliant with the ANSI C
221 # and POSIX.1 standards).
222 +defines = $(config-defines) $(defines)
224 # Default flags to pass the C compiler.
225 ifndef default_cflags
229 # Flags to pass the C compiler when assembling preprocessed assembly code
230 # (`.S' files). On some systems the assembler doesn't understand the `#' line
231 # directives the preprocessor produces. If you have troubling compiling
232 # assembly code, try using -P here to suppress these directives.
237 # Command for linking programs with the C library.
239 +link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
240 $(common-objpfx)start.o $(^:lib=$(libc.a)) $(gnulib) $(libc.a)
254 # Define non-empty if the C compiler understands -v (print version).
255 +cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc
257 # Extra flags to pass to GCC.
258 +gccwarn := -Wall -Wwrite-strings
259 +gccopt := -fstrength-reduce
261 # This is the program that generates makefile
262 # dependencies from C source files.
267 # The program that makes Emacs-style TAGS files.
270 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
271 # perhaps others) to preprocess assembly code in some cases.
275 #### End of configuration variables.
278 # This tells some versions of GNU make before 3.63 not to export all variables.
281 # We want to echo the commands we're running without
282 # umpteem zillion filenames along with it (we use `...' instead)
283 # but we don't want this echoing done when the user has said
284 # he doesn't want to see commands echoed by using -s.
285 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
286 +cmdecho := echo >/dev/null
291 # These are the flags given to the compiler to tell
292 # it what sort of optimization and/or debugging output to do.
294 # If `CFLAGS' was defined, use that.
296 +cflags := $(filter-out -I%,$(CFLAGS))
300 # If none of the above worked, default to "-g".
301 ifeq "$(strip $(+cflags))" ""
302 +cflags := $(default_cflags)
303 endif # $(+cflags) == ""
305 # If using gcc, add flags that only it will grok.
306 ifneq "$(findstring gcc,$(CC))" ""
307 +cflags := $(+cflags) $(+gccwarn)
308 ifneq "$(filter -O,$(+cflags))" ""
309 +cflags := $(+cflags) $(+gccopt)
316 # Don't duplicate options if we inherited variables from the parent.
317 +cflags := $(sort $(+cflags))
320 ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v
321 ifneq "$(strip $(+cc_version))" ""
322 # If Make is telling us version info, tell the compiler to do so as well.
327 # These are flags given to the C compiler to tell it to look for include
328 # files (including ones given in angle brackets) in the current directory
329 # and in the parent library source directory.
330 # `+sysdep-includes' will be defined by Makerules.
332 +includes = -I. -I$(patsubst %/,%,$(..)) $(includes) $(+sysdep-includes)
334 +includes = -I. $(includes) $(+sysdep-includes)
338 # These are the variables that the implicit compilation rules use.
339 CPPFLAGS = $(+includes) $(+defines) -D_LIBC
340 override CFLAGS = $(+cflags)
343 # This is the macro that the implicit linking rules use.
344 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
349 ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
353 ifneq "$(filter -DHAVE_GNU_AS,$(CPPFLAGS))" ""
358 endif # Makeconfig not yet included