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 # You can put variables that are specific to a configuration in the file
35 # Makeconfig in the object directory for that configuration. Variables
36 # that do not vary between different configurations at your site can be
43 include $(..)config.status
47 # Directory for object files, libc.a, and ansi/ and trad/ directories.
48 # If this is not defined, the object files live in the subdirectories
49 # where their sources live, and libc.a and the ansi/ and trad/ directories
50 # live in the parent directory (this probably doesn't work any more).
52 ifeq ($(filter /%,$(ARCH)),)
53 objdir := $(..)$(ARCH)
58 ifneq ($(wildcard $(objdir)/Makeconfig),)
59 include $(objdir)/Makeconfig
64 # These are the configuration variables.
68 # Common prefix for all installation directories.
73 # Where to install the library and object files.
75 libdir = $(prefix)/lib
78 # Where to install the header files. There are two sets of header files
79 # produced, an ANSI C set and a traditional C set. ansi-incldir, if
80 # defined, is where to install the ANSI C set; trad-incldir, if defined, is
81 # where to install the traditional C set. If you define both, you can
82 # install both sets, in different places.
84 ansi-incldir = $(prefix)/include
87 #trad-incldir = $(prefix)/include
90 # Define if the library should install its own <stddef.h>.
91 # Do this unless you are using version 2.2 or later of GCC.
96 # Where to install machine-independent data files.
97 # These are the timezone database, and eventually the locale database.
99 datadir = $(prefix)/lib
102 # Where to install programs.
104 bindir = $(prefix)/bin
107 # What timezone should be the installed default (e.g., US/Eastern).
108 # Run `make -C time echo-zonenames' to see a list of available zone names.
109 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
114 # Where to install the "localtime" timezone file; this is the file
115 # whose contents $(localtime) specifies. If this is a relative
116 # pathname, it is relative to $(datadir)/zoneinfo.
117 ifndef localtime-file
118 localtime-file = /etc/localtime
121 # What timezone's DST rules should be used when a POSIX-style TZ
122 # environment variable doesn't specify any rules. For 1003.1 compliance
123 # this timezone must use rules that are as U.S. federal law defines DST.
124 # Run `make -C time echo-zonenames' to see a list of available zone names.
125 # This setting can be changed with `zic -p TIMEZONE' at any time.
127 posixrules = US/Eastern
130 # Where to install the "posixrules" timezone file; this is file
131 # whose contents $(posixrules) specifies. If this is a relative
132 # pathname, it is relative to $(datadir)/zoneinfo.
133 ifndef posixrules-file
134 posixrules-file = posixrules
138 # Directory where your system's native header files live.
139 # This is used on Unix systems to generate some GNU libc header files.
141 sysincludedir = /usr/include
145 # Commands to install files.
147 INSTALL_DATA = $(INSTALL)
149 ifndef INSTALL_PROGRAM
150 INSTALL_PROGRAM = $(INSTALL)
157 # The name of the C compiler.
158 # If you've got GCC, and it works, use it.
159 ifeq ($(origin CC),default)
163 # These are preprocessor macros we want to predefine.
164 # Define HAVE_GNU_LD if using GNU ld (which you should do if possible).
165 # If you do this, you may need the GNU assembler as well.
166 # If you don't do this, your library won't work as well (and won't be strictly
167 # compliant with the ANSI C standard).
168 +defines = $(defines) -DHAVE_GNU_LD
170 # Default flags to pass the C compiler.
171 ifndef default_cflags
172 +default_cflags := -g
175 # Command for linking programs with the C library.
177 +link = $(CC) -nostdlib -o $@ $(objpfx)start.o $(^:lib=$(objpfx)libc.a) \
178 -lgcc $(objpfx)libc.a
189 # Define non-empty if the C compiler understands -v (print version).
190 +cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc
192 # Extra flags to pass to GCC.
193 +gccwarn := -Wall -Wwrite-strings -Wpointer-arith -Wstrict-prototypes
194 +gccopt := -fstrength-reduce
196 # This is the program that generates makefile
197 # dependencies from C source files.
202 # The program that makes Emacs-style TAGS files.
207 libc.a = $(objpfx)libc.a
213 # We want to echo the commands we're running without
214 # umpteem zillion filenames along with it (we use `...' instead)
215 # but we don't want this echoing done when the user has said
216 # he doesn't want to see commands echoed by using -s.
217 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
218 +cmdecho := echo >/dev/null
223 # These are the flags given to the compiler to tell
224 # it what sort of optimization and/or debugging output to do.
226 # If `CFLAGS' was defined, use that.
228 +cflags := $(filter-out -I%,$(CFLAGS))
232 # If none of the above worked, default to "-g".
233 ifeq "$(strip $(+cflags))" ""
234 +cflags := $(+default_cflags)
235 endif # $(+cflags) == ""
237 # If using gcc, add flags that only it will grok.
238 ifneq "$(findstring gcc,$(CC))" ""
239 +cflags := $(+cflags) $(+gccwarn)
240 ifneq "$(filter -O,$(+cflags))" ""
241 +cflags := $(+cflags) $(+gccopt)
245 # Don't duplicate options if we inherited variables from the parent.
246 +cflags := $(sort $(+cflags))
249 ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v
250 ifneq "$(strip $(+cc_version))" ""
251 # If Make is telling us version info, tell the compiler to do so as well.
256 # These are flags given to the C compiler to
257 # tell it to look for include files (including ones
258 # given in angle brackets) in the current directory
259 # and in the parent library source directory.
261 +includes = -I. -I$(patsubst %/,%,$(..)) $(includes)
263 +includes = -I. $(includes)
267 # These are the variables that the implicit compilation rules use.
268 CPPFLAGS = $(+includes) $(+defines) -DLIBC
269 override CFLAGS = $(+cflags)
272 # This is the macro that the implicit linking rules use.
273 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
278 ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
283 endif # Makeconfig not yet included