1 # Copyright (C) 1991, 1992, 1993, 1994, 1995 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/../
78 # Get the values defined by options to `configure'.
79 include $(common-objpfx)config.make
81 # Run config.status to update config.make and config.h. We don't show the
82 # dependence of config.h to Make, because it is only touched when it
83 # changes and so config.status would be run every time; the dependence of
84 # config.make should suffice to force regeneration and re-exec, and the new
85 # image will notice if config.h changed.
86 $(common-objpfx)config.make: $(common-objpfx)config.status
87 cd $(<D); $(SHELL) $(<F)
89 # Force the user to configure before making.
90 $(common-objpfx)config.status: $(..)configure
91 @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
92 echo The GNU C library has not been configured. >&2; \
93 echo Run \`configure\' to configure it before building. >&2; \
94 echo Try \`configure --help\' for more details. >&2; \
97 # Get the user's configuration parameters.
98 ifneq ($(wildcard $(..)configparms),)
99 include $(..)configparms
102 ifneq ($(wildcard $(objpfx)configparms),)
103 include $(objpfx)configparms
107 sysdep_dir := $(..)sysdeps
108 export sysdep_dir := $(sysdep_dir)
111 #### These are the configuration variables. You can define values for
112 #### the variables below in the file `configparms'.
113 #### Do NOT edit this file.
117 # Set this to either `stdio' or `libio', to compile in either GNU stdio
123 # Common prefix for machine-independent installation directories.
124 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
128 # Common prefix for machine-dependent installation directories.
129 ifeq ($(origin exec_prefix),undefined)
130 exec_prefix = $(prefix)
133 # Where to install the library and object files.
135 libdir = $(exec_prefix)/lib
138 # Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
139 # the prefix is spliced between `lib' and the name, so the linker switch
140 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
141 # just prepended to the whole file name.
142 ifeq ($(origin libprefix),undefined)
146 # Where to install the header files.
148 includedir = $(exec_prefix)/include
151 # Where to install machine-independent data files.
152 # These are the timezone database, and the locale database.
154 datadir = $(prefix)/share
157 # Where to install the timezone data files (which are machine-independent).
159 zonedir = $(datadir)/zoneinfo
162 # Where to install the locale and message catalog data files (which are
163 # machine-independent).
165 localedir = $(datadir)/locale
168 # Where to install the locale charmap source files.
170 nlsdir = $(datadir)/nls
174 # Where to install programs.
176 bindir = $(exec_prefix)/bin
179 # Where to install administrative programs.
181 sbindir = $(exec_prefix)/sbin
184 # Where to install the Info files.
186 infodir = $(prefix)/info
189 # Where to install default configuration files. These include the local
190 # timezone specification and network data base files.
192 sysconfdir = $(prefix)/etc
195 # What timezone should be the installed default (e.g., US/Eastern).
196 # Run `make -C time echo-zonenames' to see a list of available zone names.
197 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
202 # Where to install the "localtime" timezone file; this is the file whose
203 # contents $(localtime) specifies. If this is a relative pathname, it is
204 # relative to $(zonedir). It is a good idea to put this somewhere
205 # other than there, so the zoneinfo directory contains only universal data,
206 # localizing the configuration data elsewhere.
207 ifndef localtime-file
208 localtime-file = $(sysconfdir)/localtime
211 # What timezone's DST rules should be used when a POSIX-style TZ
212 # environment variable doesn't specify any rules. For 1003.1 compliance
213 # this timezone must use rules that are as U.S. federal law defines DST.
214 # Run `make -C time echo-zonenames' to see a list of available zone names.
215 # This setting can be changed with `zic -p TIMEZONE' at any time.
216 # If you want POSIX.1 compatibility, use `America/New_York'.
218 posixrules = America/New_York
221 # Where to install the "posixrules" timezone file; this is file
222 # whose contents $(posixrules) specifies. If this is a relative
223 # pathname, it is relative to $(zonedir).
224 ifndef posixrules-file
225 posixrules-file = posixrules
229 # Directory where your system's native header files live.
230 # This is used on Unix systems to generate some GNU libc header files.
232 sysincludedir = /usr/include
236 # Commands to install files.
238 INSTALL_DATA = $(INSTALL) -m 644
240 ifndef INSTALL_PROGRAM
241 INSTALL_PROGRAM = $(INSTALL)
248 # The name of the C compiler.
249 # If you've got GCC, and it works, use it.
250 ifeq ($(origin CC),default)
254 # The name of the C compiler to use for compilations of programs to run on
255 # the host that is building the library. If you set CC to a
256 # cross-compiler, you must set this to the normal compiler.
261 # Default flags to pass the C compiler.
262 ifndef default_cflags
266 # Flags to pass the C compiler when assembling preprocessed assembly code
267 # (`.S' files). On some systems the assembler doesn't understand the `#' line
268 # directives the preprocessor produces. If you have troubling compiling
269 # assembly code, try using -P here to suppress these directives.
274 # Command for linking programs with the C library.
276 +link = $(CC) -nostdlib -nostartfiles -o $@ \
277 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
278 $(addprefix $(csu-objpfx),start.o $(+preinit)) \
279 $(^:$(common-objpfx)libc.a=$(link-libc)) \
280 $(addprefix $(csu-objpfx),$(+postinit))
282 ifndef config-LDFLAGS
283 ifeq (yes,$(build-shared))
284 config-LDFLAGS = -Wl,-dynamic-linker=$(libdir)/$(rtld-installed-name)
288 ifeq (yes,$(build-shared))
289 link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(libdir) \
290 $(common-objpfx)libc.so $(gnulib)
292 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
303 csu-objpfx = $(objpfx)
305 csu-objpfx = $(..)csu/
308 ifeq (yes,$(build-shared))
309 ifndef rtld-installed-name
310 rtld-installed-name = ld.so
322 # Extra flags to pass to GCC.
323 +gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline
325 # This is the program that generates makefile
326 # dependencies from C source files.
331 # The program that makes Emacs-style TAGS files.
334 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
335 # perhaps others) to preprocess assembly code in some cases.
339 #### End of configuration variables.
342 # This tells some versions of GNU make before 3.63 not to export all variables.
345 # We want to echo the commands we're running without
346 # umpteem zillion filenames along with it (we use `...' instead)
347 # but we don't want this echoing done when the user has said
348 # he doesn't want to see commands echoed by using -s.
349 ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
350 +cmdecho := echo >/dev/null
355 # These are the flags given to the compiler to tell
356 # it what sort of optimization and/or debugging output to do.
358 # If `CFLAGS' was defined, use that.
360 +cflags := $(filter-out -I%,$(CFLAGS))
364 # If none of the above worked, default to "-g".
365 ifeq "$(strip $(+cflags))" ""
366 +cflags := $(default_cflags)
367 endif # $(+cflags) == ""
369 # If using gcc, add flags that only it will grok.
370 ifneq "$(findstring gcc,$(CC))" ""
371 +cflags := $(+cflags) $(+gccwarn)
377 # Don't duplicate options if we inherited variables from the parent.
378 +cflags := $(sort $(+cflags))
381 # These are flags given to the C compiler to tell it to look for include
382 # files (including ones given in angle brackets) in the current directory
383 # and in the parent library source directory.
384 # `+sysdep-includes' will be defined by Makerules.
385 +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
386 $(includes) $(+sysdep-includes) $(last-includes)
389 # These are the variables that the implicit compilation rules use.
390 CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
391 $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
392 override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@))
395 # This is the macro that the implicit linking rules use.
396 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
401 # Enable object files for different versions of the library.
402 # Various things use $(object-suffixes) to know what all to make.
403 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
404 # to pass different flags for each flavor.
405 libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
406 object-suffixes := .o
408 ifeq (yes,$(build-shared))
409 # Under --enable-shared, we will build a shared library of PIC objects.
410 # The PIC object files are named foo.so.
411 object-suffixes += .so
414 libtype.so := lib%_pic.a
416 ifeq (yes,$(build-profile))
417 # Under --enable-profile, we will build a static library of profiled objects.
418 # The profiled object files are named foo.po.
419 object-suffixes += .po
421 libtype.po = lib%_p.a
423 ifeq (yes,$(build-omitfp))
424 # Under --enable-omitfp, we build an the library optimized without
425 # debugging information using -fomit-frame-pointer, and build an extra
426 # library with debugging information. The debuggable objects are named foo.go.
427 object-suffixes += .go
429 CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
430 CFLAGS-.so += $(CFLAGS.o)
431 libtype.go = lib%_g.a
435 +gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
437 ifneq ($(BUILD_CC),$(CC))
438 cross-compiling := yes
440 cross-compiling := no
444 endif # Makeconfig not yet included