]> sourceware.org Git - glibc.git/blame - Makeconfig
* io/Makefile (routines): Add mknod, xstat fxstat lxstat xmknod.
[glibc.git] / Makeconfig
CommitLineData
d99d7e26 1# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
28f540f4
RM
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
094bacdb 59# $(common-objdir) is the place to put objects and
28f540f4
RM
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
deab9dea
RM
117# Set this to either `stdio' or `libio', to compile in either GNU stdio
118# or GNU libio.
119ifndef stdio
120stdio = stdio
121endif
122
28f540f4 123# Common prefix for machine-independent installation directories.
487253ea 124ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
28f540f4
RM
125prefix = /usr/local
126endif
127
128# Common prefix for machine-dependent installation directories.
487253ea 129ifeq ($(origin exec_prefix),undefined)
28f540f4
RM
130exec_prefix = $(prefix)
131endif
132
133# Where to install the library and object files.
134ifndef libdir
135libdir = $(exec_prefix)/lib
136endif
137
094bacdb
RM
138# Where to install the shared library and dynamic linker.
139ifndef slibdir
140slibdir = $(exec_prefix)/lib
141endif
142
28f540f4
RM
143# Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
144# the prefix is spliced between `lib' and the name, so the linker switch
145# `-l$(libprefix)NAME' finds the library; for other files the prefix is
146# just prepended to the whole file name.
487253ea 147ifeq ($(origin libprefix),undefined)
28f540f4
RM
148libprefix =
149endif
150
151# Where to install the header files.
152ifndef includedir
153includedir = $(exec_prefix)/include
154endif
155
28f540f4 156# Where to install machine-independent data files.
a2fe9c76 157# These are the timezone database, and the locale database.
28f540f4
RM
158ifndef datadir
159datadir = $(prefix)/share
160endif
161
162# Where to install the timezone data files (which are machine-independent).
163ifndef zonedir
164zonedir = $(datadir)/zoneinfo
165endif
166
3ec41e03
RM
167# Where to install the locale and message catalog data files (which are
168# machine-independent).
a2fe9c76
RM
169ifndef localedir
170localedir = $(datadir)/locale
171endif
172
3ec41e03 173# Where to install the locale charmap source files.
a2fe9c76
RM
174ifndef nlsdir
175nlsdir = $(datadir)/nls
176endif
177
178
28f540f4
RM
179# Where to install programs.
180ifndef bindir
181bindir = $(exec_prefix)/bin
182endif
183
184# Where to install administrative programs.
185ifndef sbindir
186sbindir = $(exec_prefix)/sbin
187endif
188
189# Where to install the Info files.
190ifndef infodir
191infodir = $(prefix)/info
192endif
193
194# Where to install default configuration files. These include the local
195# timezone specification and network data base files.
196ifndef sysconfdir
197sysconfdir = $(prefix)/etc
198endif
199
200# What timezone should be the installed default (e.g., US/Eastern).
201# Run `make -C time echo-zonenames' to see a list of available zone names.
202# The local timezone can be changed with `zic -l TIMEZONE' at any time.
203ifndef localtime
204localtime = Factory
205endif
206
207# Where to install the "localtime" timezone file; this is the file whose
208# contents $(localtime) specifies. If this is a relative pathname, it is
209# relative to $(zonedir). It is a good idea to put this somewhere
210# other than there, so the zoneinfo directory contains only universal data,
211# localizing the configuration data elsewhere.
212ifndef localtime-file
213localtime-file = $(sysconfdir)/localtime
214endif
215
216# What timezone's DST rules should be used when a POSIX-style TZ
217# environment variable doesn't specify any rules. For 1003.1 compliance
218# this timezone must use rules that are as U.S. federal law defines DST.
219# Run `make -C time echo-zonenames' to see a list of available zone names.
220# This setting can be changed with `zic -p TIMEZONE' at any time.
221# If you want POSIX.1 compatibility, use `America/New_York'.
222ifndef posixrules
223posixrules = America/New_York
224endif
225
226# Where to install the "posixrules" timezone file; this is file
227# whose contents $(posixrules) specifies. If this is a relative
228# pathname, it is relative to $(zonedir).
229ifndef posixrules-file
230posixrules-file = posixrules
231endif
232
233
234# Directory where your system's native header files live.
235# This is used on Unix systems to generate some GNU libc header files.
236ifndef sysincludedir
237sysincludedir = /usr/include
238endif
239
240
241# Commands to install files.
242ifndef INSTALL_DATA
243INSTALL_DATA = $(INSTALL) -m 644
244endif
245ifndef INSTALL_PROGRAM
246INSTALL_PROGRAM = $(INSTALL)
247endif
248ifndef INSTALL
249INSTALL = install
250endif
251
252
253# The name of the C compiler.
254# If you've got GCC, and it works, use it.
255ifeq ($(origin CC),default)
256CC := gcc
257endif
258
259# The name of the C compiler to use for compilations of programs to run on
260# the host that is building the library. If you set CC to a
261# cross-compiler, you must set this to the normal compiler.
262ifndef BUILD_CC
263BUILD_CC = $(CC)
264endif
265
266# Default flags to pass the C compiler.
267ifndef default_cflags
268default_cflags := -g
269endif
270
271# Flags to pass the C compiler when assembling preprocessed assembly code
272# (`.S' files). On some systems the assembler doesn't understand the `#' line
273# directives the preprocessor produces. If you have troubling compiling
274# assembly code, try using -P here to suppress these directives.
275ifndef asm-CPPFLAGS
276asm-CPPFLAGS =
277endif
278
279# Command for linking programs with the C library.
280ifndef +link
8e3cc80f
RM
281+link = $(CC) -nostdlib -nostartfiles -o $@ \
282 $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
283 $(addprefix $(csu-objpfx),start.o $(+preinit)) \
196980f5 284 $(^:$(common-objpfx)libc%=$(link-libc)) \
8e3cc80f 285 $(addprefix $(csu-objpfx),$(+postinit))
28f540f4 286endif
b122c703
RM
287ifndef config-LDFLAGS
288ifeq (yes,$(build-shared))
094bacdb 289config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
b122c703
RM
290endif
291endif
3fe9de0d
RM
292ifndef link-libc
293ifeq (yes,$(build-shared))
4cb20290 294link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(default-rpath) \
196980f5 295 $(common-objpfx)libc.so$(libc.so-version) $(gnulib)
4cb20290
RM
296# Choose the default search path for the dynamic linker based on
297# where we will install libraries.
298ifneq ($(libdir),$(slibdir))
299default-rpath = $(slibdir):$(libdir)
300else
301default-rpath = $(libdir)
302endif
3fe9de0d
RM
303else
304link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
305endif
306endif
28f540f4
RM
307ifndef gnulib
308gnulib := -lgcc
309endif
96f873b9
RM
310ifeq ($(elf),yes)
311+preinit = crti.o
312+postinit = crtn.o
313endif
314ifdef objpfx
315csu-objpfx = $(objpfx)
03a75825 316elf-objpfx = $(objpfx)
96f873b9 317else
883bc19b 318csu-objpfx = $(..)csu/
03a75825 319elf-objpfx = $(..)elf/
96f873b9 320endif
28f540f4 321
b122c703
RM
322ifeq (yes,$(build-shared))
323ifndef rtld-installed-name
324rtld-installed-name = ld.so
325endif
326endif
327
03a75825
RM
328# How to run a program we just linked with our library.
329# The program binary is assumed to be $(word 2,$^).
330built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
331ifneq (yes,$(build-shared))
332built-program-cmd = $(built-program-file)
333else
196980f5 334comma = ,
03a75825 335define built-program-cmd
196980f5
RM
336LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$(comma)-rpath-link=%,:%,\
337 $(filter -Wl$(comma)-rpath-link=%,\
03a75825
RM
338 $(sysdep-LDFLAGS))) \
339$(elf-objpfx)ld.so $(built-program-file)
340endef
341endif
342
28f540f4
RM
343ifndef LD
344LD := ld -X
345endif
346
347ifndef RANLIB
348RANLIB = ranlib
349endif
350
351# Extra flags to pass to GCC.
bf40c56f 352+gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline
28f540f4
RM
353
354# This is the program that generates makefile
355# dependencies from C source files.
356ifndef +mkdep
357+mkdep = $(CC) -M
358endif
359
360# The program that makes Emacs-style TAGS files.
361ETAGS := etags -T
362
363# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
364# perhaps others) to preprocess assembly code in some cases.
365M4 = m4
366
367####
368#### End of configuration variables.
369####
370\f
371# This tells some versions of GNU make before 3.63 not to export all variables.
372.NOEXPORT:
373
374# We want to echo the commands we're running without
375# umpteem zillion filenames along with it (we use `...' instead)
376# but we don't want this echoing done when the user has said
377# he doesn't want to see commands echoed by using -s.
378ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s
379+cmdecho := echo >/dev/null
380else # not -s
381+cmdecho := echo
382endif # -s
383
384# These are the flags given to the compiler to tell
385# it what sort of optimization and/or debugging output to do.
386ifndef +cflags
387# If `CFLAGS' was defined, use that.
388ifdef CFLAGS
389+cflags := $(filter-out -I%,$(CFLAGS))
390endif # CFLAGS
391endif # +cflags
392
393# If none of the above worked, default to "-g".
394ifeq "$(strip $(+cflags))" ""
395+cflags := $(default_cflags)
396endif # $(+cflags) == ""
397
398# If using gcc, add flags that only it will grok.
399ifneq "$(findstring gcc,$(CC))" ""
400+cflags := $(+cflags) $(+gccwarn)
401+gcc-nowarn := -w
402else
403+gcc-nowarn :=
404endif # gcc
405
406# Don't duplicate options if we inherited variables from the parent.
407+cflags := $(sort $(+cflags))
408
409
410# These are flags given to the C compiler to tell it to look for include
411# files (including ones given in angle brackets) in the current directory
412# and in the parent library source directory.
413# `+sysdep-includes' will be defined by Makerules.
96aa2d94 414+includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) $($(stdio)-include) \
28f540f4
RM
415 $(includes) $(+sysdep-includes) $(last-includes)
416
96aa2d94
RM
417# Since libio has several internal header files, we use a -I instead
418# of many little headers in the top level source directory.
419libio-include = -I$(..)libio
28f540f4
RM
420
421# These are the variables that the implicit compilation rules use.
422CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
53afa8d9 423 $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
d99d7e26
RM
424override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) \
425 $(CFLAGS-$(<F))
28f540f4
RM
426
427
428# This is the macro that the implicit linking rules use.
429ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
430LDFLAGS := -g
431endif
432
f0bf9cb9
RM
433
434# Enable object files for different versions of the library.
435# Various things use $(object-suffixes) to know what all to make.
436# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
437# to pass different flags for each flavor.
438libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
439object-suffixes := .o
440libtype.o := lib%.a
441ifeq (yes,$(build-shared))
442# Under --enable-shared, we will build a shared library of PIC objects.
443# The PIC object files are named foo.so.
444object-suffixes += .so
445CPPFLAGS-.so = -DPIC
446CFLAGS-.so = -fPIC
447libtype.so := lib%_pic.a
448endif
449ifeq (yes,$(build-profile))
450# Under --enable-profile, we will build a static library of profiled objects.
451# The profiled object files are named foo.po.
452object-suffixes += .po
453CFLAGS-.po = -p
454libtype.po = lib%_p.a
455endif
456ifeq (yes,$(build-omitfp))
457# Under --enable-omitfp, we build an the library optimized without
458# debugging information using -fomit-frame-pointer, and build an extra
459# library with debugging information. The debuggable objects are named foo.go.
460object-suffixes += .go
461CFLAGS-.go = -g
462CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
463CFLAGS-.so += $(CFLAGS.o)
464libtype.go = lib%_g.a
465endif
466
467
28f540f4
RM
468+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
469
470ifneq ($(BUILD_CC),$(CC))
471cross-compiling := yes
472else
473cross-compiling := no
474endif
475
476
477endif # Makeconfig not yet included
This page took 0.080155 seconds and 5 git commands to generate.