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