-# Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 96 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
endif
endif
-# $(common-objdir) is the place to put objects and
+# $(common-objdir) is the place to put objects and
# such that are not specific to a single subdir.
ifdef objdir
objpfx = $(objdir)/
# Get the values defined by options to `configure'.
include $(common-objpfx)config.make
+# Run config.status to update config.make and config.h. We don't show the
+# dependence of config.h to Make, because it is only touched when it
+# changes and so config.status would be run every time; the dependence of
+# config.make should suffice to force regeneration and re-exec, and the new
+# image will notice if config.h changed.
+$(common-objpfx)config.make: $(common-objpfx)config.status
+ cd $(<D); $(SHELL) $(<F)
+
# Force the user to configure before making.
-$(common-objpfx)config.make:
- @echo The GNU C library has not been configured. >&2
- @echo Run \`configure\' to configure it before building. >&2
- @exit 1
+$(common-objpfx)config.status: $(..)configure
+ @cd $(@D); if test -f $(@F); then exec $(SHELL) $(@F) --recheck; else \
+ echo The GNU C library has not been configured. >&2; \
+ echo Run \`configure\' to configure it before building. >&2; \
+ echo Try \`configure --help\' for more details. >&2; \
+ exit 1; fi
# Get the user's configuration parameters.
ifneq ($(wildcard $(..)configparms),)
####
+# Set this to either `stdio' or `libio', to compile in either GNU stdio
+# or GNU libio.
+ifndef stdio
+stdio = stdio
+endif
+
# Common prefix for machine-independent installation directories.
-ifndef prefix
+ifeq ($(origin prefix),undefined) # ifndef would override explicit empty value.
prefix = /usr/local
endif
# Common prefix for machine-dependent installation directories.
-ifndef exec_prefix
+ifeq ($(origin exec_prefix),undefined)
exec_prefix = $(prefix)
endif
libdir = $(exec_prefix)/lib
endif
+# Where to install the shared library and dynamic linker.
+ifndef slibdir
+slibdir = $(exec_prefix)/lib
+endif
+
# Prefix to put on files installed in $(libdir). For libraries `libNAME.a',
# the prefix is spliced between `lib' and the name, so the linker switch
# `-l$(libprefix)NAME' finds the library; for other files the prefix is
# just prepended to the whole file name.
-ifndef libprefix
+ifeq ($(origin libprefix),undefined)
libprefix =
endif
endif
# Where to install machine-independent data files.
-# These are the timezone database, and eventually the locale database.
+# These are the timezone database, and the locale database.
ifndef datadir
datadir = $(prefix)/share
endif
zonedir = $(datadir)/zoneinfo
endif
+# Where to install the locale and message catalog data files (which are
+# machine-independent).
+ifndef localedir
+localedir = $(datadir)/locale
+endif
+
+# Where to install the locale charmap source files.
+ifndef nlsdir
+nlsdir = $(datadir)/nls
+endif
+
+
# Where to install programs.
ifndef bindir
bindir = $(exec_prefix)/bin
# Command for linking programs with the C library.
ifndef +link
-+link = $(CC) -nostdlib $(LDFLAGS) -o $@ \
- $(addprefix $(csu-objpfx),start.o $(+preinit)) \
- $(^:lib=$(common-objpfx)libc.a) $(gnulib) $(common-objpfx)libc.a \
- $(addprefix $(csu-objpfx),$(+postinit))
++link = $(CC) -nostdlib -nostartfiles -o $@ \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
+ $(addprefix $(csu-objpfx),start.o $(+preinit)) \
+ $(filter-out $(common-objpfx)libc%,$^) $(link-libc) \
+ $(addprefix $(csu-objpfx),$(+postinit))
+endif
+ifndef config-LDFLAGS
+ifeq (yes,$(build-shared))
+config-LDFLAGS = -Wl,-dynamic-linker=$(slibdir)/$(rtld-installed-name)
+endif
+endif
+ifndef link-libc
+ifeq (yes,$(build-shared))
+link-libc = -Wl,-rpath-link=$(common-objdir) \
+ $(common-objpfx)libc.so$(libc.so-version) $(gnulib)
+# Choose the default search path for the dynamic linker based on
+# where we will install libraries.
+ifneq ($(libdir),$(slibdir))
+default-rpath = $(slibdir):$(libdir)
+else
+default-rpath = $(libdir)
+endif
+else
+link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
+endif
endif
ifndef gnulib
gnulib := -lgcc
endif
ifdef objpfx
csu-objpfx = $(objpfx)
+elf-objpfx = $(objpfx)
+else
+csu-objpfx = $(..)csu/
+elf-objpfx = $(..)elf/
+endif
+
+ifeq (yes,$(build-shared))
+ifndef rtld-installed-name
+rtld-installed-name = ld.so
+endif
+endif
+
+# How to run a program we just linked with our library.
+# The program binary is assumed to be $(word 2,$^).
+built-program-file = $(dir $(word 2,$^))$(notdir $(word 2,$^))
+ifneq (yes,$(build-shared))
+built-program-cmd = $(built-program-file)
else
-csu-objpfx = $(..)csu
+comma = ,
+define built-program-cmd
+LD_LIBRARY_PATH=$(common-objdir)$(patsubst -Wl$(comma)-rpath-link=%,:%,\
+ $(filter -Wl$(comma)-rpath-link=%,\
+ $(sysdep-LDFLAGS))) \
+$(elf-objpfx)ld.so $(built-program-file)
+endef
endif
ifndef LD
endif
# Extra flags to pass to GCC.
-+gccwarn := -Wall -Wwrite-strings -Wno-parentheses
++gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline -Wstrict-prototypes
# This is the program that generates makefile
# dependencies from C source files.
# files (including ones given in angle brackets) in the current directory
# and in the parent library source directory.
# `+sysdep-includes' will be defined by Makerules.
-+includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) \
++includes = -I. $(filter-out -I,-I$(patsubst %/,%,$(..))) $($(stdio)-include) \
$(includes) $(+sysdep-includes) $(last-includes)
+# Since libio has several internal header files, we use a -I instead
+# of many little headers in the top level source directory.
+libio-include = -I$(..)libio
# These are the variables that the implicit compilation rules use.
CPPFLAGS = $(+includes) $(defines) -include $(..)libc-symbols.h \
- $(sysdep-CPPFLAGS)
-override CFLAGS = $(+cflags) $(sysdep-CFLAGS)
+ $(sysdep-CPPFLAGS) $(CPPFLAGS-$(suffix $@))
+override CFLAGS = $(+cflags) $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) \
+ $(CFLAGS-$(<F))
# This is the macro that the implicit linking rules use.
LDFLAGS := -g
endif
+
+# Enable object files for different versions of the library.
+# Various things use $(object-suffixes) to know what all to make.
+# The compilation rules use $(CPPFLAGS-${SUFFIX}) and $(CFLAGS-${SUFFIX})
+# to pass different flags for each flavor.
+libtypes = $(foreach o,$(object-suffixes),$(libtype$o))
+object-suffixes := .o
+libtype.o := lib%.a
+ifeq (yes,$(build-shared))
+# Under --enable-shared, we will build a shared library of PIC objects.
+# The PIC object files are named foo.so.
+object-suffixes += .so
+CPPFLAGS-.so = -DPIC
+CFLAGS-.so = -fPIC
+libtype.so := lib%_pic.a
+endif
+ifeq (yes,$(build-profile))
+# Under --enable-profile, we will build a static library of profiled objects.
+# The profiled object files are named foo.po.
+object-suffixes += .po
+CPPFLAGS-.po = -DPROF
+CFLAGS-.po = -pg
+libtype.po = lib%_p.a
+endif
+ifeq (yes,$(build-omitfp))
+# Under --enable-omitfp, we build an the library optimized without
+# debugging information using -fomit-frame-pointer, and build an extra
+# library with debugging information. The debuggable objects are named foo.go.
+object-suffixes += .go
+CFLAGS-.go = -g
+CFLAGS-.o = -g0 -O99 -fomit-frame-pointer
+CFLAGS-.so += $(CFLAGS.o)
+libtype.go = lib%_g.a
+endif
+
+
+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
ifneq ($(BUILD_CC),$(CC))