]>
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 | ||
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. | |
98 | ifneq ($(wildcard $(..)configparms),) | |
99 | include $(..)configparms | |
100 | endif | |
101 | ifneq ($(objpfx),) | |
102 | ifneq ($(wildcard $(objpfx)configparms),) | |
103 | include $(objpfx)configparms | |
104 | endif | |
105 | endif | |
106 | ||
107 | sysdep_dir := $(..)sysdeps | |
108 | export 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. | |
119 | ifndef stdio | |
120 | stdio = stdio | |
121 | endif | |
122 | ||
28f540f4 | 123 | # Common prefix for machine-independent installation directories. |
487253ea | 124 | ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value. |
28f540f4 RM |
125 | prefix = /usr/local |
126 | endif | |
127 | ||
128 | # Common prefix for machine-dependent installation directories. | |
487253ea | 129 | ifeq ($(origin exec_prefix),undefined) |
28f540f4 RM |
130 | exec_prefix = $(prefix) |
131 | endif | |
132 | ||
133 | # Where to install the library and object files. | |
134 | ifndef libdir | |
135 | libdir = $(exec_prefix)/lib | |
136 | endif | |
137 | ||
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. | |
487253ea | 142 | ifeq ($(origin libprefix),undefined) |
28f540f4 RM |
143 | libprefix = |
144 | endif | |
145 | ||
146 | # Where to install the header files. | |
147 | ifndef includedir | |
148 | includedir = $(exec_prefix)/include | |
149 | endif | |
150 | ||
28f540f4 | 151 | # Where to install machine-independent data files. |
a2fe9c76 | 152 | # These are the timezone database, and the locale database. |
28f540f4 RM |
153 | ifndef datadir |
154 | datadir = $(prefix)/share | |
155 | endif | |
156 | ||
157 | # Where to install the timezone data files (which are machine-independent). | |
158 | ifndef zonedir | |
159 | zonedir = $(datadir)/zoneinfo | |
160 | endif | |
161 | ||
3ec41e03 RM |
162 | # Where to install the locale and message catalog data files (which are |
163 | # machine-independent). | |
a2fe9c76 RM |
164 | ifndef localedir |
165 | localedir = $(datadir)/locale | |
166 | endif | |
167 | ||
3ec41e03 | 168 | # Where to install the locale charmap source files. |
a2fe9c76 RM |
169 | ifndef nlsdir |
170 | nlsdir = $(datadir)/nls | |
171 | endif | |
172 | ||
173 | ||
28f540f4 RM |
174 | # Where to install programs. |
175 | ifndef bindir | |
176 | bindir = $(exec_prefix)/bin | |
177 | endif | |
178 | ||
179 | # Where to install administrative programs. | |
180 | ifndef sbindir | |
181 | sbindir = $(exec_prefix)/sbin | |
182 | endif | |
183 | ||
184 | # Where to install the Info files. | |
185 | ifndef infodir | |
186 | infodir = $(prefix)/info | |
187 | endif | |
188 | ||
189 | # Where to install default configuration files. These include the local | |
190 | # timezone specification and network data base files. | |
191 | ifndef sysconfdir | |
192 | sysconfdir = $(prefix)/etc | |
193 | endif | |
194 | ||
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. | |
198 | ifndef localtime | |
199 | localtime = Factory | |
200 | endif | |
201 | ||
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 | |
209 | endif | |
210 | ||
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'. | |
217 | ifndef posixrules | |
218 | posixrules = America/New_York | |
219 | endif | |
220 | ||
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 | |
226 | endif | |
227 | ||
228 | ||
229 | # Directory where your system's native header files live. | |
230 | # This is used on Unix systems to generate some GNU libc header files. | |
231 | ifndef sysincludedir | |
232 | sysincludedir = /usr/include | |
233 | endif | |
234 | ||
235 | ||
236 | # Commands to install files. | |
237 | ifndef INSTALL_DATA | |
238 | INSTALL_DATA = $(INSTALL) -m 644 | |
239 | endif | |
240 | ifndef INSTALL_PROGRAM | |
241 | INSTALL_PROGRAM = $(INSTALL) | |
242 | endif | |
243 | ifndef INSTALL | |
244 | INSTALL = install | |
245 | endif | |
246 | ||
247 | ||
248 | # The name of the C compiler. | |
249 | # If you've got GCC, and it works, use it. | |
250 | ifeq ($(origin CC),default) | |
251 | CC := gcc | |
252 | endif | |
253 | ||
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. | |
257 | ifndef BUILD_CC | |
258 | BUILD_CC = $(CC) | |
259 | endif | |
260 | ||
261 | # Default flags to pass the C compiler. | |
262 | ifndef default_cflags | |
263 | default_cflags := -g | |
264 | endif | |
265 | ||
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. | |
270 | ifndef asm-CPPFLAGS | |
271 | asm-CPPFLAGS = | |
272 | endif | |
273 | ||
274 | # Command for linking programs with the C library. | |
275 | ifndef +link | |
8e3cc80f RM |
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)) | |
28f540f4 | 281 | endif |
b122c703 RM |
282 | ifndef config-LDFLAGS |
283 | ifeq (yes,$(build-shared)) | |
db65048b | 284 | config-LDFLAGS = -Wl,-dynamic-linker=$(libdir)/$(rtld-installed-name) |
b122c703 RM |
285 | endif |
286 | endif | |
3fe9de0d RM |
287 | ifndef link-libc |
288 | ifeq (yes,$(build-shared)) | |
8e3cc80f RM |
289 | link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(libdir) \ |
290 | $(common-objpfx)libc.so $(gnulib) | |
3fe9de0d RM |
291 | else |
292 | link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a | |
293 | endif | |
294 | endif | |
28f540f4 RM |
295 | ifndef gnulib |
296 | gnulib := -lgcc | |
297 | endif | |
96f873b9 RM |
298 | ifeq ($(elf),yes) |
299 | +preinit = crti.o | |
300 | +postinit = crtn.o | |
301 | endif | |
302 | ifdef objpfx | |
303 | csu-objpfx = $(objpfx) | |
03a75825 | 304 | elf-objpfx = $(objpfx) |
96f873b9 | 305 | else |
883bc19b | 306 | csu-objpfx = $(..)csu/ |
03a75825 | 307 | elf-objpfx = $(..)elf/ |
96f873b9 | 308 | endif |
28f540f4 | 309 | |
b122c703 RM |
310 | ifeq (yes,$(build-shared)) |
311 | ifndef rtld-installed-name | |
312 | rtld-installed-name = ld.so | |
313 | endif | |
314 | endif | |
315 | ||
03a75825 RM |
316 | # How to run a program we just linked with our library. |
317 | # The program binary is assumed to be $(word 2,$^). | |
318 | built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^)) | |
319 | ifneq (yes,$(build-shared)) | |
320 | built-program-cmd = $(built-program-file) | |
321 | else | |
322 | , = , | |
323 | define built-program-cmd | |
324 | LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$,-rpath-link=%,:%,\ | |
325 | $(filter -Wl$,-rpath-link=%,\ | |
326 | $(sysdep-LDFLAGS))) \ | |
327 | $(elf-objpfx)ld.so $(built-program-file) | |
328 | endef | |
329 | endif | |
330 | ||
28f540f4 RM |
331 | ifndef LD |
332 | LD := ld -X | |
333 | endif | |
334 | ||
335 | ifndef RANLIB | |
336 | RANLIB = ranlib | |
337 | endif | |
338 | ||
339 | # Extra flags to pass to GCC. | |
bf40c56f | 340 | +gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline |
28f540f4 RM |
341 | |
342 | # This is the program that generates makefile | |
343 | # dependencies from C source files. | |
344 | ifndef +mkdep | |
345 | +mkdep = $(CC) -M | |
346 | endif | |
347 | ||
348 | # The program that makes Emacs-style TAGS files. | |
349 | ETAGS := etags -T | |
350 | ||
351 | # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and | |
352 | # perhaps others) to preprocess assembly code in some cases. | |
353 | M4 = m4 | |
354 | ||
355 | #### | |
356 | #### End of configuration variables. | |
357 | #### | |
358 | \f | |
359 | # This tells some versions of GNU make before 3.63 not to export all variables. | |
360 | .NOEXPORT: | |
361 | ||
362 | # We want to echo the commands we're running without | |
363 | # umpteem zillion filenames along with it (we use `...' instead) | |
364 | # but we don't want this echoing done when the user has said | |
365 | # he doesn't want to see commands echoed by using -s. | |
366 | ifneq "$(findstring s,$(MAKEFLAGS))" "" # if -s | |
367 | +cmdecho := echo >/dev/null | |
368 | else # not -s | |
369 | +cmdecho := echo | |
370 | endif # -s | |
371 | ||
372 | # These are the flags given to the compiler to tell | |
373 | # it what sort of optimization and/or debugging output to do. | |
374 | ifndef +cflags | |
375 | # If `CFLAGS' was defined, use that. | |
376 | ifdef CFLAGS | |
377 | +cflags := $(filter-out -I%,$(CFLAGS)) | |
378 | endif # CFLAGS | |
379 | endif # +cflags | |
380 | ||
381 | # If none of the above worked, default to "-g". | |
382 | ifeq "$(strip $(+cflags))" "" | |
383 | +cflags := $(default_cflags) | |
384 | endif # $(+cflags) == "" | |
385 | ||
386 | # If using gcc, add flags that only it will grok. | |
387 | ifneq "$(findstring gcc,$(CC))" "" | |
388 | +cflags := $(+cflags) $(+gccwarn) | |
389 | +gcc-nowarn := -w | |
390 | else | |
391 | +gcc-nowarn := | |
392 | endif # gcc | |
393 | ||
394 | # Don't duplicate options if we inherited variables from the parent. | |
395 | +cflags := $(sort $(+cflags)) | |
396 | ||
397 | ||
398 | # These are flags given to the C compiler to tell it to look for include | |
399 | # files (including ones given in angle brackets) in the current directory | |
400 | # and in the parent library source directory. | |
401 | # `+sysdep-includes' will be defined by Makerules. | |
402 | +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \ | |
403 | $(includes) $(+sysdep-includes) $(last-includes) | |
404 | ||
405 | ||
406 | # These are the variables that the implicit compilation rules use. | |
407 | CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \ | |
53afa8d9 RM |
408 | $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@)) |
409 | override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) | |
28f540f4 RM |
410 | |
411 | ||
412 | # This is the macro that the implicit linking rules use. | |
413 | ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags) | |
414 | LDFLAGS := -g | |
415 | endif | |
416 | ||
f0bf9cb9 RM |
417 | |
418 | # Enable object files for different versions of the library. | |
419 | # Various things use $(object-suffixes) to know what all to make. | |
420 | # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX}) | |
421 | # to pass different flags for each flavor. | |
422 | libtypes = $(foreach o,$(object-suffixes),$(libtype$o)) | |
423 | object-suffixes := .o | |
424 | libtype.o := lib%.a | |
425 | ifeq (yes,$(build-shared)) | |
426 | # Under --enable-shared, we will build a shared library of PIC objects. | |
427 | # The PIC object files are named foo.so. | |
428 | object-suffixes += .so | |
429 | CPPFLAGS-.so = -DPIC | |
430 | CFLAGS-.so = -fPIC | |
431 | libtype.so := lib%_pic.a | |
432 | endif | |
433 | ifeq (yes,$(build-profile)) | |
434 | # Under --enable-profile, we will build a static library of profiled objects. | |
435 | # The profiled object files are named foo.po. | |
436 | object-suffixes += .po | |
437 | CFLAGS-.po = -p | |
438 | libtype.po = lib%_p.a | |
439 | endif | |
440 | ifeq (yes,$(build-omitfp)) | |
441 | # Under --enable-omitfp, we build an the library optimized without | |
442 | # debugging information using -fomit-frame-pointer, and build an extra | |
443 | # library with debugging information. The debuggable objects are named foo.go. | |
444 | object-suffixes += .go | |
445 | CFLAGS-.go = -g | |
446 | CFLAGS-.o = -g0 -O99 -fomit-frame-pointer | |
447 | CFLAGS-.so += $(CFLAGS.o) | |
448 | libtype.go = lib%_g.a | |
449 | endif | |
450 | ||
451 | ||
28f540f4 RM |
452 | +gnu-stabs = $(shell echo>&2 '*** BARF ON ME') |
453 | ||
454 | ifneq ($(BUILD_CC),$(CC)) | |
455 | cross-compiling := yes | |
456 | else | |
457 | cross-compiling := no | |
458 | endif | |
459 | ||
460 | ||
461 | endif # Makeconfig not yet included |