# Copyright (C) 1991, 1992 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 # You can put variables that are specific to a configuration in the file # Makeconfig in the object directory for that configuration. Variables # that do not vary between different configurations at your site can be # editted below. ifndef ARCH ifdef machine ARCH = $(machine) else include $(..)config.status endif endif # Directory for object files, libc.a, and ansi/ and trad/ directories. # If this is not defined, the object files live in the subdirectories # where their sources live, and libc.a and the ansi/ and trad/ directories # live in the parent directory (this probably doesn't work any more). ifdef ARCH ifeq ($(filter /%,$(ARCH)),) objdir := $(..)$(ARCH) else objdir = $(ARCH) endif ifneq ($(wildcard $(objdir)/Makeconfig),) include $(objdir)/Makeconfig endif endif # # These are the configuration variables. # # Common prefix for all installation directories. ifndef prefix prefix = /usr/local endif # Where to install the library and object files. ifndef libdir libdir = $(prefix)/lib endif # Where to install the header files. There are two sets of header files # produced, an ANSI C set and a traditional C set. ansi-incldir, if # defined, is where to install the ANSI C set; trad-incldir, if defined, is # where to install the traditional C set. If you define both, you can # install both sets, in different places. ifndef ansi-incldir ansi-incldir = $(prefix)/include endif ifndef trad-incldir #trad-incldir = $(prefix)/include endif # Define if the library should install its own . # Do this unless you are using version 2.2 or later of GCC. ifndef stddef.h stddef.h = stddef.h endif # Where to install machine-independent data files. # These are the timezone database, and eventually the locale database. ifndef datadir datadir = $(prefix)/lib endif # Where to install programs. ifndef bindir bindir = $(prefix)/bin 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 $(datadir)/zoneinfo. ifndef localtime-file localtime-file = /etc/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. ifndef posixrules posixrules = US/Eastern 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 $(datadir)/zoneinfo. 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) 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 -pipe endif # These are preprocessor macros we want to predefine. # Define HAVE_GNU_LD if using GNU ld (which you should do if possible). # If you do this, you may need the GNU assembler as well. # If you don't do this, your library won't work as well (and won't be strictly # compliant with the ANSI C standard). +defines = $(defines) -DHAVE_GNU_LD # Default flags to pass the C compiler. ifndef default_cflags +default_cflags := -g endif # Command for linking programs with the C library. ifndef +link +link = $(CC) -nostdlib -o $@ $(objpfx)start.o $(^:lib=$(objpfx)libc.a) \ -lgcc $(objpfx)libc.a endif ifndef LD LD := ld -X endif ifndef RANLIB RANLIB = ranlib endif # Define non-empty if the C compiler understands -v (print version). +cc_version = $(filter gcc,$(notdir $(firstword $(CC)))) # if using gcc # Extra flags to pass to GCC. +gccwarn := -Wall -Wwrite-strings -Wpointer-arith -Wstrict-prototypes +gccopt := -fstrength-reduce # 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 ifdef objdir objpfx = $(objdir)/ libc.a = $(objpfx)libc.a else objpfx := libc.a = $(..)libc.a endif # 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) ifneq "$(filter -O,$(+cflags))" "" +cflags := $(+cflags) $(+gccopt) endif endif # gcc # Don't duplicate options if we inherited variables from the parent. +cflags := $(sort $(+cflags)) ifneq "$(findstring v,$(MAKEFLAGS))" "" # if -v ifneq "$(strip $(+cc_version))" "" # If Make is telling us version info, tell the compiler to do so as well. CC := $(CC) -v endif # +cc_version endif # -v # 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. ifneq "$(..)" "" +includes = -I. -I$(patsubst %/,%,$(..)) $(includes) else +includes = -I. $(includes) endif # These are the variables that the implicit compilation rules use. CPPFLAGS = $(+includes) $(+defines) -DLIBC override CFLAGS = $(+cflags) # This is the macro that the implicit linking rules use. ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags) LDFLAGS := -g endif ifneq "$(filter -DHAVE_GNU_LD,$(CPPFLAGS))" "" +gnu-stabs := yes endif endif # Makeconfig not yet included