(Dynamic Allocation and C): Say global variables are like static.
[glibc.git] / Makeconfig
blob631876a37777a8340c266539d60f3fb1982c8698
1 # Copyright (C) 1991, 1992, 1993, 1994 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.
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
26 ifneq "$(origin +included-Makeconfig)" "file"
28 +included-Makeconfig := yes
30 ifdef subdir
31 .. := ../
32 endif
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))
37 ARCH =
38 machine =
39 else    # Not configured.
40 ifndef ARCH
41 ifdef machine
42 ARCH = $(machine)
43 endif # machine
44 endif # ARCH
45 endif # config.make
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
50 # more).
51 ifdef ARCH
52 ifeq ($(filter /%,$(ARCH)),)
53 objdir := $(..)$(ARCH)
54 else
55 objdir = $(ARCH)
56 endif
57 endif
59 # $(common-objdir) is the place to put objects and 
60 # such that are not specific to a single subdir.
61 ifdef objdir
62 objpfx = $(objdir)/
63 common-objpfx = $(objpfx)
64 common-objdir = $(objdir)
65 else
66 objpfx :=
67 ifdef ..
68 common-objpfx = $(..)
69 common-objdir = ..
70 else
71 # This is a kludge.  make wizards might grok.
72 common-objpfx = sysdeps/../
73 common-objdir = .
74 endif
75 endif
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
87         @exit 1
89 # Get the user's configuration parameters.
90 ifneq ($(wildcard $(..)configparms),)
91 include $(..)configparms
92 endif
93 ifneq ($(objpfx),)
94 ifneq ($(wildcard $(objpfx)configparms),)
95 include $(objpfx)configparms
96 endif
97 endif
99 sysdep_dir := $(..)sysdeps
100 export sysdep_dir := $(sysdep_dir)
102 ####
103 ####    These are the configuration variables.  You can define values for
104 ####    the variables below in the file `configparms'.
105 ####    Do NOT edit this file.
106 ####
109 # Common prefix for machine-independent installation directories.
110 ifndef prefix
111 prefix = /usr/local
112 endif
114 # Common prefix for machine-dependent installation directories.
115 ifndef exec_prefix
116 exec_prefix = $(prefix)
117 endif
119 # Where to install the library and object files.
120 ifndef libdir
121 libdir = $(exec_prefix)/lib
122 endif
124 # Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
125 # the prefix is spliced between `lib' and the name, so the linker switch
126 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
127 # just prepended to the whole file name.
128 ifndef libprefix
129 libprefix =
130 endif
132 # Where to install the header files.
133 ifndef includedir
134 includedir = $(exec_prefix)/include
135 endif
137 # Define if the library should install its own <stddef.h>.
138 # Do this unless you are using version 2.2 or later of GCC.
139 ifndef stddef.h
140 stddef.h = stddef.h
141 endif
143 # Where to install machine-independent data files.
144 # These are the timezone database, and eventually the locale database.
145 ifndef datadir
146 datadir = $(prefix)/share
147 endif
149 # Where to install the timezone data files (which are machine-independent).
150 ifndef zonedir
151 zonedir = $(datadir)/zoneinfo
152 endif
154 # Where to install programs.
155 ifndef bindir
156 bindir = $(exec_prefix)/bin
157 endif
159 # Where to install administrative programs.
160 ifndef sbindir
161 sbindir = $(exec_prefix)/sbin
162 endif
164 # Where to install the Info files.
165 ifndef infodir
166 infodir = $(prefix)/info
167 endif
169 # Where to install default configuration files.  These include the local
170 # timezone specification and network data base files.
171 ifndef sysconfdir
172 sysconfdir = $(prefix)/etc
173 endif
175 # What timezone should be the installed default (e.g., US/Eastern).
176 # Run `make -C time echo-zonenames' to see a list of available zone names.
177 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
178 ifndef localtime
179 localtime = Factory
180 endif
182 # Where to install the "localtime" timezone file; this is the file whose
183 # contents $(localtime) specifies.  If this is a relative pathname, it is
184 # relative to $(zonedir).  It is a good idea to put this somewhere
185 # other than there, so the zoneinfo directory contains only universal data,
186 # localizing the configuration data elsewhere.
187 ifndef localtime-file
188 localtime-file = $(sysconfdir)/localtime
189 endif
191 # What timezone's DST rules should be used when a POSIX-style TZ
192 # environment variable doesn't specify any rules.  For 1003.1 compliance
193 # this timezone must use rules that are as U.S. federal law defines DST.
194 # Run `make -C time echo-zonenames' to see a list of available zone names.
195 # This setting can be changed with `zic -p TIMEZONE' at any time.
196 # If you want POSIX.1 compatibility, use `America/New_York'.
197 ifndef posixrules
198 posixrules = America/New_York
199 endif
201 # Where to install the "posixrules" timezone file; this is file
202 # whose contents $(posixrules) specifies.  If this is a relative
203 # pathname, it is relative to $(zonedir).
204 ifndef posixrules-file
205 posixrules-file = posixrules
206 endif
209 # Directory where your system's native header files live.
210 # This is used on Unix systems to generate some GNU libc header files.
211 ifndef sysincludedir
212 sysincludedir = /usr/include
213 endif
216 # Commands to install files.
217 ifndef INSTALL_DATA
218 INSTALL_DATA = $(INSTALL) -m 644
219 endif
220 ifndef INSTALL_PROGRAM
221 INSTALL_PROGRAM = $(INSTALL)
222 endif
223 ifndef INSTALL
224 INSTALL = install
225 endif
228 # The name of the C compiler.
229 # If you've got GCC, and it works, use it.
230 ifeq ($(origin CC),default)
231 CC := gcc
232 endif
234 # The name of the C compiler to use for compilations of programs to run on
235 # the host that is building the library.  If you set CC to a
236 # cross-compiler, you must set this to the normal compiler.
237 ifndef BUILD_CC
238 BUILD_CC = $(CC)
239 endif
241 # Default flags to pass the C compiler.
242 ifndef default_cflags
243 default_cflags := -g
244 endif
246 # Flags to pass the C compiler when assembling preprocessed assembly code
247 # (`.S' files).  On some systems the assembler doesn't understand the `#' line
248 # directives the preprocessor produces.  If you have troubling compiling
249 # assembly code, try using -P here to suppress these directives.
250 ifndef asm-CPPFLAGS
251 asm-CPPFLAGS =
252 endif
254 # Command for linking programs with the C library.
255 ifndef +link
256 +link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
257         $(common-objpfx)start.o $(^:lib=$(libc.a)) $(gnulib) $(libc.a)
258 endif
259 ifndef gnulib
260 gnulib := -lgcc
261 endif
263 ifndef LD
264 LD := ld -X
265 endif
267 ifndef  RANLIB
268 RANLIB = ranlib
269 endif
271 # Extra flags to pass to GCC.
272 +gccwarn := -Wall -Wwrite-strings -Wno-parentheses
274 # This is the program that generates makefile
275 # dependencies from C source files.
276 ifndef +mkdep
277 +mkdep = $(CC) -M
278 endif
280 # The program that makes Emacs-style TAGS files.
281 ETAGS   := etags -T
283 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
284 # perhaps others) to preprocess assembly code in some cases.
285 M4 = m4
287 ####
288 #### End of configuration variables.
289 ####
291 # This tells some versions of GNU make before 3.63 not to export all variables.
292 .NOEXPORT:
294 # We want to echo the commands we're running without
295 # umpteem zillion filenames along with it (we use `...' instead)
296 # but we don't want this echoing done when the user has said
297 # he doesn't want to see commands echoed by using -s.
298 ifneq   "$(findstring s,$(MAKEFLAGS))" ""       # if -s
299 +cmdecho        := echo >/dev/null
300 else                                            # not -s
301 +cmdecho        := echo
302 endif                                           # -s
304 # These are preprocessor macros we want to predefine.  configure will
305 # define HAVE_GNU_LD for you if you use GNU ld (which you should do if
306 # possible).  If you do this, you may need the GNU assembler as well.  If
307 # you don't do this, your library won't work as well (and won't be strictly
308 # compliant with the ANSI C and POSIX.1 standards).
309 +defines = $(config-defines) $(defines)
311 # These are the flags given to the compiler to tell
312 # it what sort of optimization and/or debugging output to do.
313 ifndef  +cflags
314 # If `CFLAGS' was defined, use that.
315 ifdef           CFLAGS
316 +cflags := $(filter-out -I%,$(CFLAGS))
317 endif           # CFLAGS
318 endif   # +cflags
320 # If none of the above worked, default to "-g".
321 ifeq    "$(strip $(+cflags))" ""
322 +cflags := $(default_cflags)
323 endif   # $(+cflags) == ""
325 # If using gcc, add flags that only it will grok.
326 ifneq   "$(findstring gcc,$(CC))" ""
327 +cflags := $(+cflags) $(+gccwarn)
328 +gcc-nowarn := -w
329 else
330 +gcc-nowarn :=
331 endif   # gcc
333 # Don't duplicate options if we inherited variables from the parent.
334 +cflags := $(sort $(+cflags))
337 # These are flags given to the C compiler to tell it to look for include
338 # files (including ones given in angle brackets) in the current directory
339 # and in the parent library source directory.
340 # `+sysdep-includes' will be defined by Makerules.
341 +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
342             $(includes) $(+sysdep-includes) $(last-includes)
345 # These are the variables that the implicit compilation rules use.
346 CPPFLAGS = $(+includes) $(+defines) -D_LIBC $(sysdep-CPPFLAGS)
347 override CFLAGS = $(+cflags) $(sysdep-CFLAGS)
350 # This is the macro that the implicit linking rules use.
351 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
352 LDFLAGS := -g
353 endif
356 ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" ""
357 +gnu-stabs := yes
358 endif
360 ifneq "$(filter -DHAVE_GNU_AS,$(CPPFLAGS))" ""
361 gnu-as := yes
362 endif
364 ifneq ($(BUILD_CC),$(CC))
365 cross-compiling := yes
366 else
367 cross-compiling := no
368 endif
371 endif # Makeconfig not yet included