Sun Dec 17 15:56:35 1995 Miles Bader <miles@gnu.ai.mit.edu>
[glibc.git] / Makeconfig
blob03df0d56ddcb509dcef8b42d4addb84a718efc8a
1 # Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
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.
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.
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.
20 #       Makefile configuration options for the GNU C library.
22 ifneq (,)
23 This makefile requires GNU Make.
24 endif
26 ifneq "$(origin +included-Makeconfig)" "file"
28 +included-Makeconfig := yes
30 ifdef subdir
31 .. := ../
32 endif
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
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
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
78 # Get the values defined by options to `configure'.
79 include $(common-objpfx)config.make
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)
89 # Force the user to configure before making.
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
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
107 sysdep_dir := $(..)sysdeps
108 export sysdep_dir := $(sysdep_dir)
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 ####
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
123 # Common prefix for machine-independent installation directories.
124 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
125 prefix = /usr/local
126 endif
128 # Common prefix for machine-dependent installation directories.
129 ifeq ($(origin exec_prefix),undefined)
130 exec_prefix = $(prefix)
131 endif
133 # Where to install the library and object files.
134 ifndef libdir
135 libdir = $(exec_prefix)/lib
136 endif
138 # Where to install the shared library and dynamic linker.
139 ifndef slibdir
140 slibdir = $(exec_prefix)/lib
141 endif
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.
147 ifeq ($(origin libprefix),undefined)
148 libprefix =
149 endif
151 # Where to install the header files.
152 ifndef includedir
153 includedir = $(exec_prefix)/include
154 endif
156 # Where to install machine-independent data files.
157 # These are the timezone database, and the locale database.
158 ifndef datadir
159 datadir = $(prefix)/share
160 endif
162 # Where to install the timezone data files (which are machine-independent).
163 ifndef zonedir
164 zonedir = $(datadir)/zoneinfo
165 endif
167 # Where to install the locale and message catalog data files (which are
168 # machine-independent).
169 ifndef localedir
170 localedir = $(datadir)/locale
171 endif
173 # Where to install the locale charmap source files.
174 ifndef nlsdir
175 nlsdir = $(datadir)/nls
176 endif
179 # Where to install programs.
180 ifndef bindir
181 bindir = $(exec_prefix)/bin
182 endif
184 # Where to install administrative programs.
185 ifndef sbindir
186 sbindir = $(exec_prefix)/sbin
187 endif
189 # Where to install the Info files.
190 ifndef infodir
191 infodir = $(prefix)/info
192 endif
194 # Where to install default configuration files.  These include the local
195 # timezone specification and network data base files.
196 ifndef sysconfdir
197 sysconfdir = $(prefix)/etc
198 endif
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.
203 ifndef localtime
204 localtime = Factory
205 endif
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.
212 ifndef localtime-file
213 localtime-file = $(sysconfdir)/localtime
214 endif
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'.
222 ifndef posixrules
223 posixrules = America/New_York
224 endif
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).
229 ifndef posixrules-file
230 posixrules-file = posixrules
231 endif
234 # Directory where your system's native header files live.
235 # This is used on Unix systems to generate some GNU libc header files.
236 ifndef sysincludedir
237 sysincludedir = /usr/include
238 endif
241 # Commands to install files.
242 ifndef INSTALL_DATA
243 INSTALL_DATA = $(INSTALL) -m 644
244 endif
245 ifndef INSTALL_PROGRAM
246 INSTALL_PROGRAM = $(INSTALL)
247 endif
248 ifndef INSTALL
249 INSTALL = install
250 endif
253 # The name of the C compiler.
254 # If you've got GCC, and it works, use it.
255 ifeq ($(origin CC),default)
256 CC := gcc
257 endif
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.
262 ifndef BUILD_CC
263 BUILD_CC = $(CC)
264 endif
266 # Default flags to pass the C compiler.
267 ifndef default_cflags
268 default_cflags := -g
269 endif
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.
275 ifndef asm-CPPFLAGS
276 asm-CPPFLAGS =
277 endif
279 # Command for linking programs with the C library.
280 ifndef +link
281 +link = $(CC) -nostdlib -nostartfiles -o $@ \
282               $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS)  \
283               $(addprefix $(csu-objpfx),start.o $(+preinit)) \
284               $(^:$(common-objpfx)libc%=$(link-libc)) \
285               $(addprefix $(csu-objpfx),$(+postinit))
286 endif
287 ifndef config-LDFLAGS
288 ifeq (yes,$(build-shared))
289 config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
290 endif
291 endif
292 ifndef link-libc
293 ifeq (yes,$(build-shared))
294 link-libc = -Wl,-rpath-link=$(common-objdir) -Wl,-rpath=$(default-rpath) \
295             $(common-objpfx)libc.so$(libc.so-version) $(gnulib)
296 # Choose the default search path for the dynamic linker based on
297 # where we will install libraries.
298 ifneq ($(libdir),$(slibdir))
299 default-rpath = $(slibdir):$(libdir)
300 else
301 default-rpath = $(libdir)
302 endif
303 else
304 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
305 endif
306 endif
307 ifndef gnulib
308 gnulib := -lgcc
309 endif
310 ifeq ($(elf),yes)
311 +preinit = crti.o
312 +postinit = crtn.o
313 endif
314 ifdef objpfx
315 csu-objpfx = $(objpfx)
316 elf-objpfx = $(objpfx)
317 else
318 csu-objpfx = $(..)csu/
319 elf-objpfx = $(..)elf/
320 endif
322 ifeq (yes,$(build-shared))
323 ifndef rtld-installed-name
324 rtld-installed-name = ld.so
325 endif
326 endif
328 # How to run a program we just linked with our library.
329 # The program binary is assumed to be $(word 2,$^).
330 built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
331 ifneq (yes,$(build-shared))
332 built-program-cmd = $(built-program-file)
333 else
334 comma = ,
335 define built-program-cmd
336 LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$(comma)-rpath-link=%,:%,\
337                                            $(filter -Wl$(comma)-rpath-link=%,\
338                                                     $(sysdep-LDFLAGS))) \
339 $(elf-objpfx)ld.so $(built-program-file)
340 endef
341 endif
343 ifndef LD
344 LD := ld -X
345 endif
347 ifndef  RANLIB
348 RANLIB = ranlib
349 endif
351 # Extra flags to pass to GCC.
352 +gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline
354 # This is the program that generates makefile
355 # dependencies from C source files.
356 ifndef +mkdep
357 +mkdep = $(CC) -M
358 endif
360 # The program that makes Emacs-style TAGS files.
361 ETAGS   := etags -T
363 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
364 # perhaps others) to preprocess assembly code in some cases.
365 M4 = m4
367 ####
368 #### End of configuration variables.
369 ####
371 # This tells some versions of GNU make before 3.63 not to export all variables.
372 .NOEXPORT:
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.
378 ifneq   "$(findstring s,$(MAKEFLAGS))" ""       # if -s
379 +cmdecho        := echo >/dev/null
380 else                                            # not -s
381 +cmdecho        := echo
382 endif                                           # -s
384 # These are the flags given to the compiler to tell
385 # it what sort of optimization and/or debugging output to do.
386 ifndef  +cflags
387 # If `CFLAGS' was defined, use that.
388 ifdef           CFLAGS
389 +cflags := $(filter-out -I%,$(CFLAGS))
390 endif           # CFLAGS
391 endif   # +cflags
393 # If none of the above worked, default to "-g".
394 ifeq    "$(strip $(+cflags))" ""
395 +cflags := $(default_cflags)
396 endif   # $(+cflags) == ""
398 # If using gcc, add flags that only it will grok.
399 ifneq   "$(findstring gcc,$(CC))" ""
400 +cflags := $(+cflags) $(+gccwarn)
401 +gcc-nowarn := -w
402 else
403 +gcc-nowarn :=
404 endif   # gcc
406 # Don't duplicate options if we inherited variables from the parent.
407 +cflags := $(sort $(+cflags))
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.
414 +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) $($(stdio)-include) \
415             $(includes) $(+sysdep-includes) $(last-includes)
417 # Since libio has several internal header files, we use a -I instead
418 # of many little headers in the top level source directory.
419 libio-include = -I$(..)libio
421 # These are the variables that the implicit compilation rules use.
422 CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
423            $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
424 override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@))
427 # This is the macro that the implicit linking rules use.
428 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
429 LDFLAGS := -g
430 endif
433 # Enable object files for different versions of the library.
434 # Various things use $(object-suffixes) to know what all to make.
435 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
436 # to pass different flags for each flavor.
437 libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
438 object-suffixes := .o
439 libtype.o := lib%.a
440 ifeq (yes,$(build-shared))
441 # Under --enable-shared, we will build a shared library of PIC objects.
442 # The PIC object files are named foo.so.
443 object-suffixes += .so
444 CPPFLAGS-.so = -DPIC
445 CFLAGS-.so = -fPIC
446 libtype.so := lib%_pic.a
447 endif
448 ifeq (yes,$(build-profile))
449 # Under --enable-profile, we will build a static library of profiled objects.
450 # The profiled object files are named foo.po.
451 object-suffixes += .po
452 CFLAGS-.po = -p
453 libtype.po = lib%_p.a
454 endif
455 ifeq (yes,$(build-omitfp))
456 # Under --enable-omitfp, we build an the library optimized without
457 # debugging information using -fomit-frame-pointer, and build an extra
458 # library with debugging information.  The debuggable objects are named foo.go.
459 object-suffixes += .go
460 CFLAGS-.go = -g
461 CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
462 CFLAGS-.so += $(CFLAGS.o)
463 libtype.go = lib%_g.a
464 endif
467 +gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
469 ifneq ($(BUILD_CC),$(CC))
470 cross-compiling := yes
471 else
472 cross-compiling := no
473 endif
476 endif # Makeconfig not yet included