Mon Oct 9 02:54:14 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / Makeconfig
blobe0ec754883b9e3fadd7f39455338b997153c43e5
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 # Common prefix for machine-independent installation directories.
118 ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
119 prefix = /usr/local
120 endif
122 # Common prefix for machine-dependent installation directories.
123 ifeq ($(origin exec_prefix),undefined)
124 exec_prefix = $(prefix)
125 endif
127 # Where to install the library and object files.
128 ifndef libdir
129 libdir = $(exec_prefix)/lib
130 endif
132 # Prefix to put on files installed in $(libdir).  For libraries `libNAME.a',
133 # the prefix is spliced between `lib' and the name, so the linker switch
134 # `-l$(libprefix)NAME' finds the library; for other files the prefix is
135 # just prepended to the whole file name.
136 ifeq ($(origin libprefix),undefined)
137 libprefix =
138 endif
140 # Where to install the header files.
141 ifndef includedir
142 includedir = $(exec_prefix)/include
143 endif
145 # Where to install machine-independent data files.
146 # These are the timezone database, and the locale database.
147 ifndef datadir
148 datadir = $(prefix)/share
149 endif
151 # Where to install the timezone data files (which are machine-independent).
152 ifndef zonedir
153 zonedir = $(datadir)/zoneinfo
154 endif
156 # Where to install the locale and message catalog data files (which are
157 # machine-independent).
158 ifndef localedir
159 localedir = $(datadir)/locale
160 endif
162 # Where to install the locale charmap source files.
163 ifndef nlsdir
164 nlsdir = $(datadir)/nls
165 endif
168 # Where to install programs.
169 ifndef bindir
170 bindir = $(exec_prefix)/bin
171 endif
173 # Where to install administrative programs.
174 ifndef sbindir
175 sbindir = $(exec_prefix)/sbin
176 endif
178 # Where to install the Info files.
179 ifndef infodir
180 infodir = $(prefix)/info
181 endif
183 # Where to install default configuration files.  These include the local
184 # timezone specification and network data base files.
185 ifndef sysconfdir
186 sysconfdir = $(prefix)/etc
187 endif
189 # What timezone should be the installed default (e.g., US/Eastern).
190 # Run `make -C time echo-zonenames' to see a list of available zone names.
191 # The local timezone can be changed with `zic -l TIMEZONE' at any time.
192 ifndef localtime
193 localtime = Factory
194 endif
196 # Where to install the "localtime" timezone file; this is the file whose
197 # contents $(localtime) specifies.  If this is a relative pathname, it is
198 # relative to $(zonedir).  It is a good idea to put this somewhere
199 # other than there, so the zoneinfo directory contains only universal data,
200 # localizing the configuration data elsewhere.
201 ifndef localtime-file
202 localtime-file = $(sysconfdir)/localtime
203 endif
205 # What timezone's DST rules should be used when a POSIX-style TZ
206 # environment variable doesn't specify any rules.  For 1003.1 compliance
207 # this timezone must use rules that are as U.S. federal law defines DST.
208 # Run `make -C time echo-zonenames' to see a list of available zone names.
209 # This setting can be changed with `zic -p TIMEZONE' at any time.
210 # If you want POSIX.1 compatibility, use `America/New_York'.
211 ifndef posixrules
212 posixrules = America/New_York
213 endif
215 # Where to install the "posixrules" timezone file; this is file
216 # whose contents $(posixrules) specifies.  If this is a relative
217 # pathname, it is relative to $(zonedir).
218 ifndef posixrules-file
219 posixrules-file = posixrules
220 endif
223 # Directory where your system's native header files live.
224 # This is used on Unix systems to generate some GNU libc header files.
225 ifndef sysincludedir
226 sysincludedir = /usr/include
227 endif
230 # Commands to install files.
231 ifndef INSTALL_DATA
232 INSTALL_DATA = $(INSTALL) -m 644
233 endif
234 ifndef INSTALL_PROGRAM
235 INSTALL_PROGRAM = $(INSTALL)
236 endif
237 ifndef INSTALL
238 INSTALL = install
239 endif
242 # The name of the C compiler.
243 # If you've got GCC, and it works, use it.
244 ifeq ($(origin CC),default)
245 CC := gcc
246 endif
248 # The name of the C compiler to use for compilations of programs to run on
249 # the host that is building the library.  If you set CC to a
250 # cross-compiler, you must set this to the normal compiler.
251 ifndef BUILD_CC
252 BUILD_CC = $(CC)
253 endif
255 # Default flags to pass the C compiler.
256 ifndef default_cflags
257 default_cflags := -g
258 endif
260 # Flags to pass the C compiler when assembling preprocessed assembly code
261 # (`.S' files).  On some systems the assembler doesn't understand the `#' line
262 # directives the preprocessor produces.  If you have troubling compiling
263 # assembly code, try using -P here to suppress these directives.
264 ifndef asm-CPPFLAGS
265 asm-CPPFLAGS =
266 endif
268 # Command for linking programs with the C library.
269 ifndef +link
270 +link = $(CC) -nostdlib -nostartfiles $(config-LDFLAGS) $(LDFLAGS) -o $@ \
271         $(addprefix $(csu-objpfx),start.o $(+preinit)) \
272         $(^:$(common-objpfx)libc.a=$(link-libc)) \
273         $(addprefix $(csu-objpfx),$(+postinit))
274 endif
275 ifndef config-LDFLAGS
276 ifeq (yes,$(build-shared))
277 config-LDFLAGS = -Wl,-dynamic-linker=$(libdir)$(rtld-installed-name)
278 endif
279 endif
280 ifndef link-libc
281 ifeq (yes,$(build-shared))
282 link-libc = -L$(common-objdir) -lc $(gnulib)
283 else
284 link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
285 endif
286 endif
287 ifndef gnulib
288 gnulib := -lgcc
289 endif
290 ifeq ($(elf),yes)
291 +preinit = crti.o
292 +postinit = crtn.o
293 endif
294 ifdef objpfx
295 csu-objpfx = $(objpfx)
296 else
297 csu-objpfx = $(..)csu/
298 endif
300 ifeq (yes,$(build-shared))
301 ifndef rtld-installed-name
302 rtld-installed-name = ld.so
303 endif
304 endif
306 ifndef LD
307 LD := ld -X
308 endif
310 ifndef  RANLIB
311 RANLIB = ranlib
312 endif
314 # Extra flags to pass to GCC.
315 +gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline
317 # This is the program that generates makefile
318 # dependencies from C source files.
319 ifndef +mkdep
320 +mkdep = $(CC) -M
321 endif
323 # The program that makes Emacs-style TAGS files.
324 ETAGS   := etags -T
326 # The `m4' macro processor; this is used by sysdeps/sparc/Makefile (and
327 # perhaps others) to preprocess assembly code in some cases.
328 M4 = m4
330 ####
331 #### End of configuration variables.
332 ####
334 # This tells some versions of GNU make before 3.63 not to export all variables.
335 .NOEXPORT:
337 # We want to echo the commands we're running without
338 # umpteem zillion filenames along with it (we use `...' instead)
339 # but we don't want this echoing done when the user has said
340 # he doesn't want to see commands echoed by using -s.
341 ifneq   "$(findstring s,$(MAKEFLAGS))" ""       # if -s
342 +cmdecho        := echo >/dev/null
343 else                                            # not -s
344 +cmdecho        := echo
345 endif                                           # -s
347 # These are the flags given to the compiler to tell
348 # it what sort of optimization and/or debugging output to do.
349 ifndef  +cflags
350 # If `CFLAGS' was defined, use that.
351 ifdef           CFLAGS
352 +cflags := $(filter-out -I%,$(CFLAGS))
353 endif           # CFLAGS
354 endif   # +cflags
356 # If none of the above worked, default to "-g".
357 ifeq    "$(strip $(+cflags))" ""
358 +cflags := $(default_cflags)
359 endif   # $(+cflags) == ""
361 # If using gcc, add flags that only it will grok.
362 ifneq   "$(findstring gcc,$(CC))" ""
363 +cflags := $(+cflags) $(+gccwarn)
364 +gcc-nowarn := -w
365 else
366 +gcc-nowarn :=
367 endif   # gcc
369 # Don't duplicate options if we inherited variables from the parent.
370 +cflags := $(sort $(+cflags))
373 # These are flags given to the C compiler to tell it to look for include
374 # files (including ones given in angle brackets) in the current directory
375 # and in the parent library source directory.
376 # `+sysdep-includes' will be defined by Makerules.
377 +includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
378             $(includes) $(+sysdep-includes) $(last-includes)
381 # These are the variables that the implicit compilation rules use.
382 CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
383            $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
384 override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@))
387 # This is the macro that the implicit linking rules use.
388 ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
389 LDFLAGS := -g
390 endif
393 # Enable object files for different versions of the library.
394 # Various things use $(object-suffixes) to know what all to make.
395 # The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
396 # to pass different flags for each flavor.
397 libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
398 object-suffixes := .o
399 libtype.o := lib%.a
400 ifeq (yes,$(build-shared))
401 # Under --enable-shared, we will build a shared library of PIC objects.
402 # The PIC object files are named foo.so.
403 object-suffixes += .so
404 CPPFLAGS-.so = -DPIC
405 CFLAGS-.so = -fPIC
406 libtype.so := lib%_pic.a
407 endif
408 ifeq (yes,$(build-profile))
409 # Under --enable-profile, we will build a static library of profiled objects.
410 # The profiled object files are named foo.po.
411 object-suffixes += .po
412 CFLAGS-.po = -p
413 libtype.po = lib%_p.a
414 endif
415 ifeq (yes,$(build-omitfp))
416 # Under --enable-omitfp, we build an the library optimized without
417 # debugging information using -fomit-frame-pointer, and build an extra
418 # library with debugging information.  The debuggable objects are named foo.go.
419 object-suffixes += .go
420 CFLAGS-.go = -g
421 CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
422 CFLAGS-.so += $(CFLAGS.o)
423 libtype.go = lib%_g.a
424 endif
427 +gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
429 ifneq ($(BUILD_CC),$(CC))
430 cross-compiling := yes
431 else
432 cross-compiling := no
433 endif
436 endif # Makeconfig not yet included