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
36 # If config.make exists, the source directory was configured,
37 # so don't try to be clever and find another directory to build in.
38 ifeq (,$(wildcard $(..)config.make))
44 # Directory for object files and libc.a. If this is not defined, the
45 # object files live in the subdirectories where their sources live, and
46 # libc.a lives in the parent directory (this probably doesn't work any
49 ifeq ($(filter /%,$(ARCH)),)
50 objdir := $(..)$(ARCH)
56 # $(common-objdir) is the place to put objects and
57 # such that are not specific to a single subdir.
60 common-objpfx = $(objpfx)
61 common-objdir = $(objdir)
68 # This is a kludge. make wizards might grok.
69 common-objpfx = sysdeps/../
73 libc.a = $(common-objpfx)libc.a
76 # Get the values defined by options to `configure'.
77 include $(common-objpfx)config.make
79 # Force the user to configure before making.
81 @echo The GNU C library has not been configured. >&2
82 @echo Run \`configure\' to configure it before building. >&2
85 # Get the user's configuration parameters.
86 ifneq ($(wildcard $(..)configparms),)
87 include $(..)configparms
90 ifneq ($(wildcard $(objpfx)configparms),)
91 include $(objpfx)configparms
96 #### These are the configuration variables. You can define values for
97 #### the variables below in the file `configparms'.
98 #### Do NOT edit this file.
102 # Common prefix for machine-independent installation directories.
107 # Common prefix for machine-dependent installation directories.
109 exec_prefix = $(prefix)
112 # Where to install the library and object files.
114 libdir = $(exec_prefix)/lib
117 # Where to install the header files.
119 includedir = $(exec_prefix)/include
122 # Define if the library should install its own <stddef.h>.
123 # Do this unless you are using version 2.2 or later of GCC.
128 # Define if the library should install its own <stdarg.h>.
129 # Do this unless you are using version 2.3 or later of GCC.
131 stdarg.h := stdarg.h $(wildcard va-*.h)
134 # Where to install machine-independent data files.
135 # These are the timezone database, and eventually the locale database.
137 datadir = $(prefix)/lib
140 # Where to install programs.
142 bindir = $(exec_prefix)/bin
145 # What timezone should be the installed default (e.g., US/Eastern).
146 # Run `make -C time echo-zonenames' to see a list of available zone names.
147 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
152 # Where to install the "localtime" timezone file; this is the file
153 # whose contents $(localtime) specifies. If this is a relative
154 # pathname, it is relative to $(datadir)/zoneinfo.
155 ifndef localtime-file
156 localtime-file = $(prefix)/etc/localtime
159 # What timezone's DST rules should be used when a POSIX-style TZ
160 # environment variable doesn't specify any rules. For 1003.1 compliance
161 # this timezone must use rules that are as U.S. federal law defines DST.
162 # Run `make -C time echo-zonenames' to see a list of available zone names.
163 # This setting can be changed with `zic -p TIMEZONE' at any time.
165 posixrules = US/Eastern
168 # Where to install the "posixrules" timezone file; this is file
169 # whose contents $(posixrules) specifies. If this is a relative
170 # pathname, it is relative to $(datadir)/zoneinfo.
171 ifndef posixrules-file
172 posixrules-file = posixrules
176 # Directory where your system's native header files live.
177 # This is used on Unix systems to generate some GNU libc header files.
179 sysincludedir = /usr/include
183 # Commands to install files.
185 INSTALL_DATA = $(INSTALL) -m 644
187 ifndef INSTALL_PROGRAM
188 INSTALL_PROGRAM = $(INSTALL)
195 # The name of the C compiler.
196 # If you've got GCC, and it works, use it.
197 ifeq ($(origin CC),default)
201 # These are preprocessor macros we want to predefine. Define HAVE_GNU_LD
202 # if using GNU ld (which you should do if possible). If you do this, you
203 # may need the GNU assembler as well. If you don't do this, your library
204 # won't work as well (and won't be strictly compliant with the ANSI C
205 # and POSIX.1 standards).
206 +defines = $(defines) $(gnu_ld) $(gnu_as)
208 # Default flags to pass the C compiler.
209 ifndef default_cflags
210 +default_cflags := -g
213 # Flags to pass the C compiler when assembling preprocessed assembly code
214 # (`.S' files). On some systems the assembler doesn't understand the `#' line
215 # directives the preprocessor produces. If you have troubling compiling
216 # assembly code, try using -P here to suppress these directives.
221 # Command for linking programs with the C library.
223 +link = $(CC) -nostdlib -o $@ $(common-objpfx)start.o $(^:lib=$(libc.a)) \
238 # Define non-empty if the C compiler understands -v (print version).
239 +cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc
241 # Extra flags to pass to GCC.
242 +gccwarn := -Wall -Wwrite-strings
243 +gccopt := -fstrength-reduce
245 # This is the program that generates makefile
246 # dependencies from C source files.
251 # The program that makes Emacs-style TAGS files.
254 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
255 # perhaps others) to preprocess assembly code in some cases.
259 #### End of configuration variables.
262 # This tells some versions of GNU make before 3.63 not to export all variables.
265 # We want to echo the commands we're running without
266 # umpteem zillion filenames along with it (we use `...' instead)
267 # but we don't want this echoing done when the user has said
268 # he doesn't want to see commands echoed by using -s.
269 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
270 +cmdecho := echo >/dev/null
275 # These are the flags given to the compiler to tell
276 # it what sort of optimization and/or debugging output to do.
278 # If `CFLAGS' was defined, use that.
280 +cflags := $(filter-out -I%,$(CFLAGS))
284 # If none of the above worked, default to "-g".
285 ifeq "$(strip $(+cflags))" ""
286 +cflags := $(+default_cflags)
287 endif # $(+cflags) == ""
289 # If using gcc, add flags that only it will grok.
290 ifneq "$(findstring gcc,$(CC))" ""
291 +cflags := $(+cflags) $(+gccwarn)
292 ifneq "$(filter -O,$(+cflags))" ""
293 +cflags := $(+cflags) $(+gccopt)
300 # Don't duplicate options if we inherited variables from the parent.
301 +cflags := $(sort $(+cflags))
304 ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v
305 ifneq "$(strip $(+cc_version))" ""
306 # If Make is telling us version info, tell the compiler to do so as well.
311 # These are flags given to the C compiler to
312 # tell it to look for include files (including ones
313 # given in angle brackets) in the current directory
314 # and in the parent library source directory.
316 +includes = -I. -I$(patsubst %/,%,$(..)) $(includes)
318 +includes = -I. $(includes)
322 # These are the variables that the implicit compilation rules use.
323 CPPFLAGS = $(+includes) $(+defines) -DLIBC
324 override CFLAGS = $(+cflags)
327 # This is the macro that the implicit linking rules use.
328 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
333 ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
338 endif # Makeconfig not yet included