]> git.ipfire.org Git - thirdparty/glibc.git/blame - Makeconfig
Wed Aug 16 17:04:26 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[thirdparty/glibc.git] / Makeconfig
CommitLineData
28f540f4
RM
1# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2# This file is part of the GNU C Library.
3
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.
8
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.
13
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.
18
19#
20# Makefile configuration options for the GNU C library.
21#
22ifneq (,)
23This makefile requires GNU Make.
24endif
25
26ifneq "$(origin +included-Makeconfig)" "file"
27
28+included-Makeconfig := yes
29
30ifdef subdir
31.. := ../
32endif
33
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.
36ifneq (,$(wildcard $(..)config.make))
37ARCH =
38machine =
39else # Not configured.
40ifndef ARCH
41ifdef machine
42ARCH = $(machine)
43endif # machine
44endif # ARCH
45endif # config.make
46
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).
51ifdef ARCH
52ifeq ($(filter /%,$(ARCH)),)
53objdir := $(..)$(ARCH)
54else
55objdir = $(ARCH)
56endif
57endif
58
59# $(common-objdir) is the place to put objects and
60# such that are not specific to a single subdir.
61ifdef objdir
62objpfx = $(objdir)/
63common-objpfx = $(objpfx)
64common-objdir = $(objdir)
65else
66objpfx :=
67ifdef ..
68common-objpfx = $(..)
69common-objdir = ..
70else
71# This is a kludge. make wizards might grok.
72common-objpfx = sysdeps/../
73common-objdir = .
74endif
75endif
76
28f540f4
RM
77
78# Get the values defined by options to `configure'.
79include $(common-objpfx)config.make
80
273d56ce
RM
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)
88
28f540f4 89# Force the user to configure before making.
273d56ce
RM
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; \
95 exit 1; fi
28f540f4
RM
96
97# Get the user's configuration parameters.
98ifneq ($(wildcard $(..)configparms),)
99include $(..)configparms
100endif
101ifneq ($(objpfx),)
102ifneq ($(wildcard $(objpfx)configparms),)
103include $(objpfx)configparms
104endif
105endif
106
107sysdep_dir := $(..)sysdeps
108export sysdep_dir := $(sysdep_dir)
109\f
110####
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.
114####
115
116
117# Common prefix for machine-independent installation directories.
487253ea 118ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
28f540f4
RM
119prefix = /usr/local
120endif
121
122# Common prefix for machine-dependent installation directories.
487253ea 123ifeq ($(origin exec_prefix),undefined)
28f540f4
RM
124exec_prefix = $(prefix)
125endif
126
127# Where to install the library and object files.
128ifndef libdir
129libdir = $(exec_prefix)/lib
130endif
131
132# Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
133# the prefix is spliced between `lib' and the name, so the linker switch
134# `-l$(libprefix)NAME' finds the library; for other files the prefix is
135# just prepended to the whole file name.
487253ea 136ifeq ($(origin libprefix),undefined)
28f540f4
RM
137libprefix =
138endif
139
140# Where to install the header files.
141ifndef includedir
142includedir = $(exec_prefix)/include
143endif
144
28f540f4 145# Where to install machine-independent data files.
a2fe9c76 146# These are the timezone database, and the locale database.
28f540f4
RM
147ifndef datadir
148datadir = $(prefix)/share
149endif
150
151# Where to install the timezone data files (which are machine-independent).
152ifndef zonedir
153zonedir = $(datadir)/zoneinfo
154endif
155
a2fe9c76
RM
156# Where to install the locale data files (which are machine-independent).
157ifndef localedir
158localedir = $(datadir)/locale
159endif
160
161# Where to install the locale charmap and message catalog files (which are
162# machine-independent).
163ifndef nlsdir
164nlsdir = $(datadir)/nls
165endif
166
167
28f540f4
RM
168# Where to install programs.
169ifndef bindir
170bindir = $(exec_prefix)/bin
171endif
172
173# Where to install administrative programs.
174ifndef sbindir
175sbindir = $(exec_prefix)/sbin
176endif
177
178# Where to install the Info files.
179ifndef infodir
180infodir = $(prefix)/info
181endif
182
183# Where to install default configuration files. These include the local
184# timezone specification and network data base files.
185ifndef sysconfdir
186sysconfdir = $(prefix)/etc
187endif
188
189# What timezone should be the installed default (e.g., US/Eastern).
190# Run `make -C time echo-zonenames' to see a list of available zone names.
191# The local timezone can be changed with `zic -l TIMEZONE' at any time.
192ifndef localtime
193localtime = Factory
194endif
195
196# Where to install the "localtime" timezone file; this is the file whose
197# contents $(localtime) specifies. If this is a relative pathname, it is
198# relative to $(zonedir). It is a good idea to put this somewhere
199# other than there, so the zoneinfo directory contains only universal data,
200# localizing the configuration data elsewhere.
201ifndef localtime-file
202localtime-file = $(sysconfdir)/localtime
203endif
204
205# What timezone's DST rules should be used when a POSIX-style TZ
206# environment variable doesn't specify any rules. For 1003.1 compliance
207# this timezone must use rules that are as U.S. federal law defines DST.
208# Run `make -C time echo-zonenames' to see a list of available zone names.
209# This setting can be changed with `zic -p TIMEZONE' at any time.
210# If you want POSIX.1 compatibility, use `America/New_York'.
211ifndef posixrules
212posixrules = America/New_York
213endif
214
215# Where to install the "posixrules" timezone file; this is file
216# whose contents $(posixrules) specifies. If this is a relative
217# pathname, it is relative to $(zonedir).
218ifndef posixrules-file
219posixrules-file = posixrules
220endif
221
222
223# Directory where your system's native header files live.
224# This is used on Unix systems to generate some GNU libc header files.
225ifndef sysincludedir
226sysincludedir = /usr/include
227endif
228
229
230# Commands to install files.
231ifndef INSTALL_DATA
232INSTALL_DATA = $(INSTALL) -m 644
233endif
234ifndef INSTALL_PROGRAM
235INSTALL_PROGRAM = $(INSTALL)
236endif
237ifndef INSTALL
238INSTALL = install
239endif
240
241
242# The name of the C compiler.
243# If you've got GCC, and it works, use it.
244ifeq ($(origin CC),default)
245CC := gcc
246endif
247
248# The name of the C compiler to use for compilations of programs to run on
249# the host that is building the library. If you set CC to a
250# cross-compiler, you must set this to the normal compiler.
251ifndef BUILD_CC
252BUILD_CC = $(CC)
253endif
254
255# Default flags to pass the C compiler.
256ifndef default_cflags
257default_cflags := -g
258endif
259
260# Flags to pass the C compiler when assembling preprocessed assembly code
261# (`.S' files). On some systems the assembler doesn't understand the `#' line
262# directives the preprocessor produces. If you have troubling compiling
263# assembly code, try using -P here to suppress these directives.
264ifndef asm-CPPFLAGS
265asm-CPPFLAGS =
266endif
267
268# Command for linking programs with the C library.
269ifndef +link
270+link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
96f873b9 271 $(addprefix $(csu-objpfx),start.o $(+preinit)) \
66e3dda4 272 $(^:lib=$(common-objpfx)libc.a) $(gnulib) $(common-objpfx)libc.a \
96f873b9 273 $(addprefix $(csu-objpfx),$(+postinit))
28f540f4
RM
274endif
275ifndef gnulib
276gnulib := -lgcc
277endif
96f873b9
RM
278ifeq ($(elf),yes)
279+preinit = crti.o
280+postinit = crtn.o
281endif
282ifdef objpfx
283csu-objpfx = $(objpfx)
284else
883bc19b 285csu-objpfx = $(..)csu/
96f873b9 286endif
28f540f4
RM
287
288ifndef LD
289LD := ld -X
290endif
291
292ifndef RANLIB
293RANLIB = ranlib
294endif
295
296# Extra flags to pass to GCC.
4e1bac76 297+gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline -Wbad-function-cast
28f540f4
RM
298
299# This is the program that generates makefile
300# dependencies from C source files.
301ifndef +mkdep
302+mkdep = $(CC) -M
303endif
304
305# The program that makes Emacs-style TAGS files.
306ETAGS := etags -T
307
308# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
309# perhaps others) to preprocess assembly code in some cases.
310M4 = m4
311
312####
313#### End of configuration variables.
314####
315\f
316# This tells some versions of GNU make before 3.63 not to export all variables.
317.NOEXPORT:
318
319# We want to echo the commands we're running without
320# umpteem zillion filenames along with it (we use `...' instead)
321# but we don't want this echoing done when the user has said
322# he doesn't want to see commands echoed by using -s.
323ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
324+cmdecho := echo >/dev/null
325else # not -s
326+cmdecho := echo
327endif # -s
328
329# These are the flags given to the compiler to tell
330# it what sort of optimization and/or debugging output to do.
331ifndef +cflags
332# If `CFLAGS' was defined, use that.
333ifdef CFLAGS
334+cflags := $(filter-out -I%,$(CFLAGS))
335endif # CFLAGS
336endif # +cflags
337
338# If none of the above worked, default to "-g".
339ifeq "$(strip $(+cflags))" ""
340+cflags := $(default_cflags)
341endif # $(+cflags) == ""
342
343# If using gcc, add flags that only it will grok.
344ifneq "$(findstring gcc,$(CC))" ""
345+cflags := $(+cflags) $(+gccwarn)
346+gcc-nowarn := -w
347else
348+gcc-nowarn :=
349endif # gcc
350
351# Don't duplicate options if we inherited variables from the parent.
352+cflags := $(sort $(+cflags))
353
354
355# These are flags given to the C compiler to tell it to look for include
356# files (including ones given in angle brackets) in the current directory
357# and in the parent library source directory.
358# `+sysdep-includes' will be defined by Makerules.
359+includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
360 $(includes) $(+sysdep-includes) $(last-includes)
361
362
363# These are the variables that the implicit compilation rules use.
364CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
53afa8d9
RM
365 $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
366override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@))
28f540f4
RM
367
368
369# This is the macro that the implicit linking rules use.
370ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
371LDFLAGS := -g
372endif
373
f0bf9cb9
RM
374
375# Enable object files for different versions of the library.
376# Various things use $(object-suffixes) to know what all to make.
377# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
378# to pass different flags for each flavor.
379libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
380object-suffixes := .o
381libtype.o := lib%.a
382ifeq (yes,$(build-shared))
383# Under --enable-shared, we will build a shared library of PIC objects.
384# The PIC object files are named foo.so.
385object-suffixes += .so
386CPPFLAGS-.so = -DPIC
387CFLAGS-.so = -fPIC
388libtype.so := lib%_pic.a
389endif
390ifeq (yes,$(build-profile))
391# Under --enable-profile, we will build a static library of profiled objects.
392# The profiled object files are named foo.po.
393object-suffixes += .po
394CFLAGS-.po = -p
395libtype.po = lib%_p.a
396endif
397ifeq (yes,$(build-omitfp))
398# Under --enable-omitfp, we build an the library optimized without
399# debugging information using -fomit-frame-pointer, and build an extra
400# library with debugging information. The debuggable objects are named foo.go.
401object-suffixes += .go
402CFLAGS-.go = -g
403CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
404CFLAGS-.so += $(CFLAGS.o)
405libtype.go = lib%_g.a
406endif
407
408
28f540f4
RM
409+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
410
411ifneq ($(BUILD_CC),$(CC))
412cross-compiling := yes
413else
414cross-compiling := no
415endif
416
417
418endif # Makeconfig not yet included