-# Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2000 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
# Complete path to sysdep dirs.
-full-config-sysdirs := $(filter /%, $(config-sysdirs)) \
- $(addprefix $(..), $(filter-out /%, $(config-sysdirs)))
-export full-config-sysdirs := $(full-config-sysdirs)
+export full-config-sysdirs := $(addprefix $(..),$(config-sysdirs))
# 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
endif
inst_zonedir = $(install_root)$(zonedir)
-# Where to install the locale and message catalog data files (which are
-# machine-independent).
+# Where to install the locale files.
ifndef localedir
-localedir = $(datadir)/locale
+localedir = $(libdir)/locale
endif
inst_localedir = $(install_root)$(localedir)
+# Where to install the message catalog data files (which are
+# machine-independent).
+ifndef msgcatdir
+msgcatdir = $(datadir)/locale
+endif
+inst_msgcatdir = $(install_root)$(msgcatdir)
+
# Where to install the locale charmap source files.
ifndef i18ndir
i18ndir = $(datadir)/i18n
# some additional bizarre files.
start-installed-name = crt1.o
endif
-
+# On systems that do not need a special startfile for statically linked
+# binaries, simply set it to the normal name.
+ifndef static-start-installed-name
+static-start-installed-name = $(start-installed-name)
+endif
# Command for linking programs with the C library.
ifndef +link
+link = $(CC) -nostdlib -nostartfiles -o $@ \
- $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) \
+ $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \
$(addprefix $(csu-objpfx),$(start-installed-name)) \
$(+preinit) $(+prector) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
ifndef +link-static
+link-static = $(CC) -nostdlib -nostartfiles -static -o $@ \
$(sysdep-LDFLAGS) $(LDFLAGS) \
- $(addprefix $(csu-objpfx),$(start-installed-name)) \
+ $(addprefix $(csu-objpfx),$(static-start-installed-name)) \
$(+preinit) $(+prector) \
$(filter-out $(addprefix $(csu-objpfx),start.o \
$(start-installed-name))\
link-libc = -Wl,-rpath-link=$(rpath-link) \
$(common-objpfx)libc.so$(libc.so-version) \
$(common-objpfx)$(patsubst %,$(libtype.oS),c) $(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
# This is how to find at build-time things that will be installed there.
-rpath-dirs = math elf nss nis db2 rt resolv
+rpath-dirs = math elf dlfcn nss nis rt resolv
rpath-link = \
$(common-objdir):$(subst $(empty) ,:,$(patsubst ../$(subdir),.,$(rpath-dirs:%=$(common-objpfx)%)))
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
-dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
else
-link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
+nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
+resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
+link-libc = $(common-objpfx)libc.a $(otherlibs) $(gnulib) $(common-objpfx)libc.a $(gnulib)
endif
endif
+# 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
+
ifndef link-extra-libs
ifeq (yes,$(build-shared))
ifneq ($(common-objpfx),$(objpfx))
else
ifeq (yes,$(build-shared))
# We can try to link the programs with lib*_pic.a...
-link-libc-static = $(link-libc) $(common-objpfx)libc_pic.a
+link-libc-static = $(gnulib) $(common-objpfx)libc_pic.a
link-extra-libs-static = $(link-extra-libs)
endif
endif
endif
# Extra flags to pass to GCC.
-+gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline -Wstrict-prototypes
++gccwarn := -Wall -Wwrite-strings -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,
# in the parent library source directory and in the include directory.
# `+sysdep-includes' will be defined by Makerules.
-+includes = -I. $(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
- -I$(..)include $($(stdio)-include) $(includes) \
++includes = -I$(..)include -I. \
+ $(patsubst %/,-I%,$(objpfx)) $(patsubst %/,-I%,$(..)) \
+ $($(stdio)-include) $(includes) \
$(+sysdep-includes) $(last-includes) $(sysincludes)
# Since libio has several internal header files, we use a -I instead
override CFLAGS = $(filter-out %frame-pointer,$(+cflags)) $(sysdep-CFLAGS) \
$(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) $(CFLAGS-$(@F))
-
-# This is the macro that the implicit linking rules use.
-ifneq "$(filter -g,$(+cflags))" "" # -g is in $(+cflags)
-LDFLAGS := -g
-endif
-
-
# If everything is compiled with -fPIC (implicitly) we must tell this by
# defining the PIC symbol.
ifeq (yes,$(build-pic-default))
move-if-change = $(SHELL) $(..)scripts/move-if-change
\f
+-include $(common-objpfx)sysd-dirs
+
+ifeq ($(sysd-dirs-done),t)
+-include $(common-objpfx)sysd-sorted
+subdirs = $(sorted-subdirs)
+endif
ifeq (yes, $(build-shared))
# Process the shlib-versions file, which tells us what shared library
# version numbers to use when we install shared objects on this system.
+# We need to wait until $(subdirs) is complete.
+ifeq ($(sysd-sorted-done),t)
-include $(common-objpfx)soversions.mk
ifndef avoid-generated
$(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \
$(wildcard $(patsubst %, $(..)%/shlib-versions,\
- $(add-ons))) \
+ $(add-ons) \
+ $(subdirs))) \
$(common-objpfx)config.make
(file="$(wildcard $(patsubst %,$(..)%/shlib-versions,$(add-ons))) \
+ $(wildcard $(patsubst %,$(..)%/shlib-versions,$(subdirs))) \
$(..)shlib-versions"; \
for f in $$file; do \
sed 's/#.*$$//' $$f | while read conf versions; do \
done;) > $@T; exit 0
mv -f $@T $@
endif
+endif
postclean-generated += soversions.mk
rpath-dirs += linuxthreads
endif
-ifndef avoid-generated
--include $(common-objpfx)sysd-dirs
-define \n
-
-
-endef
-sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
+ifeq ($(elf),yes)
+dlfcn = dlfcn
+ifeq ($(build-shared),yes)
+libdl = $(common-objpfx)dlfcn/libdl.so$(libdl.so-version)
+else
+libdl = $(common-objpfx)dlfcn/libdl.a
+endif
+else
+# No ELF - no libdl, at least for now.
+dlfcn =
+libdl =
endif
-# These are the subdirectories containing the library source.
-all-subdirs = csu assert ctype db2 locale intl catgets math setjmp signal \
+# These are the subdirectories containing the library source. The order
+# is more or less arbitrary. The sorting step will take care of the
+# dependencies. Only the $(binfmt-subdir) should always be kept at the
+# end of the list.
+all-subdirs = csu assert ctype locale intl catgets math setjmp signal \
stdlib stdio-common $(stdio) malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow md5-crypt po argp \
$(add-ons) nss localedata timezone rt debug $(sysdep-subdirs) \
- $(binfmt-subdir)
-subdirs = $(all-subdirs)
+ $(dlfcn) $(binfmt-subdir)
+all-subdirs := $(filter-out $(sysdep-inhibit-subdirs),$(all-subdirs))
# The mach and hurd subdirectories have many generated header files which
# much of the rest of the library depends on, so it is best to build them
subdirs := $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
$(filter-out mach hurd,$(subdirs))
-all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
+ifndef avoid-generated
+all-Subdirs-files = $(wildcard $(config-sysdirs:%=$(..)%/Subdirs))
$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
- (echo define sysdep-subdirs; \
- sed 's/#.*$$//' $(all-Subdirs-files) /dev/null; \
- echo endef; \
- echo 'sysd-dirs-done = t'; \
- ) > $@-tmp
+ $(AWK) 'BEGIN { subdirs = ""; inhibit = "" }; \
+ /^#/ { next }; \
+ /^[^-]/ { subdirs = subdirs " " $$0 }; \
+ /^-/ { inhibit = inhibit " " substr($$0, 2) }; \
+ END { printf "sysdep-subdirs =%s\n", subdirs; \
+ printf "sysdep-inhibit-subdirs =%s\n", inhibit; \
+ print "sysd-dirs-done = t" }' \
+ $(patsubst $<,/dev/null,$^) > $@-tmp
mv -f $@-tmp $@
+all-Depend-files = $(wildcard $(..)*/Depend)
+$(common-objpfx)sysd-sorted: $(..)scripts/gen-sorted.awk $(all-Depend-files) \
+ $(common-objpfx)sysd-dirs $(..)Makeconfig
+ { { dirs='$(patsubst $(..)%/Depend,$(..)%,$(filter %/Depend,$^))';\
+ for d in $$dirs; do \
+ while read on; do \
+ echo "depend $$d $$on"; \
+ done < $$d/Depend; \
+ done; \
+ for f in $(all-subdirs); do \
+ echo $$f; \
+ done; \
+ } | $(AWK) -f $< && \
+ echo sysd-sorted-done = t; \
+ } > $@-tmp
+ mv -f $@-tmp $@
+endif
+
endif # Makeconfig not yet included