about summary refs log tree commit diff
path: root/Makeconfig
blob: 4cd8061e3c4497ce33746cb6afdad895f0d7030f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
# This file is part of the GNU C Library.

# The GNU C Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.

# The GNU C Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.

# You should have received a copy of the GNU Library General Public
# License along with the GNU C Library; see the file COPYING.LIB.  If
# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
# Cambridge, MA 02139, USA.

#
#	Makefile configuration options for the GNU C library.
#
ifneq (,)
This makefile requires GNU Make.
endif

ifneq "$(origin +included-Makeconfig)" "file"

+included-Makeconfig := yes

ifdef subdir
.. := ../
endif

# If config.make exists, the source directory was configured,
# so don't try to be clever and find another directory to build in.
ifneq (,$(wildcard $(..)config.make))
ARCH =
machine =
else	# Not configured.
ifndef ARCH
ifdef machine
ARCH = $(machine)
endif # machine
endif # ARCH
endif # config.make

# Directory for object files and libc.a.  If this is not defined, the
# object files live in the subdirectories where their sources live, and
# libc.a lives in the parent directory (this probably doesn't work any
# more).
ifdef ARCH
ifeq ($(filter /%,$(ARCH)),)
objdir := $(..)$(ARCH)
else
objdir = $(ARCH)
endif
endif

# $(common-objdir) is the place to put objects and 
# such that are not specific to a single subdir.
ifdef objdir
objpfx = $(objdir)/
common-objpfx = $(objpfx)
common-objdir = $(objdir)
else
objpfx :=
ifdef ..
common-objpfx = $(..)
common-objdir = ..
else
# This is a kludge.  make wizards might grok.
common-objpfx = sysdeps/../
common-objdir = .
endif
endif

libc.a = $(common-objpfx)libc.a


# Get the values defined by options to `configure'.
include $(common-objpfx)config.make

# Force the user to configure before making.
$(common-objpfx)config.make:
	@echo The GNU C library has not been configured. >&2
	@echo Run \`configure\' to configure it before building. >&2
	@exit 1

# Get the user's configuration parameters.
ifneq ($(wildcard $(..)configparms),)
include $(..)configparms
endif
ifneq ($(objpfx),)
ifneq ($(wildcard $(objpfx)configparms),)
include $(objpfx)configparms
endif
endif

sysdep_dir := $(..)sysdeps
export sysdep_dir := $(sysdep_dir)

####
####	These are the configuration variables.  You can define values for
####	the variables below in the file `configparms'.
####	Do NOT edit this file.
####


# Common prefix for machine-independent installation directories.
ifndef prefix
prefix = /usr/local
endif

# Common prefix for machine-dependent installation directories.
ifndef exec_prefix
exec_prefix = $(prefix)
endif

# Where to install the library and object files.
ifndef libdir
libdir = $(exec_prefix)/lib
endif

# Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
# the prefix is spliced between `lib' and the name, so the linker switch
# `-l$(libprefix)NAME' finds the library; for other files the prefix is
# just prepended to the whole file name.
ifndef libprefix
libprefix =
endif

# Where to install the header files.
ifndef includedir
includedir = $(exec_prefix)/include
endif

# Where to install machine-independent data files.
# These are the timezone database, and eventually the locale database.
ifndef datadir
datadir = $(prefix)/share
endif

# Where to install the timezone data files (which are machine-independent).
ifndef zonedir
zonedir = $(datadir)/zoneinfo
endif

# Where to install programs.
ifndef bindir
bindir = $(exec_prefix)/bin
endif

# Where to install administrative programs.
ifndef sbindir
sbindir = $(exec_prefix)/sbin
endif

# Where to install the Info files.
ifndef infodir
infodir = $(prefix)/info
endif

# Where to install default configuration files.  These include the local
# timezone specification and network data base files.
ifndef sysconfdir
sysconfdir = $(prefix)/etc
endif

# What timezone should be the installed default (e.g., US/Eastern).
# Run `make -C time echo-zonenames' to see a list of available zone names.
# The local timezone can be changed with `zic -l TIMEZONE' at any time.
ifndef localtime
localtime = Factory
endif

# Where to install the "localtime" timezone file; this is the file whose
# contents $(localtime) specifies.  If this is a relative pathname, it is
# relative to $(zonedir).  It is a good idea to put this somewhere
# other than there, so the zoneinfo directory contains only universal data,
# localizing the configuration data elsewhere.
ifndef localtime-file
localtime-file = $(sysconfdir)/localtime
endif

# What timezone's DST rules should be used when a POSIX-style TZ
# environment variable doesn't specify any rules.  For 1003.1 compliance
# this timezone must use rules that are as U.S. federal law defines DST.
# Run `make -C time echo-zonenames' to see a list of available zone names.
# This setting can be changed with `zic -p TIMEZONE' at any time.
# If you want POSIX.1 compatibility, use `America/New_York'.
ifndef posixrules
posixrules = America/New_York
endif

# Where to install the "posixrules" timezone file; this is file
# whose contents $(posixrules) specifies.  If this is a relative
# pathname, it is relative to $(zonedir).
ifndef posixrules-file
posixrules-file = posixrules
endif


# Directory where your system's native header files live.
# This is used on Unix systems to generate some GNU libc header files.
ifndef sysincludedir
sysincludedir = /usr/include
endif


# Commands to install files.
ifndef INSTALL_DATA
INSTALL_DATA = $(INSTALL) -m 644
endif
ifndef INSTALL_PROGRAM
INSTALL_PROGRAM = $(INSTALL)
endif
ifndef INSTALL
INSTALL = install
endif


# The name of the C compiler.
# If you've got GCC, and it works, use it.
ifeq ($(origin CC),default)
CC := gcc
endif

# The name of the C compiler to use for compilations of programs to run on
# the host that is building the library.  If you set CC to a
# cross-compiler, you must set this to the normal compiler.
ifndef BUILD_CC
BUILD_CC = $(CC)
endif

# Default flags to pass the C compiler.
ifndef default_cflags
default_cflags := -g
endif

# Flags to pass the C compiler when assembling preprocessed assembly code
# (`.S' files).  On some systems the assembler doesn't understand the `#' line
# directives the preprocessor produces.  If you have troubling compiling
# assembly code, try using -P here to suppress these directives.
ifndef asm-CPPFLAGS
asm-CPPFLAGS =
endif

# Command for linking programs with the C library.
ifndef +link
+link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
	$(addprefix $(csu-objpfx),start.o $(+preinit)) \
	$(^:lib=$(libc.a)) $(gnulib) $(libc.a) \
	$(addprefix $(csu-objpfx),$(+postinit))
endif
ifndef gnulib
gnulib := -lgcc
endif
ifeq ($(elf),yes)
+preinit = crti.o
+postinit = crtn.o
endif
ifdef objpfx
csu-objpfx = $(objpfx)
else
csu-objpfx = $(..)csu
endif

ifndef LD
LD := ld -X
endif

ifndef	RANLIB
RANLIB = ranlib
endif

# Extra flags to pass to GCC.
+gccwarn := -Wall -Wwrite-strings -Wno-parentheses

# This is the program that generates makefile
# dependencies from C source files.
ifndef +mkdep
+mkdep = $(CC) -M
endif

# The program that makes Emacs-style TAGS files.
ETAGS	:= etags -T

# The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
# perhaps others) to preprocess assembly code in some cases.
M4 = m4

####
#### End of configuration variables.
####

# This tells some versions of GNU make before 3.63 not to export all variables.
.NOEXPORT:

# We want to echo the commands we're running without
# umpteem zillion filenames along with it (we use `...' instead)
# but we don't want this echoing done when the user has said
# he doesn't want to see commands echoed by using -s.
ifneq	"$(findstring s,$(MAKEFLAGS))" ""	# if -s
+cmdecho	:= echo >/dev/null
else						# not -s
+cmdecho	:= echo
endif	   					# -s

# These are the flags given to the compiler to tell
# it what sort of optimization and/or debugging output to do.
ifndef	+cflags
# If `CFLAGS' was defined, use that.
ifdef		CFLAGS
+cflags	:= $(filter-out -I%,$(CFLAGS))
endif		# CFLAGS
endif	# +cflags

# If none of the above worked, default to "-g".
ifeq	"$(strip $(+cflags))" ""
+cflags	:= $(default_cflags)
endif	# $(+cflags) == ""

# If using gcc, add flags that only it will grok.
ifneq	"$(findstring gcc,$(CC))" ""
+cflags := $(+cflags) $(+gccwarn)
+gcc-nowarn := -w
else
+gcc-nowarn :=
endif	# gcc

# Don't duplicate options if we inherited variables from the parent.
+cflags	:= $(sort $(+cflags))


# These are flags given to the C compiler to tell it to look for include
# files (including ones given in angle brackets) in the current directory
# and in the parent library source directory.
# `+sysdep-includes' will be defined by Makerules.
+includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
	    $(includes) $(+sysdep-includes) $(last-includes)


# These are the variables that the implicit compilation rules use.
CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
	   $(sysdep-CPPFLAGS)
override CFLAGS	= $(+cflags) $(sysdep-CFLAGS)


# This is the macro that the implicit linking rules use.
ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
LDFLAGS	:= -g
endif

+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')

ifneq ($(BUILD_CC),$(CC))
cross-compiling := yes
else
cross-compiling := no
endif


endif # Makeconfig not yet included