This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

build overhaul [PATCH]



This is a major build overhaul.  It fixes the bugs with `make
subdirs=LIST' and `make install install_root=PATH'.  It *should* also
fix the problem with upgrading from 2.0 to 2.1 libc, but I have no way
of testing that.  (If you upgrade between dated snapshots and the
version number was not bumped, you may still lose.)  There's a minor
problem with the fix there: libdl is not built with extra-libs
anymore, and to keep it simple, I left out rules to write profile,
debug, bounded versions of that library.  I don't think these are
really necessary.

The changelog doesn't really explain what I've done -- briefly, I've
separated the code to iterate over subdirectories from the code to
build in each subdir.  This allows substantial reductions in the hair
index of Makerules, since it no longer has to worry about being
included at top level.  You'll notice that the top level is now a
"subdirectory" that gets recursed into.  This seemed cleaner than
putting that code into the driver Makefile.  The rules that create
things at top level have all been ripped out of Makerules/Makeconfig
and put into Makedriver or Make-top.  (Note that Make-top gets called
last, to create libc.a.  That's why all the stuff that's needed early
is in Makedriver.)

Building in the source directory might now work but I haven't tested
it.  make clean is broken; fixing it will require changes to subdir
Makefiles, and I thought this patch was too long already.  make dist
was completely rewritten and may not be quite right; Uli, please check
it.  I scrapped the doc-dist code in manual/Makefile since it was
bitrotted and I couldn't figure out what it was supposed to do.

Please, everyone who changed the top level makefiles since the 15th,
check to see that your patches didn't get lost.  I think I rolled
everything forward, but...

zw

* The patch is a shell script.  If you apply it directly it will still
work but some dead files won't get removed.

1998-05-30 15:28  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	Build overhaul.  Fixes several bugs: make subdirs=LIST,
	make install install_root=DIR, libc 2.0 -> 2.1 upgrading
	should all work now.  Make clean, build in source dir MAY work
	now but are not tested.
	Substantial hair reduction in top level Makefiles.

	* Makeconfig: Minor revisions. Move all rules in this file to...
	* Makedriver: ...here.  (New file; handles all subdir
	iteration and a few other tasks.)
	* Make-top: New file.  `Subdir' makefile for the top level.
	* Makerules: Substantial revisions.
	* Rules: Minor revisions.
	* Makefile.in: Completely rewritten.
	* Make-dist: Removed.
	* MakeTAGS: Removed.
	* Makefile: Removed.

	* csu/Makefile: Adjust to work with restructured top level
	makefiles.

	* elf/Makefile: Restructure such that libdl and the dynamic
	linker are not installed here.  It's done in Make-top instead,
	atomically with libc.
	* manual/Makefile: Completely rewritten.
	* manual/chapters.awk: New file.

	* scripts/unT.c: New file, supports atomic installation of
	libc.so, ld.so, libdl.so.
	* scripts/tarprefix.c: New file, used in make release/snapshot.
	* scripts/fixpatch: New file, used in make release/snapshot.
	* scripts/subdir-dist: New file, used in make dist.

	* config.make.in: Add XGETTEXT to be substituted.
	* configure.in: Correct regexp to find gettext version.
	Call AC_CHECK_TOOL for xgettext.  Correct warning about old
	version of binutils. Always generate Makefile.

	* math/Makefile: Distribute everything that should be.
	* sysdeps/generic/Dist: Likewise.
	* sysdeps/unix/sysv/linux/Dist: Likewise.
	* sysdeps/gnu/Dist: Likewise.

	* timezone/Makefile: Revert Andreas S.'s change of 1998-05-20,
	as there is no longer an avoid-generated variable.
	* sysdeps/unix/Makefile: Delete stale code.  Don't create
	sysd-syscalls if no_deps.
	* mach/Machrules: Don't generate .udeps files if no_deps.
	* README.template: Correct reference to COPYING.

#! /bin/sh

[ -f Makerules ] || exit 1

rm -f Make-dist
rm -f MakeTAGS
rm -f Makefile
rm -f manual/chapters-incl1
rm -f manual/chapters-incl2

patch -p0 <<'!END!OF!PATCH!'
============================================================
Index: README.template
--- README.template	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ README.template	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -90,5 +90,5 @@
 you can still send bug reports to <bug-glibc@gnu.org> as normal electronic
 mails.
 
-The GNU C Library is free software.  See the file COPYING.LIB for copying
+The GNU C Library is free software.  See the file COPYING for copying
 conditions.
============================================================
Index: Makeconfig
--- Makeconfig	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ Makeconfig	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -19,11 +19,6 @@
 #
 #	Makefile configuration options for the GNU C library.
 #
-ifneq (,)
-This makefile requires GNU Make.
-endif
-
-all: # Make this the default goal
 
 ifneq "$(origin +included-Makeconfig)" "file"
 
@@ -31,31 +26,7 @@
 
 ifdef subdir
 .. := ../
-endif
-
-# If config.make exists, the source directory was configured,
-# so don't try to be clever and find another directory to build in.
-ifneq (,$(wildcard $(..)config.make))
-ARCH =
-machine =
-else	# Not configured.
-ifndef ARCH
-ifdef machine
-ARCH = $(machine)
-endif # machine
-endif # ARCH
-endif # config.make
-
-# Directory for object files and libc.a.  If this is not defined, the
-# object files live in the subdirectories where their sources live, and
-# libc.a lives in the parent directory (this probably doesn't work any
-# more).
-ifdef ARCH
-ifeq ($(filter /%,$(ARCH)),)
-objdir := $(..)$(ARCH)
-else
-objdir = $(ARCH)
-endif
+export subdir
 endif
 
 # $(common-objdir) is the place to put objects and
@@ -97,30 +68,6 @@
 		       $(addprefix $(..), $(filter-out /%, $(config-sysdirs)))
 export full-config-sysdirs := $(full-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
-# 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 \
-			     $(..)config.make.in $(..)config.h.in
-	cd $(<D); $(SHELL) $(<F)
-
-# Find all the sysdeps configure fragments, to make sure we re-run
-# configure when any of them changes.
-$(common-objpfx)config.status: $(..)version.h $(..)configure \
-			       $(foreach dir,$(full-config-sysdirs),\
-					 $(wildcard \
-					   $(dir)/Implies) \
-					 $(patsubst %.in,%,\
-						    $(firstword $(wildcard \
- $(addprefix $(dir)/,configure configure.in)))))
-	@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
-
 # We don't want CPPFLAGS to be exported to the command running configure.
 unexport CPPFLAGS
 
@@ -513,22 +460,21 @@
 +force =
 endif
 
+# How to find some scripts used in subdirs.
+move-if-change = $(SHELL) $(..)scripts/move-if-change
+mkinstalldirs  = $(SHELL) $(..)scripts/mkinstalldirs
+
+# Make the target directory if it doesn't exist, using the `mkinstalldirs'
+# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
+define make-target-directory
+$(addprefix $(..)./scripts/mkinstalldirs ,\
+	    $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
+endef
+
 ####
 #### End of configuration variables.
 ####
 
-# This tells some versions of GNU make before 3.63 not to export all variables.
-.NOEXPORT:
-
-# We want to echo the commands we're running without
-# umpteen 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.
@@ -646,81 +592,10 @@
 CFLAGS-.oS = $(CFLAGS-.o) $(pic-ccflag)
 CPPFLAGS-.oS = $(CPPFLAGS-.o) -DPIC
 libtype.oS = lib%_nonshared.a
-endif
-
-
-+gnu-stabs = $(shell echo>&2 '*** BARF ON ME')
-
-ifndef BUILD_CC
-BUILD_CC = $(CC)
-endif
-
-move-if-change = $(SHELL) $(..)scripts/move-if-change
-
-
-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.
 -include $(common-objpfx)soversions.mk
-ifndef avoid-generated
-$(common-objpfx)soversions.mk: $(..)shlib-versions $(..)Makeconfig \
-			       $(wildcard $(patsubst %, $(..)%/shlib-versions,\
-							$(add-ons))) \
-			       $(common-objpfx)config.make
-	(file="$(wildcard $(patsubst %,$(..)%/shlib-versions,$(add-ons))) \
-	       $(..)shlib-versions"; \
-	 for f in $$file; do \
-	   sed 's/#.*$$//' $$f | while read conf versions; do \
-	     test -n "$$versions" && \
-	     test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
-			: "$$conf"` != 0 || continue; \
-	     for v in $$versions; do \
-	       lib=`echo $$v | sed 's/=.*$$//'`; \
-	       if eval "test -z \"\$$vers_lib$$lib\""; then \
-		 eval vers_lib$${lib}=yes; \
-		 number=`echo $$v | sed "s/^.*=//"`; \
-		 case $$number in \
-		   [0-9]*) echo "$$lib.so-version=.$$number"; \
-			   echo "all-sonames+=$$lib.so\$$($$lib.so-version)";;\
-		   *) echo "$$lib.so-version=$$number"; \
-		      echo "all-sonames+=\$$($$lib.so-version)";;  \
-	         esac; \
-	       fi; \
-	     done; \
-	   done; \
-	 done;) > $@T; exit 0
-	mv -f $@T $@
-endif
-
-postclean-generated += soversions.mk
-
-# Generate the header containing the names of all shared libraries.
-# We use a stamp file to avoid uncessary recompilations.
-before-compile += $(common-objpfx)gnu/lib-names.h
-$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
-$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
-	$(make-target-directory)
-	@rm -f ${@:stmp=T} $@
-	(echo '/* This file is automatically generated.';\
-	 echo '   It defines macros to allow user program to find the shared';\
-	 echo '   library files which come as part of GNU libc.  */';\
-	 echo '#ifndef __GNU_LIB_NAMES_H'; \
-	 echo '#define __GNU_LIB_NAMES_H	1'; \
-	 echo; \
-	 (libs='$(all-sonames)';\
-	  for l in $$libs; do \
-	    upname=`echo $$l | sed 's/[.]so.*//' | \
-		    tr 'abcdefghijklmnopqrstuvwxyz-' \
-		       'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
-	    echo "#define	$${upname}_SO	\"$$l\""; \
-	  done;) | sort; \
-	 echo; \
-	 echo '#endif	/* gnu/lib-names.h */';) > ${@:stmp=T}
-	$(move-if-change) ${@:stmp=T} ${@:stmp=h}
-	touch $@
-
-common-generated += gnu/lib-names.h gnu/lib-names.stmp
 
 # The name under which the run-time dynamic linker is installed.
 # We are currently going for the convention that `/lib/ld.so.1'
@@ -746,21 +621,27 @@
 rpath-dirs += linuxthreads
 endif
 
-ifndef avoid-generated
 -include $(common-objpfx)sysd-dirs
+postclean-generated += sysd-dirs
 define \n
 
 
 endef
 sysdep-subdirs := $(subst $(\n), ,$(sysdep-subdirs))
-endif
 
 # These are the subdirectories containing the library source.
-subdirs = csu assert ctype db2 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 $(sysdep-subdirs) $(binfmt-subdir)
+config-subdirs = csu assert ctype db2 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 $(sysdep-subdirs)		\
+		 $(binfmt-subdir)
+
+# Allow user to override this list in some places (subdir iteration).
+ifndef subdirs
+subdirs := $(config-subdirs)
+endif
 
 # 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
@@ -771,11 +652,49 @@
 subdirs	:= $(filter mach,$(subdirs)) $(filter hurd,$(subdirs)) \
 	   $(filter-out mach hurd,$(subdirs))
 
-all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
-$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
-	(echo define sysdep-subdirs;				\
-	 sed 's/#.*$$//' $(all-Subdirs-files) /dev/null;	\
-	 echo endef) > $@-tmp
-	mv -f $@-tmp $@
+# These lists are used by `make dist' and a few others.
+all-subdirs =	aout argp assert bare catgets csu ctype db db2 dirent	\
+		elf gmon gnulib grp hesiod iconv iconvdata inet intl	\
+		io libio locale localedata login malloc manual math	\
+		md5-crypt misc nis nscd nss po posix pwd resolv		\
+		resource rt setjmp shadow signal socket stdio		\
+		stdio-common stdlib streams string sunrpc sysvipc	\
+		termios time timezone wcsmbs wctype hurd mach		\
+
+all-sysdep-dirs = $(addprefix sysdeps/, \
+	alpha alpha/alphaev5 alpha/elf alpha/fpu am29k arm arm/elf	\
+	arm/fpu generic gnu hppa hppa/hppa1.1 i370 i386 i386/elf	\
+	i386/fpu i386/i486 i386/i586 i386/i686 i860 i960 ieee754	\
+	libm-i387 libm-i387/i686 libm-ieee754 m68k m68k/elf m68k/fpu	\
+	m68k/fpu/switch m68k/m68020 m88k m88k/m88100 m88k/m88110 mach	\
+	mach/alpha mach/hppa mach/hurd mach/hurd/alpha mach/hurd/hppa	\
+	mach/hurd/i386 mach/hurd/mips mach/i386 mach/mips mach/powerpc	\
+	mips mips/dec mips/elf mips/mips3 mips/mips64 mips/mipsel	\
+	mips/p40 mvs posix powerpc powerpc/elf rs6000 sparc sparc/fpu	\
+	sparc/sparc32 sparc/sparc32/elf sparc/sparc32/fpu		\
+	sparc/sparc32/sparcv8 sparc/sparc64 sparc/sparc64/elf		\
+	sparc/sparc64/fpu standalone standalone/arm standalone/i386	\
+	standalone/i386/force_cpu386 standalone/i960			\
+	standalone/i960/nindy960 standalone/m68k			\
+	standalone/m68k/m68020 standalone/m68k/m68020/mvme135		\
+	standalone/m68k/m68020/mvme136 tahoe unix unix/alpha unix/arm	\
+	unix/bsd unix/bsd/bsd4.4 unix/bsd/hp unix/bsd/hp/m68k		\
+	unix/bsd/i386 unix/bsd/m68k unix/bsd/osf unix/bsd/osf/alpha	\
+	unix/bsd/sequent unix/bsd/sequent/i386 unix/bsd/sony		\
+	unix/bsd/sony/newsos unix/bsd/sony/newsos/m68k			\
+	unix/bsd/sony/newsos4 unix/bsd/sun unix/bsd/sun/m68k		\
+	unix/bsd/sun/sparc unix/bsd/sun/sunos4 unix/bsd/tahoe		\
+	unix/bsd/ultrix4 unix/bsd/ultrix4/mips unix/bsd/vax		\
+	unix/common unix/i386 unix/inet unix/mips unix/mman unix/sparc	\
+	unix/sysv unix/sysv/i386 unix/sysv/irix4 unix/sysv/isc2.2	\
+	unix/sysv/linux unix/sysv/linux/alpha unix/sysv/linux/arm	\
+	unix/sysv/linux/i386 unix/sysv/linux/i386/i686			\
+	unix/sysv/linux/m68k unix/sysv/linux/mips unix/sysv/linux/nfs	\
+	unix/sysv/linux/powerpc unix/sysv/linux/scsi			\
+	unix/sysv/linux/sparc unix/sysv/linux/sparc/sparc32		\
+	unix/sysv/linux/sparc/sparc64 unix/sysv/minix unix/sysv/sco3.2	\
+	unix/sysv/sco3.2.4 unix/sysv/sysv4 unix/sysv/sysv4/i386		\
+	unix/sysv/sysv4/solaris2 unix/sysv/sysv4/solaris2/sparc vax	\
+	wordsize-32 wordsize-64 z8000)
 
 endif # Makeconfig not yet included
============================================================
Index: Makefile.in
--- Makefile.in	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ Makefile.in	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -10,5 +10,56 @@
 # program (not the command), like -z9 or -x.
 # CVSOPTS = -z9
 
-all .DEFAULT:
-	$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" CVSOPTS="$(CVSOPTS)" -C $(srcdir) objdir=`pwd` $@
+ifneq (,)
+You must use GNU Make to build the GNU C library.
+endif
+
+oPATH := $(PATH)
+PATH := this definition should take precedence over $(oPATH)
+ifeq ($(PATH),$(oPATH))
+.DEFAULT error:
+	@echo You must not use the -e flag when building the GNU C library.;\
+	exit 1
+else
+PATH := $(oPATH)
+endif
+
+MAKEARGS :=	-r PARALLELMFLAGS="$(PARALLELMFLAGS)" CVSOPTS="$(CVSOPTS)" \
+		objdir=`pwd`
+
+# Valid targets.
+build-targets 	 = all lib others install check tests #install-strip
+nonbuild-targets = dist snapshot release TAGS tidy
+clean-targets    = clean distclean mostly-clean _mclean _mcleanwarn
+doc-targets	 = info dvi ps
+
+all: # Default goal.
+
+$(build-targets):
+	$(MAKE) $(MAKEARGS) -C $(srcdir) -f Makedriver $@
+$(nonbuild-targets):
+	$(MAKE) $(MAKEARGS) -C $(srcdir) -f Makedriver $@ no_deps=t
+
+$(doc-targets):
+	$(MAKE) $(MAKEARGS) -C $(srcdir)/manual $@
+
+maintainer-clean: _mcleanwarn _mclean
+
+_mcleanwarn:
+	@echo '*** WARNING: make maintainer-clean deletes files which'; \
+	 echo '*** may require special tools to rebuild. Type ^C to cancel'; \
+	 sleep 5
+
+# Cleanout targets need special handling.
+make-clean = $(MAKE) $(MAKEARGS) -C $(srcdir) -f Makedriver clean 
+mostly-clean:
+	$(make-clean) clean-obj=t				no_deps=t
+clean:
+	$(make-clean) clean-obj=t clean-gen=t			no_deps=t
+distclean:
+	$(make-clean) clean-obj=t clean-gen=t clean-cfg=t	no_deps=t
+_mclean:
+	$(make-clean) clean-obj=t clean-gen=t clean-cfg=t clean-src=t	no_deps=t
+
+.PHONY: $(build-targets) $(nonbuild-targets) $(clean-targets) $(doc-targets)
+.SUFFIXES: # none
============================================================
Index: Makerules
--- Makerules	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ Makerules	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -18,40 +18,9 @@
 
 #
 #	Common rules for making the GNU C library.  This file is included
-#	by the top-level Makefile and by all subdirectory makefiles
-#	(through Rules).
+#	by all subdirectory makefiles (through Rules).
 #
-ifneq (,)
-This makefile requires GNU Make.
-endif
-
-REQUIRED_MAKE_VERSION = 3.74
-REAL_MAKE_VERSION = $(firstword $(MAKE_VERSION))
-
-ifneq ($(REQUIRED_MAKE_VERSION), \
-       $(firstword $(sort $(REAL_MAKE_VERSION) $(REQUIRED_MAKE_VERSION))))
-Wrong GNU Make version.  See above for the version needed.
-endif
-
 
-ifdef	subdir
-..	:= ../
-endif	# subdir
-
-# If `sources' was defined by the parent makefile, undefine it so
-# we will later get it from wildcard search in this directory.
-ifneq	"$(findstring env,$(origin sources))" ""
-sources :=
-endif
-
-oPATH := $(PATH)
-PATH := this definition should take precedence over $(oPATH)
-ifeq ($(PATH),$(oPATH))
-You must not use the -e flag when building the GNU C library.
-else
-PATH := $(oPATH)
-endif
-
 ifndef +included-Makeconfig
 include $(..)Makeconfig
 endif
@@ -59,8 +28,6 @@
 # `configure' writes a definition of `config-sysdirs' in `config.make'.
 sysdirs = $(strip $(full-config-sysdirs))
 
-+sysdir_pfx = $(common-objpfx)
-
 export sysdirs := $(sysdirs)
 
 +sysdep_dirs := $(full-config-sysdirs)
@@ -92,41 +59,17 @@
 
 # Some sysdep makefiles use this to distinguish being included here from
 # being included individually by a subdir makefile (hurd/Makefile needs this).
+# XXX zw: stale code?
 in-Makerules := yes
 
--include $(+sysdir_pfx)sysd-Makefile
-ifndef avoid-generated
-ifneq ($(sysd-Makefile-sysdirs),$(config-sysdirs))
-sysd-Makefile-force = FORCE
-FORCE:
-endif
-$(+sysdir_pfx)sysd-Makefile: $(+sysdir_pfx)config.make $(..)Makerules \
-			     $(sysd-Makefile-force)
-	-@rm -f $@T
-	(echo 'sysd-Makefile-sysdirs := $(config-sysdirs)';		      \
-	 for dir in $(config-sysdirs); do	   			      \
-	   file=$$dir/Makefile;						      \
-	   case $$dir in						      \
-	     /*) rel= ;;						      \
-	     *)  rel=$(..) ;;						      \
-	   esac;							      \
-	   if [ -f $$rel$$file ]; then					      \
-	     case $$dir in						      \
-	       /*) echo include "$$file" ;;				      \
-	       *)  echo include "\$$(..)$$file" ;;			      \
-	     esac;							      \
-	   else true; fi;						      \
-	 done;								      \
-	 echo 'sysd-Makefile-done=t') > $@T
-	mv -f $@T $@
-endif
+# This pulls in all the sysdep makefiles.
+-include $(common-objpfx)sysd-Makefile
 
 ifndef sysd-Makefile-done
 # Don't do deps until this exists, because it might change the sources list.
 no_deps=t
 endif
 
-
 # Reorder before-compile so that mach things come first, and hurd things
 # second, before all else.  The mach and hurd subdirectories have many
 # generated header files which the much of rest of the library depends on,
@@ -230,85 +173,31 @@
 # included.  It might define inhibit-sysdep-asm, which would affect the
 # contents of sysd-rules.
 ifdef sysd-Makefile-done
--include $(+sysdir_pfx)sysd-rules
-ifneq ($(sysd-rules-sysdirs),$(config-sysdirs))
-# The value of $(+sysdep_dirs) the sysd-rules was computed for
-# differs from the one we are using now.  So force a rebuild of sysd-rules.
-sysd-rules-force = FORCE
-FORCE:
-endif
-endif
-$(+sysdir_pfx)sysd-rules: $(+sysdir_pfx)config.make $(..)Makerules \
-			  $(wildcard $(foreach dir,$(sysdirs),\
-					       $(dir)/Makefile))\
-			  $(sysd-rules-force)
-	-@rm -f $@T
-	(echo 'sysd-rules-sysdirs := $(config-sysdirs)';		      \
-	 for sysdir in $(config-sysdirs); do				      \
-	   case $$sysdir in \
-	     /*) dir=$$sysdir ;; \
-	     *)  dir="\$$(..)$$sysdir" ;; \
-	   esac; \
-	   for o in $(all-object-suffixes); do \
-	     $(open-check-inhibit-asm) \
-	     echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile); \
-		  \$$(compile-command.S)";				      \
-	     echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile); \
-		  \$$(compile-command.s)";				      \
-	     $(close-check-inhibit-asm)	\
-	     echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile); \
-		  \$$(compile-command.c)";				      \
-	   done; \
-	   $(open-check-inhibit-asm) \
-	   echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d; \
-		\$$(make-dummy-dep)";			       \
-	   echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile); \
-		\$$(+make-deps)";					      \
-	   $(close-check-inhibit-asm)	\
-	   echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile); \
-		\$$(+make-deps)";					      \
-	 done;								      \
-	 echo 'sysd-rules-done = t') > $@T
-	mv -f $@T $@
+-include $(common-objpfx)sysd-rules
+endif
 
 ifndef sysd-rules-done
 # Don't do deps until this exists, because it provides rules to make the deps.
 no_deps=t
 endif
 
-
-ifndef compile-command.S
-compile-command.S = $(compile.S) $(OUTPUT_OPTION)
-endif
-ifndef compile-command.s
-compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION)
-endif
-ifndef compile-command.c
-compile-command.c = $(compile.c) $(OUTPUT_OPTION)
-endif
-
-# GCC can grok options after the file name, and it looks nicer that way.
-compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
-compile.S = \
-  $(CC) $< -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.S = \
-  $(CC) -c $(CPPFLAGS) -DASSEMBLER $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
-COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
-
-# We need this for the output to go in the right place.  It will default to
-# empty if make was configured to work with a cc that can't grok -c and -o
-# together.  You can't compile the C library with such a compiler.
-OUTPUT_OPTION = -o $@
+compile.c = $(CC) -c $< $(CFLAGS) $(CPPFLAGS)
+compile.S = $(CC) -c $< $(CPPFLAGS) $(asm-CPPFLAGS) $(ASFLAGS-$(suffix $@))
+compile.s = $(CC) -c $< $(ASFLAGS-$(suffix $@))
+
+compile-command.c = $(compile.c) -o $@
+compile-command.S = $(compile.S) -o $@
+compile-command.s = $(compile.s) -o $@
 
 S-CPPFLAGS = $(asm-CPPFLAGS)
 define +make-deps
 $(make-target-directory)
--@rm -f $@
-$(+mkdep) $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
-sed \
--e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,' \
-$(sed-remove-objpfx) > $(@:.d=.T)
-mv -f $(@:.d=.T) $@
+ $(+mkdep) $< $(CFLAGS) $(CPPFLAGS) $($(<:$*.%=%)-CPPFLAGS) | \
+ sed \
+ -e 's,$(subst .,\.,$*)\.o,$(foreach o,$(all-object-suffixes),$(@:.d=$o)) $@,'\
+ -e 's, [./a-z0-9_-]*$(subst .,\.,$*)\.[cS],,' \
+ $(sed-remove-objpfx) > $(@:.d=.T)
+ mv -f $(@:.d=.T) $@
 endef
 ifneq (,$(objpfx))
 # Continuation lines here are dangerous because they introduce spaces!
@@ -331,8 +220,6 @@
 endif
 
 # Pattern rule to build a shared object from an archive of PIC objects.
-# This must come after the installation rules so Make doesn't try to
-# build shared libraries in place from the installed *_pic.a files.
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
 # on other shared objects.
 lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
@@ -364,37 +251,8 @@
 elide-routines.op += $(shared-only-routines)
 elide-routines.og += $(shared-only-routines)
 elide-routines.ob += $(shared-only-routines)
-
-# Don't try to use -lc when making libc.so itself.
-# Also omits crti.o and crtn.o, which we do not want
-# since we define our own `.init' section specially.
-LDFLAGS-c.so = -nostdlib -nostartfiles
-# But we still want to link libc.so against $(gnulib).
-LDLIBS-c.so = $(gnulib)
-# Give libc.so an entry point and make it directly runnable itself.
-LDFLAGS-c.so += -e __libc_main
-# Pre-link the objects of libc_pic.a so that we can locally resolve
-# COMMON symbols before we link against ld.so.  This is because ld.so
-# contains some of libc_pic.a already, which will prevent the COMMONs
-# from being allocated in libc.so, which introduces evil dependencies
-# between libc.so and ld.so, which can make it impossible to upgrade.
-$(common-objpfx)libc_pic.os: $(common-objpfx)libc_pic.a
-	$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
-	-Wl,-d -Wl,--whole-archive $^
-# Use our own special initializer and finalizer files for libc.so.
-$(common-objpfx)libc.so: $(elfobjdir)/soinit.os \
-			 $(common-objpfx)libc_pic.os \
-			 $(elfobjdir)/sofini.os \
-			 $(elfobjdir)/interp.os $(elfobjdir)/ld.so \
-			 $(..)libc.map
-	$(build-shlib)
-common-generated += libc.so libc_pic.os
-ifdef libc.so-version
-$(common-objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
-	$(make-link)
-common-generated += libc.so$(libc.so-version)
-endif
 endif
+
 
 # Figure out the source filenames in this directory.
 
@@ -437,36 +295,24 @@
 endif
 
 # Maximize efficiency by minimizing the number of rules.
-.SUFFIXES:	# Clear the suffix list.  We don't use suffix rules.
+# Clear the suffix list.  We don't use suffix rules.
+SUFFIXES :=
+.SUFFIXES:
 # Don't define any builtin rules.
 MAKEFLAGS := $(MAKEFLAGS)r
 
-# Generic rule for making directories.
-%/:
-# mkdir isn't smart enough to strip a trailing /.
-	mkdir $(@:%/=%)
-
-# Make sure that object files are not removed
-# when they are intermediates between sources and library members.
-.PRECIOUS: $(addprefix $(objpfx)%,$(all-object-suffixes))
-
-# Make sure that the parent library archive is never removed.
-.PRECIOUS: $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
-
 # Use the verbose option of ar and tar when not running silently.
 ifeq	"$(findstring s,$(MAKEFLAGS))" ""	# if not -s
-verbose := v
-else	   					# -s
-verbose	:=
-endif						# not -s
+ARFLAGS := cruv
+else
+ARFLAGS := cru
+endif
 
-ARFLAGS := r$(verbose)
-CREATE_ARFLAGS := cru$(verbose)
 
 # This makes all the object files in the parent library archive.
 
 .PHONY: lib lib-noranlib
-lib: lib-noranlib $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
+lib: lib-noranlib
 lib-noranlib: libobjs
 
 # For object-suffix $o, the list of objects with that suffix.
@@ -502,26 +348,6 @@
 
 endif
 
-# Now define explicit rules to build the library archives; these depend
-# on the stamp files built above.
-define o-iterator-doit
-$(common-objpfx)$(patsubst %,$(libtype$o),c): \
-		$(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
-endef
-define do-makelib
-cd $(common-objdir) && \
-$(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
-$(RANLIB) $@
-endef
-subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
-subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
-ifndef subdir
-$(subdirs-stamps): subdir_lib;
-endif
-object-suffixes-left = $(object-suffixes-for-libc)
-include $(o-iterator)
-
-
 # This makes all the object files.
 .PHONY: objects objs libobjs extra-objs
 objects objs: libobjs extra-objs
@@ -531,7 +357,7 @@
 # Canned sequence for building an extra library archive.
 define build-extra-lib
 $(patsubst %/,cd % &&,$(objpfx)) \
-$(AR) $(CREATE_ARFLAGS) $(@:$(objpfx)%=%) \
+$(AR) $(ARFLAGS) $(@:$(objpfx)%=%) \
       $(patsubst $(objpfx)%,%,$^)
 $(RANLIB) $@
 endef
@@ -550,37 +376,11 @@
 # $(install-others) are absolute path names of files to install; rules to
 # install them are defined elsewhere.
 
-# The simple library name to install libc.a under.
-# This could be defined by a sysdep Makefile.
-ifndef libc-name
-libc-name := c
-endif
-
 define do-install
 $(make-target-directory)
 $(INSTALL_DATA) $< $@
 endef
 
-# Make the target directory if it doesn't exist, using the `mkinstalldirs'
-# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
-define make-target-directory
-$(addprefix $(..)./scripts/mkinstalldirs ,\
-	    $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
-endef
-
-# Any directory (parent or subdir) should install libc.a; this way
-# "make install" in a subdir is guaranteed to install everything it changes.
-installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
-			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
-						     $(libprefix)$(libc-name)))
-install: $(installed-libcs)
-$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
-	$(make-target-directory)
-	$(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
-# Running ranlib after installing makes the __.SYMDEF time stamp up to
-# date, which avoids messages from some linkers.
-	$(RANLIB) $@
-
 define do-install-program
 $(make-target-directory)
 $(INSTALL_PROGRAM) $< $@.new
@@ -591,7 +391,7 @@
 install-lib := $(filter-out %.so %_pic.a,$(install-lib))
 ifeq (yes,$(build-shared))
 
-install-lib-nosubdir: $(install-lib.so:%=$(inst_libdir)/%)
+install-lib: $(install-lib.so:%=$(inst_libdir)/%)
 
 # Find which .so's have versions.
 versioned := $(strip $(foreach so,$(install-lib.so),\
@@ -630,45 +430,6 @@
 endef
 endif
 
-ifdef libc.so-version
-# For a library specified to be version N, install three files:
-# libc.so	->	libc.so.N	(e.g. libc.so.6)
-# libc.so.6	->	libc-VERSION.so	(e.g. libc-1.10.so)
-
-$(inst_slibdir)/libc.so$(libc.so-version): $(inst_slibdir)/libc-$(version).so \
-					   $(+force)
-	$(make-shlib-link)
-$(inst_slibdir)/libc-$(version).so: $(common-objpfx)libc.so $(+force)
-	$(do-install-program)
-install: $(inst_slibdir)/libc.so$(libc.so-version)
-
-ifndef subdir
-# What we install as libc.so for programs to link against is in fact a
-# link script.  It contains references for the various libraries we need.
-# The libc.so object is not complete since some functions are only defined
-# in libc_nonshared.a.
-install: $(inst_libdir)/libc.so
-$(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
-			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
-						  $(libprefix)$(libc-name)) \
-			$(+force)
-	(echo '/* GNU ld script';\
-	 echo '   Use the shared library, but some functions are only in';\
-	 echo '   the static library, so try that secondarily.  */';\
-	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
-	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
-	      ')' \
-	) > $@.new
-	mv -f $@.new $@
-
-endif
-
-else
-install: $(inst_slibdir)/libc.so
-$(inst_slibdir)/libc.so: $(common-objpfx)libc.so $(+force)
-	$(do-install-program)
-endif
-
 ifneq (,$(versioned))
 # Produce three sets of rules as above for all the smaller versioned libraries.
 
@@ -777,36 +538,26 @@
 	$(do-install)
 endif	# headers
 
-.PHONY: install-bin-nosubdir install-rootsbin-nosubdir install-sbin-nosubdir \
-	install-lib-nosubdir install-data-nosubdir install-headers-nosubdir
-install-bin-nosubdir: $(addprefix $(inst_bindir)/,$(install-bin))
-install-rootsbin-nosubdir: \
-	$(addprefix $(inst_rootsbindir)/,$(install-rootsbin))
-install-sbin-nosubdir: $(addprefix $(inst_sbindir)/,$(install-sbin))
-install-lib-nosubdir: $(addprefix $(inst_libdir)/,\
+.PHONY: install-bin install-rootsbin install-sbin \
+	install-lib install-data install-headers
+install-bin: $(addprefix $(inst_bindir)/,$(install-bin))
+install-rootsbin: $(addprefix $(inst_rootsbindir)/,$(install-rootsbin))
+install-sbin: $(addprefix $(inst_sbindir)/,$(install-sbin))
+install-lib: $(addprefix $(inst_libdir)/,\
 		       $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
 		       $(addprefix $(libprefix),$(install-lib-non.a)))
-install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
-install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
-install-others-nosubdir: $(install-others)
-
-# We need all the `-nosubdir' targets so that `install' in the parent
-# doesn't depend on several things which each iterate over the subdirs.
-# This rule makes `install-FOO' always use `install-FOO-nosubdir' as a
-# subroutine.  Then in the parent `install-FOO' also causes subdir makes.
-install-%:: install-%-nosubdir ;
+install-data: $(addprefix $(inst_datadir)/,$(install-data))
+install-headers: $(addprefix $(inst_includedir)/,$(headers))
+install-others: $(install-others)
 
-.PHONY: install install-no-libc.a-nosubdir
+.PHONY: install
 ifeq ($(build-programs),yes)
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
-			    install-bin-nosubdir install-lib-nosubdir	\
-			    install-others-nosubdir install-rootsbin-nosubdir \
-			    install-sbin-nosubdir
+install: install-headers install-data install-bin install-lib \
+	 install-others install-rootsbin install-sbin
 else
-install-no-libc.a-nosubdir: install-headers-nosubdir install-data-nosubdir\
-			    install-lib-nosubdir install-others-nosubdir
+install: install-headers install-data install-lib install-others
 endif
-install: install-no-libc.a-nosubdir
+
 
 # Command to compile $< in $(objdir) using the native libraries.
 define native-compile
@@ -828,32 +579,28 @@
 # Note that this is only used for commands running in $(objpfx).
 ALL_BUILD_CFLAGS = $(BUILD_CFLAGS) -include $(..)config.h
 
-# Support the GNU standard name for this target.
-.PHONY: check
-check: tests
-
+# This is different for subdirs and the parent.
 .PHONY: TAGS
-TAGS: $(objpfx)distinfo $(..)MakeTAGS
-	$(MAKE) $(addprefix -f ,$^) $@
-
-$(..)po/%.pot: $(objpfx)distinfo $(..)MakeTAGS FORCE
-	$(MAKE) $(addprefix -f ,$(filter-out FORCE,$^)) $@
-FORCE:
-
-
-.PHONY: echo-headers
-echo-headers:
-	@echo $(headers)
+ifdef subdir
+TAGS: $(objpfx)dir-dist
+	cut -c4- $< | sort -u | grep '\.[csSh]$$' | \
+		sed -e '/^$(subdir)/!s/^/..\//' \
+		    -e 's/^$(subdir)\///' | \
+		$(ETAGS) -o $@ -
+else
+TAGS: $(objpfx)dir-dist
+	cut -c4- $< | sort -u | grep '\.[csSh]$$' | \
+		$(ETAGS) $(all-subdirs:%=-i %/TAGS) -o $@ -
+endif
 
 
 # Common cleaning targets.
 
-.PHONY: common-mostlyclean common-clean mostlyclean clean
-clean: common-clean
-mostlyclean: common-mostlyclean
+.PHONY: clean
 
 # Remove the object files.
-common-mostlyclean:
+clean:
+ifdef clean-obj
 	-rm -f $(addprefix $(objpfx),$(tests) $(test-srcs) $(others) \
 				     $(sysdep-others) $(tests-static) stubs \
 				     $(addsuffix .o,$(tests) $(test-srcs) \
@@ -866,73 +613,64 @@
 				     $(install-lib.so) \
 				     $(install-lib.so:%.so=%_pic.a))
 	-rm -f core
-	$(rmobjs)
-define rmobjs
-$(foreach o,$(object-suffixes-for-libc),
--rm -f $(objpfx)stamp$o $(o-objects))
-endef
-
-# Also remove the dependencies and generated source files.
-common-clean: common-mostlyclean
+	$(foreach o,$(object-suffixes-for-libc), \
+		-rm -f $(objpfx)stamp$o $(o-objects))
+	-rm -f  $(addprefix $(objpfx), $(mostlyclean)) \
+		$(addprefix $(common-objpfx), $(common-mostlyclean))
+endif
+ifdef clean-gen
 	-rm -f $(addprefix $(objpfx),$(generated)) $(+depfiles)
 	-rm -fr $(addprefix $(objpfx),$(generated-dirs))
 	-rm -f $(addprefix $(common-objpfx),$(common-generated))
-	-rm -f $(objpfx)distinfo
+	-rm -f $(objpfx)dir-dist
+endif
+ifdef clean-cfg
+	-rm -f $(addprefix $(objpfx),$(config-generated))
+ifdef objpfx
+	-rmdir $(objpfx)  # Nonempty dir is a bug, catch this.
+endif
+endif
+ifdef clean-src
+	-rm -f $(source-generated)
+endif
+
 
 # Produce a file `stubs' which contains `#define __stub_FUNCTION'
 # for each function which is a stub.  We grovel over all the .d files
 # looking for references to <stub-tag.h>.  Then we grovel over each
 # referenced source file to see what stub function it defines.
 
-ifdef objpfx
-.PHONY: stubs # The parent Makefile calls this target.
-stubs: $(objpfx)stubs
-endif
+others: $(objpfx)stubs
 s = $(sysdep_dir)/generic
+u = $$(common-objpfx)$(subdir)
 $(objpfx)stubs: $(+depfiles)
 # Use /dev/null since `...` might expand to empty.
 	(s=`cd $s && /bin/pwd`; \
 	 $(patsubst %/,cd % &&,$(objpfx)) \
 	 sed -n 's/^stub_warning *(\([^)]*\).*$$/#define __stub_\1/p' \
-	  `sed -n -e '\@ $s/[^ ]*\.c@{; s@^.* $s/\([^ ]*\.c\).*$$@'"$$s"'/\1@; h; }' \
+	  `sed -n -e '\@\.d@{; s@^.* $u/\([^ ]*\)\.d.*$$@'"$$s"'/\1.c@; h; }' \
 		-e '/stub-tag\.h/{; g; p; }' \
 		  $(patsubst $(objpfx)%,%,$^) /dev/null` \
 	     /dev/null) > $@T
 	mv -f $@T $@
 
-# Make the distribution tar file.
-
-.PHONY: dist
-dist: $(objpfx)distinfo $(..)Make-dist
-	$(MAKE) -f $< -f $(word 2,$^) $(Make-dist-args)
-
-# Avoid depending on source files found in sysdeps dirs,
-# because the references affect implicit rule selection.
-dist: $(filter-out %.c %.S %.s,$(distribute))
-
-# We used to simply export all these variables, but that frequently made the
-# environment get too large.  Instead, we write all the information into
-# a generated makefile fragment `distinfo', and then include it with -f in
-# the sub-make that makes the distribution (above).
-$(objpfx)distinfo: Makefile $(..)Makerules \
-		   $(wildcard $(foreach dir,$(sysdirs),$(dir)/Makefile))
+# Make the distribution table, which Make-nonbuild uses to make the tarfile.
+.PHONY: dist $(objpfx)dir-dist
+dist: $(objpfx)dir-dist
+# Yah, this is a mess...
+$(objpfx)dir-dist:
 	$(make-target-directory)
-	$(distinfo-vars)
-	mv -f $@.new $@
-.PHONY: subdir_distinfo
-subdir_distinfo: $(objpfx)distinfo
-
-define distinfo-vars
-rm -f $@.new
-echo > $@.new 'subdir := $(subdir)'
-$(foreach var,subdir-dirs sources elided-routines sysdep_routines \
-	      headers sysdep_headers distribute dont_distribute generated \
-	      others tests test-srcs extra-libs $(extra-libs:%=%-routines) \
-	      tests-static $(extra-libs:%=%-map) versioned \
-	      $(addprefix install-,lib lib.so data bin sbin others),
-echo >> $@.new '$(subdir)-$(var) := $($(var))'
-echo >> $@.new '$(var) = $$($(subdir)-$(var))')
-endef
+	./$(..)scripts/subdir-dist \
+	    '$(sort $(distribute) $(routines:%=%.c) $(aux:%=%.c) \
+		    $(tests:%=%.c) $(tests:%=%.input) $(tests:%=%.args) \
+		    $(test-srcs:%=%.c) \
+		    $(foreach l, $(extra-libs), \
+			$($l-routines:%=%.c) $l.map) \
+		    $(others:%=%.c) $(headers) Makefile)' \
+	    '$(experimental-only)' '$(stable-only)' \
+	    '$(release-only)' '$(snapshot-only)' \
+	    '$(subdir-dirs)' > $@.T
+	mv -f $@.T $@
 
 ifneq (,$(strip $(gpl2lgpl)))
 ifneq (,$(wildcard $(..)gpl2lgpl.sed))
============================================================
Index: Rules
--- Rules	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ Rules	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -20,18 +20,15 @@
 #	Rules for making a subdirectory in the GNU C library.
 #	Each subdirectory Makefile defines some variables and includes this.
 #
-ifneq (,)
-This makefile requires GNU Make.
-endif
 
 all: # Don't let the default goal come from Makeconfig.
 
+ifneq ($(subdir),)
 include ../Makeconfig
-
-ifndef	subdir
-Each subdirectory makefile must define the `subdir' variable.
+else
+include Makeconfig
 endif
-# This ` unconfuses emacs.
+
 # This is benign and useless in GNU make before 3.63.
 export subdir := $(subdir)
 
@@ -60,7 +57,7 @@
 common-generated :=
 endif
 
-include ../Makerules
+include $(..)Makerules
 
 .PHONY: subdir_lib
 subdir_lib: lib-noranlib
@@ -157,9 +154,6 @@
 subdir_echo-headers: echo-headers
 
 .PHONY: subdir_echo-distinfo
-subdir_echo-distinfo:
-	@echo $(addprefix +header+,$(headers) $(filter %.h,$(distribute))) \
-	      $(addprefix +nodist+,$(generated) $(common-generated) $(dont_distribute))
 
 # We want to install everything except the library itself, but update all
 # our portions of the library because the parent make will install it later
@@ -167,9 +161,8 @@
 .PHONY: subdir_install
 subdir_install: install-no-libc.a lib-noranlib stubs
 
-.PHONY: subdir_TAGS subdir_dist
+.PHONY: subdir_TAGS
 subdir_TAGS: TAGS
-subdir_dist: dist
 
 # Convenient target to update all the generated source files.
 .PHONY: generated
============================================================
Index: config.make.in
--- config.make.in	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ config.make.in	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -76,6 +76,7 @@
 INSTALL_DATA = @INSTALL_DATA@
 LN_S = @LN_S@
 MSGFMT = @MSGFMT@
+XGETTEXT = @XGETTEXT@
 
 # Script execution tools.
 BASH = @BASH@
============================================================
Index: configure.in
--- configure.in	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ configure.in	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -455,7 +455,7 @@
   [3.75 | 3.76.[1-9]* | 3.7[789]* | 3.[89]*], critic_missing=t)
 
 AC_CHECK_PROG_VER(MSGFMT, msgfmt gmsgfmt, --version,
-  [GNU gettext.*\([0-9][0-9]*\.[0-9]*\)],
+  [(GNU gettext) \([0-9][0-9]*\.[0-9]*\)],
   [0.[1-9][0-9] | [1-9].*], MSGFMT=: aux_missing=t)
 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
   [GNU texinfo \([0-9][0-9.]*\)],
@@ -483,6 +483,9 @@
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
 AC_CHECK_TOOL(MIG, mig)
+if test "$MSGFMT" != ":"; then
+  AC_CHECK_TOOL(XGETTEXT, xgettext, :)
+fi
 
 # if using special system headers, find out the compiler's sekrit
 # header directory and add that to the list.  NOTE: Only does the right
@@ -727,7 +730,7 @@
 *** WARNING: You should not compile GNU libc without versioning. Not using
 *** versioning will introduce incompatibilities so that old binaries
 *** will not run anymore.
-*** For versioning you need recent binutils (binutils-2.8.1.0.17 or newer)."
+*** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
 fi
 if test $elf = yes; then
   AC_CACHE_CHECK(for .previous assembler directive,
@@ -1159,16 +1162,10 @@
 
 AC_SUBST(DEFINES)
 
-if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
-  config_makefile=
-else
-  config_makefile=Makefile
-fi
-
 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
 AC_SUBST(VERSION)
 AC_SUBST(RELEASE)
 
-AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
+AC_OUTPUT(config.make glibcbug Makefile ${config_uname}, ,
           [echo '$config_vars' >> config.make; test -d bits || mkdir bits])
============================================================
Index: csu/Makefile
--- csu/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ csu/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -143,10 +143,9 @@
 
 # These extra files are sometimes expected by system standard linking
 # procedures, but we have nothing for them to do.  So compile empty files.
+# (-x assembler makes them smaller.)
 $(addprefix $(objpfx),$(filter-out $(start-installed-name),$(csu-dummies))):
-	cp /dev/null $(@:.o=.c)
-	$(COMPILE.c) $(@:.o=.c) $(OUTPUT_OPTION)
-	rm -f $(@:.o=.c)
+	$(CC) -c -x assembler /dev/null -o $@
 
 # These headers are used by the startup code.
 $(objpfx)abi-tag.h: $(..)abi-tags
============================================================
Index: elf/Makefile
--- elf/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ elf/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -41,9 +41,10 @@
 		  genrtldtbl.awk atomicity.h dl-procinfo.h ldsodefs.h \
 		  dl-librecon.h interp.c
 
-extra-libs	 = libdl
-extra-libs-others = $(extra-libs)
+# libdl can't be an extra-libs library because then we get the wrong
+# install rules.  It must be done by hand.  (See Make-top.)
 libdl-routines	:= dlopen dlclose dlsym dlvsym dlerror dladdr
+distribute += $(libdl-routines:=.c)
 
 before-compile = $(objpfx)trusted-dirs.h
 
@@ -55,7 +56,7 @@
 ifeq (yes,$(build-shared))
 extra-objs	= $(rtld-routines:=.os) soinit.os sofini.os eval.os interp.os
 generated	= librtld.os dl-allobjs.os ld.so trusted-dirs.h trusted-dirs.st
-install-others	= $(inst_slibdir)/$(rtld-installed-name)
+
 install-bin	= ldd
 generated      += ldd
 endif
@@ -79,6 +80,21 @@
 	      $(addprefix $(objpfx),$(extra-objs))
 endif
 
+ifeq (yes,$(build-static))
+others: $(objpfx)libdl.a
+$(objpfx)libdl.a: $(libdl-routines:%=$(objpfx)%.o)
+	$(build-extra-lib)
+install-lib += libdl.a
+endif
+
+ifeq (yes,$(build-shared))
+others: $(objpfx)libdl.so$(libdl.so-version)
+$(objpfx)libdl.so$(libdl.so-version): $(objpfx)libdl.so
+	$(make-link)
+$(objpfx)libdl_pic.a: $(libdl-routines:%=$(objpfx)%.os)
+	$(build-extra-lib)
+endif
+
 # Command to link into a larger single relocatable object.
 reloc-link = $(LINK.o) -nostdlib -nostartfiles -r -o $@
 
@@ -119,7 +135,7 @@
 # The dl code in the static libc needs a default library path.
 CFLAGS-dl-support.c = -D'DEFAULT_RPATH="$(default-rpath)"'
 
-# interp.c exists just to get this string into the libraries.
+# interp.c exists just to get this string into libc.so.
 CFLAGS-interp.c = -D'RUNTIME_LINKER="$(slibdir)/$(rtld-installed-name)"'
 
 ifneq (ld.so,$(rtld-installed-name))
@@ -144,24 +160,12 @@
 	done > ${@:st=T}
 	$(move-if-change) ${@:st=T} ${@:st=h}
 	touch $@
+
 CPPFLAGS-dl-load.c = -I$(objpfx).
 CFLAGS-dl-load.c += -Wno-uninitialized
 
-# Specify the dependencies of libdl.so; its commands come from the generic
-# rule to build a shared library.
 $(objpfx)libdl.so: $(objpfx)libdl_pic.a $(common-objpfx)libc.so $(objpfx)ld.so
-
-$(inst_slibdir)/$(rtld-version-installed-name): $(objpfx)ld.so $(+force)
-	$(do-install-program)
-
-$(inst_slibdir)/$(rtld-installed-name): \
-  $(inst_slibdir)/$(rtld-version-installed-name)
-	$(make-shlib-link)
-
-# Special target called by parent to install just the dynamic linker.
-.PHONY: ldso_install
-ldso_install: $(inst_slibdir)/$(rtld-installed-name)
-
+	$(build-shlib)
 
 sh-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
 		 -e 's%@VERSION@%$(version)%g'
@@ -201,3 +205,7 @@
 
 LDFLAGS-dl.so = -Wl,-dynamic-linker,$(slibdir)/$(rtld-installed-name)
 $(objpfx)libdl.so: $(objpfx)eval.os
+
+# Kludge.
+$(common-objpfx)libc_pic.a:
+	$(MAKE) -C $(..) -f Make-top $@
============================================================
Index: mach/Machrules
--- mach/Machrules	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ mach/Machrules	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -118,6 +118,7 @@
 			    $(objpfx)RPC_$${call}.c; \
 	done
 	touch $@
+ifndef no_deps
 -include $(patsubst %,$(objpfx)%.udeps,$(user-interfaces))
 $(patsubst %,$(objpfx)%.udeps,$(user-interfaces)):
   $(objpfx)%.udeps: $(..)mach/Machrules
@@ -128,6 +129,7 @@
 			  $(@:.udeps=_server.c) $(@:.udeps=_server.h):,' \
 	    $(sed-remove-objpfx) > $@.new
 	mv -f $@.new $@
+endif
 
 # Look for the server stub files where they will be written.
 vpath %_server.c $(addprefix $(objpfx),$(sort $(dir $(server-interfaces))))
============================================================
Index: manual/Makefile
--- manual/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ manual/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -19,14 +19,15 @@
 # Makefile for the GNU C Library manual.
 
 subdir := manual
-export subdir := $(subdir)
 
 # Allow override
 INSTALL_INFO = install-info
+DVIPS = dvips
 
-.PHONY: all dvi info
+.PHONY: all dvi info ps
 all: dvi
 dvi: libc.dvi
+ps: libc.ps
 
 ifneq ($(strip $(MAKEINFO)),)
 all: info
@@ -34,43 +35,17 @@
 endif
 
 # Get glibc's configuration info.
-ifneq (,$(wildcard ../Makeconfig))
 include ../Makeconfig
-endif
 
-# Set chapters and chapters-incl[12].
+# Set chapters list.
 -include chapters
-chapters: libc.texinfo
-	$(find-includes)
-ifdef chapters
-# @includes in chapter files
--include chapters-incl1
-chapters-incl1: $(chapters)
-	$(find-includes)
-chapters-incl1 := $(filter-out summary.texi,$(chapters-incl1))
-endif
-ifdef chapters-incl1
-# @includes in files included by chapter files, if any
--include chapters-incl2
-chapters-incl2: $(chapters-incl1)
-	$(find-includes)
-endif
-
-chapters-incl := $(chapters-incl1) $(chapters-incl2)
-
-define find-includes
-(echo '$(@F) :=' \\	;\
- $(AWK) '$$1 == "@include" { print $$2 " \\" }' $^) > $@.new
-mv -f $@.new $@
-endef
-
-# scripts we use
-ifndef move-if-change
-move-if-change = ./move-if-change
-endif
-mkinstalldirs = $(..)scripts/mkinstalldirs
+chapters: libc.texinfo $(filter-out %.c.texi, $(chapters))
+	-$(AWK) -f chapters.awk $< > $@.new 2> /dev/null
+	mv -f $@.new $@
+chapters = $(filter-out %.c.texi, $(texis))
+examples = $(filter %.c.texi, $(texis))
 
-libc.dvi libc.info: $(chapters) summary.texi $(chapters-incl)
+libc.dvi libc.info: libc.texinfo $(texis)
 libc.dvi: texinfo.tex
 
 %.info: %.texinfo
@@ -79,9 +54,12 @@
 %.dvi: %.texinfo
 	$(TEXI2DVI) $<
 
+%.ps: %.dvi
+	$(DVIPS) $< -o $@
+
 # Generate the summary from the Texinfo source files for each chapter.
 summary.texi: stamp-summary ;
-stamp-summary: summary.awk $(chapters) $(chapters-incl)
+stamp-summary: summary.awk $(filter-out summary.texi, $(chapters))
 	$(AWK) -f $^ \
 	| sort -df +1 -2 | tr '\014' '\012' > summary-tmp
 	$(move-if-change) summary-tmp summary.texi
@@ -90,10 +68,10 @@
 # Generate a file which can be added to the `dir' content to provide direct
 # access to the documentation of the function, variables, and other
 # definitions.
-dir-add.texinfo: xtract-typefun.awk $(chapters) $(chapters-incl)
+dir-add.texinfo: xtract-typefun.awk $(chapters)
 	$(SHELL) -c '(echo "@dircategory GNU C library functions";	\
 	 echo "@direntry";						\
-	 $(AWK) -f $^;							\
+	 $(AWK) -f $^ | sort;						\
 	 echo "@end direntry";)' > $@.new
 	mv -f $@.new $@
 
@@ -106,58 +84,23 @@
 	    $< | expand > $@.new
 	mv -f $@.new $@
 
-
-minimal-dist = summary.awk libc.texinfo $(chapters)			\
-	       $(patsubst %.c.texi,examples/%.c,			\
-			  $(filter-out summary.texi,$(chapters-incl)))
-doc-only-dist = Makefile COPYING.LIB
-distribute = $(minimal-dist)	       					\
-	     $(patsubst examples/%.c,%.c.texi,$(filter examples/%.c,	\
-			$(minimal-dist)))				\
-	     libc.info* libc.?? libc.??s texinfo.tex summary.texi	\
-	     stamp-summary chapters chapters-incl1 chapters-incl2	\
-	     xtract-typefun.awk dir-add.texinfo dir-add.info dir	\
-	     stdio-fp.c
-export distribute := $(distribute)
-
-tar-it = tar chovf $@ $^
-
-manual.tar: $(doc-only-dist) $(minimal-dist) ; $(tar-it)
-mandist.tar: $(doc-only-dist) $(distribute) ; $(tar-it)
-
-edition := $(shell sed -n 's/^@set EDITION \([0-9][0-9.]*\)[^0-9.]*.*$$/\1/p' \
-		       libc.texinfo)
-
-glibc-doc-$(edition).tar: $(doc-only-dist) $(distribute)
-	@rm -f glibc-doc-$(edition)
-	ln -s . glibc-doc-$(edition)
-	tar chovf $@ $(addprefix glibc-doc-$(edition)/,$^)
-	rm -f glibc-doc-$(edition)
-
-%.Z: %
-	compress -c $< > $@.new
-	mv -f $@.new $@
-%.gz: %
-	gzip -9 -c $< > $@.new
-	mv -f $@.new $@
-%.uu: %
-	uuencode $< < $< > $@.new
-	mv -f $@.new $@
-
-.PHONY: mostlyclean distclean realclean clean
-mostlyclean:
-	-rm -f libc.dvi libc.info* dir-add.info stubs
+.PHONY: clean
+clean:
+ifdef clean-obj
+	-rm -f libc.dvi libc.info* dir-add.info stubs dir-dist TAGS
 	-rm -f $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
-clean: mostlyclean
-distclean: clean
-indices = cp fn pg tp vr ky
-realclean: distclean
-	-rm -f chapters chapters-incl* summary.texi stamp-summary *.c.texi
-	-rm -f $(foreach index,$(indices),libc.$(index) libc.$(index)s)
-	-rm -f libc.log libc.aux libc.toc dir-add.texi
+	-rm -f $(objpfx)stubs
+endif
+ifdef clean-gen
+	-rm -f $(foreach i, cp fn pg tp vr ky, libc.$i libc.$(i)s)
+	-rm -f libc.log libc.aux libc.toc
+	-rm -f $(examples)
+endif
+ifdef clean-src
+	-rm -f chapters summary.texi stamp-summary dir-add.texinfo
+endif
 
-.PHONY: install subdir_install installdirs install-data
-install-data subdir_install: install
+.PHONY: install
 ifneq ($(strip $(MAKEINFO)),)
 install: $(inst_infodir)/libc.info dir-add.info
 	@if $(SHELL) -c '$(INSTALL_INFO) --version' >/dev/null 2>&1; then \
@@ -166,72 +109,55 @@
 	 $(INSTALL_INFO) --info-dir=$(inst_infodir) dir-add.info;\
 	else : ; fi
 endif
-# Catchall implicit rule for other installation targets from the parent.
-install-%: ;
 
-$(inst_infodir)/libc.info: libc.info installdirs
+$(inst_infodir)/libc.info: libc.info
+	$(make-target-directory)
 	for file in $<*; do \
 	  name=`basename $$file`; \
 	  $(INSTALL_DATA) $$file \
 	    `echo $@ | sed "s,$<\$$,$$name,"`; \
 	done
 
-installdirs:
-	$(mkinstalldirs) $(inst_infodir)
+distribute = summary.awk xtract-typefun.awk libc.texinfo libcbook.texi	\
+	     chapters chapters.awk $(chapters) $(examples)		\
+	     $(patsubst %.c.texi,examples/%.c,$(examples))		\
+	     libc.info $(wildcard libc.info-*) dir-add.info		\
+	     texinfo.tex dir dir-add.texinfo stamp-summary
 
 .PHONY: dist
-dist: # glibc-doc-$(edition).tar.gz
-
-ifneq (,$(wildcard ../Make-dist))
-dist: ../Make-dist
-	$(MAKE) -f $< $(Make-dist-args)
-endif
+dist: $(objpfx)dir-dist
+$(objpfx)dir-dist: info
+	$(make-target-directory)
+	echo "$(wildcard $(distribute)) Makefile" | tr ' ' '\n' | \
+	   sed 's!^!   manual/!' > $(objpfx)dir-dist.T
+	mv $(objpfx)dir-dist.T $(objpfx)dir-dist
 
 ifndef ETAGS
-ETAGS = etags -T
+ETAGS = etags
 endif
-TAGS: $(minimal-dist)
-	$(ETAGS) -o $@ $^
-
-# The parent makefile sometimes invokes us with targets `subdir_REAL-TARGET'.
-subdir_%: % ;
-# For targets we don't define, do nothing.
-subdir_%: ;
+# This mess makes etags tag all @deftypefoo lines in the texi files.
+define tags-texi
+--language=none \
+--regex='/^@deftype\(fnx?\|vrx?\) +\([^ ]+\|{[^}]+}\) +\([^ ]+\|{[^}]+}\) +\([a-zA-Z0-9_]+\)/\4/' \
+--regex='/^@deftype\(funx?\|varx?\) +\([^ ]+\|{[^}]+}\) +\([a-zA-Z0-9_]+\)/\3/'
+endef
+
+TAGS: $(chapters)
+	$(ETAGS) $(tags-texi) $^ -o $@
 
 # These are targets that each glibc subdirectory is expected to understand.
 # ../Rules defines them for code subdirectories; for us, they are no-ops.
-# None of these should be `subdir_TARGET'; those targets are transformed
-# by the implicit rule above into `TARGET' deps.
-glibc-targets	:= lib objects objs others tests lint.out \
-		   echo-headers echo-distinfo
-.PHONY: $(glibc-targets)
-$(glibc-targets):
+.PHONY: lib others tests
+tests:
 
 # Create stamp files if they don't exist, so the parent makefile's rules for
 # updating the library archives are happy with us, and never think we have
 # changed the library.
 lib: $(foreach o,$(object-suffixes-for-libc),$(objpfx)stamp$o)
-ifdef objpfx
-.PHONY: stubs
-stubs: $(objpfx)stubs
-endif
-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
-	$(make-target-directory)
-	touch $@
 
-# Make the target directory if it doesn't exist, using the `mkinstalldirs'
-# script that does `mkdir -p' even if `mkdir' doesn't support that flag.
-define make-target-directory
-$(addprefix $(mkinstalldirs) ,\
-	    $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
-endef
+# The top-level glibc Makefile expects others to update the stubs file.
+others: $(objpfx)stubs
 
-# The top-level glibc Makefile expects subdir_install to update the stubs file.
-subdir_install: stubs
-
-# Get rid of these variables if they came from the parent.
-routines =
-aux =
-sources =
-objects =
-headers =
+$(objpfx)stubs $(objpfx)stamp%:
+	$(make-target-directory)
+	touch $@
============================================================
Index: manual/chapters
--- manual/chapters	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ manual/chapters	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -1,36 +1,77 @@
-chapters := \
+texis = \
 intro.texi \
+creature.texi \
 errno.texi \
 memory.texi \
 ctype.texi \
 string.texi \
+stpcpy.c.texi \
+strdupa.c.texi \
+strncat.c.texi \
 mbyte.texi \
 locale.texi \
 message.texi \
 search.texi \
+search.c.texi \
 pattern.texi \
 io.texi \
 stdio.texi \
+rprintf.c.texi \
+memopen.c.texi \
+memstrm.c.texi \
+fmtmsgexpl.c.texi \
 llio.texi \
+select.c.texi \
 filesys.texi \
+dir.c.texi \
+dir2.c.texi \
 pipe.texi \
+pipe.c.texi \
+popen.c.texi \
 socket.texi \
+mkfsock.c.texi \
+mkisock.c.texi \
+isockad.c.texi \
+inetcli.c.texi \
+inetsrv.c.texi \
+filesrv.c.texi \
+filecli.c.texi \
 terminal.texi \
+termios.c.texi \
 math.texi \
 arith.texi \
 time.texi \
+strftim.c.texi \
 setjmp.texi \
+setjmp.c.texi \
 signal.texi \
+sigh1.c.texi \
+sigusr.c.texi \
 startup.texi \
+getopt.texi \
+testopt.c.texi \
+longopt.c.texi \
+argp.texi \
+argp-ex1.c.texi \
+argp-ex2.c.texi \
+argp-ex3.c.texi \
+argp-ex4.c.texi \
+subopt.c.texi \
+atexit.c.texi \
 process.texi \
 job.texi \
 nss.texi \
+nsswitch.texi \
 users.texi \
+db.c.texi \
 sysinfo.texi \
 conf.texi \
 lang.texi \
+add.c.texi \
 header.texi \
+summary.texi \
 install.texi \
 maint.texi \
 contrib.texi \
 lgpl.texinfo \
+
============================================================
Index: math/Makefile
--- math/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ math/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -81,6 +81,8 @@
 # distinct from `double'.
 test-longdouble-yes = test-ldouble test-ildoubl
 
+distribute += $(test-longdouble-yes:=.c) $(tests-static:=.c)
+
 CFLAGS-test-float.c = -fno-inline -ffloat-store
 CFLAGS-test-double.c = -fno-inline -ffloat-store
 CFLAGS-test-ldouble.c = -fno-inline -ffloat-store
============================================================
Index: nis/Makefile
--- nis/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ nis/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -53,7 +53,6 @@
 		  nis_modify nis_remove nis_add nis_defaults\
 		  nis_findserv nis_callback nis_clone_dir nis_clone_obj\
 		  nis_clone_res
-libnsl-map	= libnsl.map
 
 libnss_compat-routines	:= $(addprefix compat-,grp pwd spwd) nisplus-parser
 libnss_compat-inhibit-o	= $(filter-out .os,$(object-suffixes))
============================================================
Index: sysdeps/generic/Dist
--- sysdeps/generic/Dist	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ sysdeps/generic/Dist	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -3,3 +3,7 @@
 entry.h
 getresgid.c
 getresuid.c
+getutxent.c getutxid.c getutxline.c 
+pututxline.c setutxent.c
+updwtmpx.c utmpxname.c endutxent.c 
+errno-loc.c
============================================================
Index: sysdeps/gnu/Dist
--- sysdeps/gnu/Dist	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ sysdeps/gnu/Dist	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -1,3 +1,4 @@
 errlist.awk
+errlist.c
 utmpx.h
 bits/utmpx.h
============================================================
Index: sysdeps/unix/Makefile
--- sysdeps/unix/Makefile	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ sysdeps/unix/Makefile	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -16,8 +16,6 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# The unix-specific configure fragment writes `unix-generated' in config.make.
-config-generated := $(config-generated) $(unix-generated)
 
 ifeq (,$(filter-out $(sysdep_dir)/generic/ $(common-objpfx),\
 	$(dir $(firstword $(wildcard $(+sysdep_dirs:%=%/bits/local_lim.h))))))
@@ -285,6 +283,7 @@
 export sysdirs
 export asm_CPP := $(COMPILE.S) -E -x assembler-with-cpp
 
+ifndef no_deps
 $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
 			       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
 	for dir in $(+sysdep_dirs); do \
@@ -293,6 +292,7 @@
 	  test $$dir = $(..)sysdeps/unix && break; \
 	done > $@T
 	mv -f $@T $@
+endif
 
 # This syscall objects depend on s-proto.d, which is generated to
 # specify dependencies generated syscalls with have on headers.
@@ -308,7 +308,8 @@
 			   $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
 	$(+make-deps)
 
-common-generated += s-proto.d
-postclean-generated += sysd-syscalls
+ifeq ($(strip $(subdir)),)
+common-generated += s-proto.d sysd-syscalls
+endif
 
 endif
============================================================
Index: sysdeps/unix/sysv/linux/Dist
--- sysdeps/unix/sysv/linux/Dist	Sat, 09 May 1998 13:36:13 -0400 zack  0.3
+++ sysdeps/unix/sysv/linux/Dist	Sat, 30 May 1998 15:54:11 -0400 zack  Z.6
@@ -74,3 +74,4 @@
 sys/vt.h
 xstatconv.c
 getdents64.c
+getresuid.c
============================================================
Index: timezone/Makefile
--- timezone/Makefile	Sat, 30 May 1998 16:12:00 -0400 zack  0.3
+++ timezone/Makefile	Sat, 30 May 1998 18:37:27 -0400 zack  Z.6
@@ -53,7 +53,7 @@
 
 
 endef
-ifndef avoid-generated
+ifndef no_deps
 -include $(addprefix $(objpfx)z.,$(tzfiles))
 endif
 
============================================================
Index: manual/chapters.awk
--- manual/chapters.awk	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ manual/chapters.awk	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,17 @@
+BEGIN {
+    print "texis = \\"
+    input[0] = ARGV[1]
+    for (s = 0; s >= 0; s--)
+    {
+        while ((getline < input[s]) > 0)
+	{
+            if ($1 == "@include") 
+	    {
+	        input[++s] = $2
+		print $2 " \\"
+	    }
+        }
+        close(input[stackptr])
+    }
+    print ""
+}
============================================================
Index: scripts/unT.c
--- scripts/unT.c	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ scripts/unT.c	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,42 @@
+/* unT.c
+ *
+ * This program does exactly one thing: it takes a list of filenames
+ * as arguments, and it chops 'T' off the end of their names.
+ *
+ * It's written to be fast and dumb, since it is only used from a script
+ * and during its execution NO DYNAMICALLY LINKED PROGRAM CAN RUN.
+ * No attempt is made to recover from errors.  If it fails you're toast.
+ */
+
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define max(x, y) (((x) >= (y)) ? (x) : (y))
+int
+main(int argc, char **argv)
+{
+    char *cur, *new;
+    int bufsiz = 1024, len;
+
+    new = malloc(bufsiz);
+    
+    for(argv++; *argv; argv++)
+    {
+	cur = *argv;
+	len = strlen(cur);
+	if(cur[len-1] != 'T')
+	    continue;
+	
+	if(len + 1 > bufsiz)
+	{
+	    bufsiz += max(1024, len+1 - bufsiz);
+	    new = realloc(new, bufsiz);
+	}
+
+	strcpy(new, cur);
+	new[len-1] = '\0';
+	rename(cur, new);
+    }
+    return 0;
+}
============================================================
Index: scripts/subdir-dist
--- scripts/subdir-dist	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ scripts/subdir-dist	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,73 @@
+#! /bin/sh
+
+# subdir-dist '$(distribute)' '$(exp-only)' '$(sta-only)' '$(rel-only)' '$(snap-only)' '$(subdir-dirs)'
+
+[ -n "$subdir" ] && { subdir=$subdir/; dd=../; }
+
+subdir_dirs="$6"
+
+for l in '   ' '%e ' '%t ' '%r ' '%s ' 
+do
+    list="$1"; shift
+    [ -z "$list" ] && continue
+
+    csysd=
+    hsysd=
+    for f in $list
+    do
+	case $f in
+	    ..*)
+		# Subdir distributes thing in higher dir, ick.
+		[ -n "$dd" ] || { echo File to distribute outside source tree: $f >&2; exit 1; }
+		[ -f $f ] && echo "$l${f#../}";;
+	    *.c)
+		# If it's in . or $subdir_dirs it's not system dependent.
+		if [ -f $f ]; then
+		    echo "$l$subdir$f"
+		else
+		    found=
+		    for d in $subdir_dirs
+		    do
+			if [ -f $d/$f ]; then
+			    echo "$l$subdir$d/$f"
+			    found=t
+			fi
+		    done
+		    [ -n "$found" ] || csysd="$csysd $f"
+		fi;;
+	    *.h)
+		if [ -f $f ]; then
+		    echo "$l$subdir$f"
+		else
+		    found=
+		    for d in $subdir_dirs
+		    do
+			if [ -f $d/$f ]; then
+			    echo "$l$subdir$d/$f"
+			    found=t
+			fi
+		    done
+		    [ -n "$found" ] || hsysd="$hsysd $f"
+		fi
+		[ -f ${dd}include/$f ] && echo "${l}include/$f";;
+	    *)
+		# Might be a glob.
+		for ff in $f; do
+		    [ -f $ff ] && echo "$l$subdir$ff"
+		done;;
+	esac
+    done
+
+    for s in $SYSDIRS; do
+	for f in $csysd; do
+	    if   [ -f $dd$s/$f ];        then echo "$l$s/$f"
+		elif [ -f $dd$s/${f%.c}.S ]; then echo "$l$s/${f%.c}.S"
+		elif [ -f $dd$s/${f%.c}.s ]; then echo "$l$s/${f%.c}.s"
+	    fi
+	done
+	for f in $hsysd; do
+	    [ -f $dd$s/$f ] && echo "$l$s/$f"
+	done
+    done
+
+done
============================================================
Index: scripts/fixpatch
--- scripts/fixpatch	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ scripts/fixpatch	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,24 @@
+#! /usr/bin/perl
+
+while (<>)
+{
+    /^Index:\s+(.+)/ && do
+    {
+	$full = $1;
+	($small) = ($full =~ m=.*/([^\t]*)=);
+	print '=' x 60, "\n";
+	next;
+    };
+    
+    (/^==========/ || /^RCS file: / || /^retrieving/ || /^diff -u -r/)
+	&& do { $_ = <>; redo; };
+    
+    /^(?:---|\+\+\+) / && do
+    {
+	s/\.orig//;
+	s/\([a-zA-Z0-9\/._\s-]+\)//;
+	s/\s$small/ $full/ if $small;
+	s/$full\s+/$full\t/;
+    };
+}
+continue { print; }
============================================================
Index: scripts/tarprefix.c
--- scripts/tarprefix.c	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ scripts/tarprefix.c	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,165 @@
+/* tarprefix.c
+   Copy the tarfile on stdin to stdout, prepending all filenames
+   with the single argument. */
+
+#include <sys/types.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+
+/* Tarfile info */
+#define MAGIC "ustar  "
+#define MOFF  257
+#define NOFF 0
+#define NLEN 100
+#define CKOFF 148
+#define CKLEN 6
+#define CKLENS "6"
+#define POFF 345
+#define PLEN 155
+#define SOFF 124
+#define SLEN 12
+
+#define min(x,y) (((x) < (y)) ? (x) : (y))
+
+void readblock(char *b, int s);
+void writeblock(char *b, int s);
+
+int
+main(int argc, char **argv)
+{
+    char buffer[32*1024];
+    int size, len, i, sum;
+    
+    if(argc != 2)
+    {
+	fputs("tarprefix: usage: tarprefix PREFIX\n", stderr);
+	exit(2);
+    }
+
+    len = strlen(argv[1]);
+
+    for(;;)
+    {
+	readblock(buffer, 512);
+
+	if(strncmp(MAGIC, &buffer[MOFF], sizeof MAGIC))
+	{
+	    for(i = 0; i < 512; i++)
+	    {
+		if(buffer[i])
+		{
+		    fputs("tarprefix: corrupted archive\n", stderr);
+		    exit(1);
+		}
+		
+	    }
+	    writeblock(buffer, 512);
+	    break;
+	}
+
+	if(buffer[NOFF+NLEN-1-len] != '\0')
+	{
+	    if(buffer[POFF+PLEN-1-len] != '\0')
+	    {
+		fputs("tarprefix: name too long\n", stderr);
+		exit(1);
+	    }
+	    memmove(&buffer[POFF+len], &buffer[POFF], PLEN-len);
+	    memcpy(&buffer[POFF], argv[1], len);
+	}
+	else
+	{
+	    memmove(&buffer[NOFF+len], &buffer[NOFF], NLEN-len);
+	    memcpy(&buffer[NOFF], argv[1], len);
+	}
+	size = strtol(&buffer[SOFF], NULL, 8);
+	if(size % 512)
+	{
+	    size -= size % 512;
+	    size += 512;
+	}
+
+	sum = 0;
+	for(i = 0; i < 512; i++)
+	    sum += (CKOFF <= i && i <= CKOFF+CKLEN) ? ' ' : buffer[i];
+	sprintf(&buffer[CKOFF], "%"CKLENS"o", sum);
+	
+	writeblock(buffer, 512);
+
+	while(size > 0)
+	{
+	    readblock(buffer, min(size, 32*1024));
+	    writeblock(buffer, min(size, 32*1024));
+	    size -= 32*1024;
+	}
+
+    }
+
+    readblock(buffer, 512);
+    writeblock(buffer, 512);
+    return 0;
+}
+
+void
+readblock(char *b, int s)
+{
+    int r, c = 0;
+
+    do
+    {
+	r = read(0, b, s);
+	if(r == -1)
+	{
+	    fprintf(stderr, "tarprefix: read: %s\n", strerror(errno));
+	    exit(1);
+	}
+	else if(r == 0)
+	{
+	    if(c++)
+	    {
+		fprintf(stderr, "tarprefix: archive truncated\n");
+		exit(1);
+	    }
+	}
+	else
+	    c = 0;
+	
+	s -= r;
+	b += r;
+    }
+    while(s > 0);
+}
+
+void
+writeblock(char *b, int s)
+{
+    int r, c = 0;
+
+    do
+    {
+	r = write(1, b, s);
+	if(r == -1)
+	{
+	    fprintf(stderr, "tarprefix: write: %s\n", strerror(errno));
+	    exit(1);
+	}
+	else if(r == 0)
+	{
+	    if(c++)
+	    {
+		fputs("tarprefix: unexpected EOF writing\n", stderr);
+		exit(1);
+	    }
+	}
+	else
+	    c = 0;
+	
+	s -= r;
+	b += r;
+    }
+    while(s > 0);
+}
============================================================
Index: Makedriver
--- Makedriver	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ Makedriver	Sat, 30 May 1998 18:37:27 -0400 zack 
@@ -0,0 +1,287 @@
+# Copyright (C) 1998 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Driver makefile.  This just knows how to iterate over all the
+# subdirectories building things.  
+# (There are some rules it handles itself, too.)
+
+include Makeconfig
+.PHONY: all lib others install tests check makefiles
+.PHONY: dist snapshot release TAGS tidy clean error
+
+error:
+	@echo Do not call this makefile directly.; exit 1
+
+# Some dependencies.
+all: lib others
+lib others: makefiles
+check: test
+# Note TAGS technically depends on dist, but we put the dependency in
+# Makerules instead so it only iterates the subdirs once.
+snapshot release: dist
+
+# Subdir iteration.
+subdir_targets := lib others install tests clean
+all_subdir_targets := dist TAGS
+
+$(subdir_targets): %: $(addsuffix /%, $(subdirs)) top/%
+$(all_subdir_targets): %: $(addsuffix /%, $(all-subdirs)) top/%
+
+$(foreach t, $(subdir_targets), $(addsuffix /$t, $(subdirs))):
+	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+$(foreach t, $(all_subdir_targets), $(addsuffix /$t, $(all-subdirs))):
+	$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+
+
+top/%:  
+	$(MAKE) $(PARALLELMFLAGS) -f Make-top $*
+
+# dist requires special handling...
+dist: $(common-objpfx)distlist po/libc.pot
+
+$(common-objpfx)distlist: $(patsubst %, $(objpfx)%/dir-dist, $(all-subdirs)) \
+			  $(common-objpfx)sysd-dist
+	sort -u $^ > $@.T
+	mv -f $@.T $@
+
+# Requires GNU tr.
+$(common-objpfx)sysd-dist: \
+	$(wildcard \
+	  $(foreach f, configure configure.in Subdirs Makefile Implies Dist, \
+	    $(addsuffix /$f, $(all-sysdep-dirs))))
+	echo $^ | tr -s '[:space:]' '\n' > $@.T
+	for d in $(dir $(filter %Dist, $^)); \
+	do tr -s '[:space:]' '\n' <$${d}Dist | sed "/^$$/d; s!^!$$d!"; \
+	done >> $@.T
+	sort -u $@.T | sed 's/^/   /' > $@.U
+	rm -f $@.T
+	mv -f $@.U $@
+
+# This belongs in Make-top, but cannot go there because it needs information
+# from the entire distlist file.
+# Requires a date that knows %z.
+po/libc.pot: po/header.pot $(common-objpfx)distlist
+	sed -e 's/VERSION/$(version)/' \
+	    -e "s/DATE/`date +'%Y-%m-%d %H:%M %z'`/" po/header.pot > $@.T
+	$(XGETTEXT) -d - --omit-header -n \
+	--keyword=_ --keyword=N_ --add-comments=TRANS  --sort-output \
+	`grep '\.[ch]$$' $(common-objpfx)distlist | cut -c4-` >> $@.T
+	mv -f $@.T $@
+	$(cvs-commit)
+
+
+# Rules for cutting distributions.
+# You can make a snapshot or a release.  They can be experimental or
+# stable; this is determined by version.h.  That affects what files go
+# into the package.
+
+vers-snapshot = $(shell date +%Y%m%d)
+last-snapshot = $(strip $(shell cat .last-snapshot))
+crunch-list-snapshot-experimental = '/^%[tr]/d; s/^%[es] //'
+crunch-list-snapshot-stable	  = '/^%[er]/d; s/^%[ts] //'
+
+vers-release = $(version)
+last-release = $(strip $(shell cat .last-release))
+crunch-list-release-experimental = '/^%[ts]/d; s/^%[er] //'
+crunch-list-release-stable	 = '/^%[es]/d; s/^%[tr] //'
+
+tarfile = $(common-objpfx)glibc-$(vers-$@).tar.gz
+diff    = $(common-objpfx)glibc-$(last-$@)-$(vers-$@).diff.gz
+
+release snapshot: $(common-objpfx)tarprefix $(common-objpfx)distlist
+ifeq ($(with-cvs),yes)
+	cvs $(CVSOPTS) diff -u -l -r $@_$(subst .,_,$(last-$@)) \
+		`sed $(crunch-list-$@-$(release)) distlist` | \
+		$(PERL) ./scripts/fixpatch | gzip -9 > $@T
+	mv -f $@T $@
+	cvs $(CVSOPTS) tag -c -l $@_$(subst .,_,$(last-$@)) \
+		`sed $(crunch-list-$@-$(release)) distlist`
+endif
+	sed $(crunch-list-$@-$(release)) $(common-objpfx)distlist | \
+	tr ' ' '\n' | sort | tar cTf - - | \
+	$(common-objpfx)tarprefix glibc-$(vers-$@)/ | gzip -9 > $@T
+	mv -f $@T $@
+	echo $(vers-$@) > .last-$@
+
+$(common-objpfx)tarprefix: scripts/tarprefix.c
+	$(BUILD_CC) -g -O2 -Wall $< -o $@
+
+# This goes through the source tree and deletes garbage.  Please note
+# that it uses my very personal definition of "garbage" -- YMMV.
+# Requires GNU find and Perl.  Do `make tidy tidy-cmd=print' to
+# get a list of what it would delete.
+tidy-cmd = unlink
+tidy:
+	find .  \( -name '*~' -o -name '#*#' -o -name '.#*' \
+		-o -name '*.orig' -o -name '*.rej' \
+		-o -name '*.old' -o -name '*.bak' \) -printf '%P\0' | \
+	$(PERL) -ln0e $(tidy-cmd)
+
+# Autoconf rules.
+ifeq ($(with-cvs),yes)
+define autoconf-it
+@-rm -f $@.new
+autoconf $(ACFLAGS) $< > $@.new
+chmod a-w,a+x $@.new
+mv -f $@.new $@
+test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
+endef
+else
+define autoconf-it
+@-rm -f $@.new
+autoconf $(ACFLAGS) $< > $@.new
+chmod a-w,a+x $@.new
+mv -f $@.new $@
+endef
+endif
+
+configure: configure.in aclocal.m4; $(autoconf-it)
+%/configure: %/configure.in aclocal.m4; $(autoconf-it)
+
+# 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.  Makefile and glibcbug get rebuilt
+# as a side effect, which Make needn't know about.
+$(objpfx)config.make: $(objpfx)config.status config.make.in config.h.in
+	cd $(<D); $(SHELL) $(<F)
+
+# Find all the sysdeps configure fragments, to make sure we re-run
+# configure when any of them changes.
+$(objpfx)config.status: version.h configure \
+			$(foreach dir,$(full-config-sysdirs),\
+			  $(wildcard $(dir)/Implies) \
+			  $(patsubst %.in,%,\
+			    $(firstword $(wildcard \
+			      $(addprefix $(dir)/,configure configure.in)))))
+	@cd $(@D); if test -f $(@F); then echo $(SHELL) $(@F) --recheck; \
+	 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
+
+# Generated Makefiles.  The rules are wrapped in ifndef no_deps,
+#  so they don't get created pointlessly during a non-build make.
+
+ifndef no_deps
+makefiles: $(addprefix $(objpfx),soversions.mk sysd-Makefile \
+				 sysd-rules sysd-dirs gnu/lib-names.h)
+
+$(objpfx)soversions.mk: shlib-versions Makeconfig \
+			       $(wildcard $(add-ons:%=%/shlib-versions)) \
+			       $(objpfx)config.make
+	(files='$(filter %shlib-versions, $^)'; \
+	 for f in $$files; do \
+	   sed 's/#.*$$//' $$f | while read conf versions; do \
+	     test -n "$$versions" && \
+	     test `expr '$(config-machine)-$(config-vendor)-$(config-os)' \
+			: "$$conf"` != 0 || continue; \
+	     for v in $$versions; do \
+	       lib=`echo $$v | sed 's/=.*$$//'`; \
+	       if eval "test -z \"\$$vers_lib$$lib\""; then \
+		 eval vers_lib$${lib}=yes; \
+		 number=`echo $$v | sed "s/^.*=//"`; \
+		 case $$number in \
+		   [0-9]*) echo "$$lib.so-version=.$$number"; \
+			   echo "all-sonames+=$$lib.so\$$($$lib.so-version)";;\
+		   *) echo "$$lib.so-version=$$number"; \
+		      echo "all-sonames+=\$$($$lib.so-version)";;  \
+	         esac; \
+	       fi; \
+	     done; \
+	   done; \
+	 done;) > $@T; exit 0
+	mv -f $@T $@
+
+all-Subdirs-files = $(wildcard $(addsuffix /Subdirs, $(config-sysdirs)))
+$(common-objpfx)sysd-dirs: $(common-objpfx)config.make $(all-Subdirs-files)
+	(echo define sysdep-subdirs;				\
+	 sed 's/#.*$$//' $(all-Subdirs-files) /dev/null;	\
+	 echo endef) > $@T
+	mv -f $@T $@
+
+$(common-objpfx)sysd-Makefile: $(common-objpfx)config.make Makerules
+	(for dir in $(config-sysdirs); do	   			      \
+	   file=$$dir/Makefile;						      \
+	   case $$dir in						      \
+	     /*) rel= ;;						      \
+	     *)  rel=$(..) ;;						      \
+	   esac;							      \
+	   if [ -f $$rel$$file ]; then					      \
+	     case $$dir in						      \
+	       /*) echo include "$$file" ;;				      \
+	       *)  echo include "\$$(..)$$file" ;;			      \
+	     esac;							      \
+	   else true; fi;						      \
+	 done;								      \
+	 echo 'sysd-Makefile-done=t') > $@T
+	mv -f $@T $@
+
+$(common-objpfx)sysd-rules: $(common-objpfx)config.make Makerules \
+		$(wildcard $(foreach dir, $(config-sysdirs), $(dir)/Makefile))
+	(for sysdir in $(config-sysdirs); do				      \
+	   dir="\$$(..)$$sysdir";					      \
+	   for o in $(all-object-suffixes); do				      \
+	     $(open-check-inhibit-asm)					      \
+	     echo "\$$(objpfx)%$$o: $$dir/%.S \$$(before-compile);	      \
+		  \$$(compile-command.S)";				      \
+	     echo "\$$(objpfx)%$$o: $$dir/%.s \$$(before-compile);	      \
+		  \$$(compile-command.s)";				      \
+	     $(close-check-inhibit-asm)					      \
+	     echo "\$$(objpfx)%$$o: $$dir/%.c \$$(before-compile);	      \
+		  \$$(compile-command.c)";				      \
+	   done;							      \
+	   $(open-check-inhibit-asm)					      \
+	   echo "\$$(objpfx)%.d: $$dir/%.s \$$(common-objpfx)dummy.d;	      \
+		\$$(make-dummy-dep)";					      \
+	   echo "\$$(objpfx)%.d: $$dir/%.S \$$(before-compile);		      \
+		\$$(+make-deps)";					      \
+	   $(close-check-inhibit-asm)					      \
+	   echo "\$$(objpfx)%.d: $$dir/%.c \$$(before-compile);		      \
+		\$$(+make-deps)";					      \
+	 done;								      \
+	 echo 'sysd-rules-done = t') > $@T
+	mv -f $@T $@
+
+# Generate the header containing the names of all shared libraries.
+# We use a stamp file to avoid uncessary recompilations.
+# This doesn't belong here but there isn't a better place to put it :(
+$(common-objpfx)gnu/lib-names.h: $(common-objpfx)gnu/lib-names.stmp; @:
+$(common-objpfx)gnu/lib-names.stmp: $(common-objpfx)soversions.mk
+	$(make-target-directory)
+	@rm -f $(@:stmp=T) $@
+	(echo '/* This file is automatically generated.';\
+	 echo '   It defines macros to allow user program to find the shared';\
+	 echo '   library files which come as part of GNU libc.  */';\
+	 echo '#ifndef __GNU_LIB_NAMES_H'; \
+	 echo '#define __GNU_LIB_NAMES_H	1'; \
+	 echo; \
+	 (libs='$(all-sonames)';\
+	  for l in $$libs; do \
+	    upname=`echo $$l | sed 's/[.]so.*//' | \
+		    tr 'abcdefghijklmnopqrstuvwxyz-' \
+		       'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`; \
+	    echo "#define	$${upname}_SO	\"$$l\""; \
+	  done;) | sort; \
+	 echo; \
+	 echo '#endif	/* gnu/lib-names.h */';) > $(@:stmp=T)
+	$(move-if-change) $(@:stmp=T) $(@:stmp=h)
+	touch $@
+endif
============================================================
Index: Make-top
--- Make-top	Sat, 30 May 1998 18:41:01 -0400 zack ()
+++ Make-top	Sat, 30 May 1998 15:54:11 -0400 zack 
@@ -0,0 +1,253 @@
+# Copyright (C) 1998 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., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# This is a subdir Makefile, but for the top level of the tree.
+
+subdir :=
+
+headers := errno.h sys/errno.h bits/errno.h limits.h values.h	\
+	   features.h gnu-versions.h bits/libc-lock.h bits/xopen_lim.h	\
+	   gnu/libc-version.h
+
+# The headers are hiding in include/.
+subdir-dirs = include
+vpath %.h include
+
+distribute  =	README README.libm INSTALL FAQ NOTES NEWS PROJECTS	\
+		BUGS COPYING ChangeLog ChangeLog.[0-9]			\
+		Makedriver Makeconfig Makerules Rules Make-top		\
+		extra-lib.mk o-iterator.mk libc.map configure		\
+		configure.in aclocal.m4 config.h.in config.make.in	\
+		config-name.in Makefile.in sysdep.h set-hooks.h		\
+		libc-symbols.h version.h shlib-versions rpm/Makefile	\
+		rpm/template rpm/rpmrc abi-tags stub-tag.h		\
+		test-skeleton.c include/des.h FAQ.in glibcbug.in	\
+		$(addprefix scripts/,					\
+			rellns-sh config.sub config.guess printsources	\
+			mkinstalldirs move-if-change install-sh	=__ify	\
+			test-installation.pl gen-FAQ.pl tarprefix.c	\
+			fixpatch subdir-dist unT.c)
+
+experimental-only = README-alpha
+
+include Makeconfig
+
+install-others = $(inst_includedir)/gnu/stubs.h
+install-bin = glibcbug
+
+ifeq (yes,$(build-shared))
+install-others += $(inst_includedir)/gnu/lib-names.h
+endif
+
+common-mostlyclean = $(foreach o,$(object-suffixes-for-libc),\
+		   $(common-objpfx)$(patsubst %,$(libtype$o),c))
+common-generated = sysd-Makefile sysd-dirs sysd-rules soversions.mk
+config-generated = config.status config.cache config.log config.make \
+		   config-name.h config.h Makefile
+
+include Rules
+
+# Build the libc archives in here.
+lib:  $(foreach l,$(libtypes),$(patsubst %,$(common-objpfx)$l,c))
+
+# These depend on stamp files written by Makerules in the subdirs.
+# They always destroy and recreate the archive from scratch, which is
+# faster (due to design limitations in the ar file format).
+define o-iterator-doit
+$(common-objpfx)$(patsubst %,$(libtype$o),c): $(subdirs-stamp-o);
+	$$(do-makelib)
+endef
+define do-makelib
+cd $(common-objdir) && \
+$(AR) $(ARFLAGS) $(@F)T `cat $(patsubst $(common-objpfx)%,%,$^)`
+$(RANLIB) $@T
+mv -f $@T $@
+endef
+subdirs-stamps := $(foreach d,$(config-subdirs),$(common-objpfx)$d/stamp%)
+subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
+object-suffixes-left = $(object-suffixes-for-libc)
+include $(o-iterator)
+
+ifeq ($(build-shared),yes)
+lib: $(objpfx)libc.so$(libc.so-version)
+
+# Don't try to use -lc when making libc.so itself.
+# Also omits crti.o and crtn.o, which we do not want
+# since we define our own `.init' section specially.
+LDFLAGS-c.so = -nostdlib -nostartfiles
+# But we still want to link libc.so against $(gnulib).
+LDLIBS-c.so = $(gnulib)
+# Give libc.so an entry point and make it directly runnable itself.
+LDFLAGS-c.so += -e __libc_main
+# Pre-link the objects of libc_pic.a so that we can locally resolve
+# COMMON symbols before we link against ld.so.  This is because ld.so
+# contains some of libc_pic.a already, which will prevent the COMMONs
+# from being allocated in libc.so, which introduces evil dependencies
+# between libc.so and ld.so, which can make it impossible to upgrade.
+$(objpfx)libc_pic.os: $(objpfx)libc_pic.a
+	$(LINK.o) -nostdlib -nostartfiles -r -o $@ \
+	-Wl,-d -Wl,--whole-archive $^
+# Use our own special initializer and finalizer files for libc.so.
+$(objpfx)libc.so: $(elfobjdir)/soinit.os $(elfobjdir)/interp.os \
+			 $(objpfx)libc_pic.os \
+			 $(elfobjdir)/sofini.os $(elfobjdir)/ld.so \
+			 $(..)libc.map
+	$(build-shlib)
+common-generated += libc.so libc_pic.os
+ifdef libc.so-version
+$(objpfx)libc.so$(libc.so-version): $(common-objpfx)libc.so
+	$(make-link)
+common-generated += libc.so$(libc.so-version)
+endif
+endif
+
+others: $(common-objpfx)gnu/stubs.h
+# Makerules creates a file `stubs' in each subdirectory, which
+# contains `#define __stub_FUNCTION' for each function defined in that
+# directory which is a stub.
+# Here we paste all of these together into <gnu/stubs.h>.
+
+subdir-stubs := $(wildcard $(foreach dir,$(config-subdirs),$(common-objpfx)$(dir)/stubs))
+$(common-objpfx)gnu/stubs.h: $(subdir-stubs)
+	$(make-target-directory)
+	(echo '/* This file is automatically generated.';\
+	 echo '   It defines a symbol `__stub_FUNCTION'\'' for each function';\
+	 echo '   in the C library which is a stub, meaning it will fail';\
+	 echo '   every time called, usually setting errno to ENOSYS.  */';\
+	 sort $(subdir-stubs)) > $@T
+	$(move-if-change) $@T $@
+
+$(install-others): $(inst_includedir)/gnu/%: $(common-objpfx)gnu/% $(+force)
+	$(do-install)
+
+# Special rules to install libc itself.  This requires magic: when
+# shared libraries are in use, there are runtime dependencies between
+# libc.so, ld.so, and libdl.so.  Therefore all three must be installed
+# with great care.
+# We do it by installing these three to foobar.so-new and then renaming
+# them into place with a statically linked, specialized `mv'.
+# This paranoia isn't necessary when prefix != /usr or install_root is
+# nonempty, but let's not make this even worse than it is.
+
+# The simple library name to install libc.a under.
+# This could be defined by a sysdep Makefile.
+ifndef libc-name
+libc-name := c
+endif
+
+installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
+			     $(inst_libdir)/$(patsubst %,$(libtype$o),\
+						     $(libprefix)$(libc-name)))
+install: $(installed-libcs)
+$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: \
+		$(common-objpfx)lib$(libprefix)% $(+force)
+	$(make-target-directory)
+	$(INSTALL_DATA) $(common-objpfx)lib$(*:$(libc-name)%=c%) $@
+# Running ranlib after installing makes the __.SYMDEF time stamp up to
+# date, which avoids messages from some linkers.
+	$(RANLIB) $@
+
+ifeq ($(build-shared),yes)
+
+install: $(inst_libdir)/libc.so $(inst_libdir)/libc_pic.a \
+		libc-final-install
+
+# With side effects...
+$(inst_slibdir)/lib$(libc-name)-$(version).so: $(objpfx)libc.so $(+force)
+	$(do-install-program)
+	-rm -f $(inst_slibdir)/lib$(libc-name).so$(libc.so-version)T
+	$(LN_S) $(@F) $(inst_slibdir)/lib$(libc-name).so$(libc.so-version)T
+
+$(inst_slibdir)/ld-$(version).so: $(elfobjdir)/ld.so $(+force)
+	$(do-install-program)
+	-rm -f $(inst_slibdir)/$(rtld-installed-name)T
+	$(LN_S) $(@F) $(inst_slibdir)/$(rtld-installed-name)T
+
+$(inst_slibdir)/libdl-$(version).so: $(elfobjdir)/libdl.so $(+force)
+	$(do-install-program)
+	-rm -f $(inst_slibdir)/libdl.so$(libdl.so-version)T
+	$(LN_S) $(@F) $(inst_slibdir)/libdl.so$(libdl.so-version)T
+	-rm -f $(inst_slibdir)/libdl.so
+	$(LN_S) libdl.so$(libdl.so-version) $(inst_slibdir)/libdl.so
+
+# What we install as libc.so for programs to link against is in fact a
+# link script.  It contains references for the various libraries we need.
+# The libc.so object is not complete since some functions are only defined
+# in libc_nonshared.a.
+$(inst_libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \
+			$(inst_libdir)/$(patsubst %,$(libtype.oS),\
+						  $(libprefix)$(libc-name)) \
+			$(+force)
+	(echo '/* GNU ld script';\
+	 echo '   Use the shared library, but some functions are only in';\
+	 echo '   the static library, so try that secondarily.  */';\
+	 echo 'GROUP ( $(slibdir)/libc.so$(libc.so-version)' \
+	      '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\
+	      ')' \
+	) > $@.new
+	mv -f $@.new $@
+
+$(inst_libdir)/libc_pic.a: $(common-objpfx)libc_pic.a
+	$(do-install)
+
+libc-final-install:	$(inst_slibdir)/ld-$(version).so \
+			$(inst_slibdir)/lib$(libc-name)-$(version).so \
+			$(inst_slibdir)/libdl-$(version).so \
+			$(common-objpfx)unT
+	$(common-objpfx)unT \
+		$(inst_slibdir)/$(rtld-installed-name)T \
+		$(inst_slibdir)/lib$(libc-name).so$(libc.so-version)T \
+		$(inst_slibdir)libdl.so$(libdl.so-version)T
+
+$(common-objpfx)unT: scripts/unT.c
+	$(BUILD_CC) -static -O2 -g -Wall $< -o $@
+
+endif
+
+# Called by Make-dist.
+dist: COPYING README INSTALL NOTES FAQ
+
+ifeq ($(with-cvs),yes)
+define cvs-commit
+-chmod a-w $@
+test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release) $(version)' $@
+endef
+else
+define cvs-commit
+-chmod a-w $@
+endef
+endif
+
+README: README.template version.h
+	sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' $< > $@.T
+	mv -f $@.T $@
+	$(cvs-commit)
+
+define format-me
+@rm -f $@
+makeinfo --no-validate --no-warn --no-headers $< -o $@
+$(cvs-commit)
+endef
+INSTALL: manual/install.texi; $(format-me)
+NOTES: manual/creature.texi; $(format-me)
+COPYING: manual/lgpl.texinfo; $(format-me)
+FAQ: scripts/gen-FAQ.pl FAQ.in
+	$(PERL) $^ > $@.T
+	mv -f $@.T $@
+	$(cvs-commit)
+
!END!OF!PATCH!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]