summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2014-02-26 23:12:03 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-02-26 23:12:03 +0000
commita5f891ac8df09e56ecc64bf18a839a06470deacd (patch)
tree65e83dc43392aabcf709d3a01c2940e12ef6bab7
parentcf822e3c94c2cdec736cdf7b503790b17179afcd (diff)
downloadglibc-a5f891ac8df09e56ecc64bf18a839a06470deacd.tar.gz
glibc-a5f891ac8df09e56ecc64bf18a839a06470deacd.tar.xz
glibc-a5f891ac8df09e56ecc64bf18a839a06470deacd.zip
Consistently include Makeconfig after defining subdir.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I
noted it was necessary to add includes of Makeconfig early in various
subdirectory makefiles for the tests-special variable settings added
by that patch to be conditional on configuration information.  No-one
commented on the general question there of whether Makeconfig should
always be included immediately after the definition of subdir.

This patch implements that early inclusion of Makeconfig in each
directory (which is a lot easier than consistent placement of includes
of Rules).  Includes are added if needed, or moved up if already
present.  Subdirectory "all:" targets are removed, since Makeconfig
provides one.

There is potential for further cleanups I haven't done.  Rules and
Makerules have code such as

ifneq   "$(findstring env,$(origin headers))" ""
headers :=
endif

to override to empty any value of various variables that came from the
environment.  I think there is a case for Makeconfig setting all the
subdirectory variables (other than subdir) to empty to ensure no
outside value is going to take effect if a subdirectory fails to
define a variable.  (A list of such variables, possibly out of date
and incomplete, is in manual/maint.texi.)  Rules and Makerules would
give errors if Makeconfig hadn't already been included, instead of
including it themselves.  The special code to override values coming
from the environment would then be obsolete and could be removed.

Tested x86_64, including that installed binaries are identical before
and after the patch.

	* argp/Makefile: Include Makeconfig immediately after defining
	subdir.
	* assert/Makefile: Likewise.
	* benchtests/Makefile: Likewise.
	* catgets/Makefile: Likewise.
	* conform/Makefile: Likewise.
	* crypt/Makefile: Likewise.
	* csu/Makefile: Likewise.
	(all): Remove target.
	* ctype/Makefile: Include Makeconfig immediately after defining
	subdir.
	* debug/Makefile: Likewise.
	* dirent/Makefile: Likewise.
	* dlfcn/Makefile: Likewise.
	* gmon/Makefile: Likewise.
	* gnulib/Makefile: Likewise.
	* grp/Makefile: Likewise.
	* gshadow/Makefile: Likewise.
	* hesiod/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	(all): Remove target.
	* iconvdata/Makefile: Include Makeconfig immediately after
	defining subdir.
	* inet/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* io/Makefile: Likewise.
	* libio/Makefile: Likewise.
	(all): Remove target.
	* locale/Makefile: Include Makeconfig immediately after defining
	subdir.
	* login/Makefile: Likewise.
	* mach/Makefile: Likewise.
	(all): Remove target.
	* malloc/Makefile: Include Makeconfig immediately after defining
	subdir.
	(all): Remove target.
	* manual/Makefile: Include Makeconfig immediately after defining
	subdir.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* po/Makefile: Likewise.
	(all): Remove target.
	* posix/Makefile: Include Makeconfig immediately after defining
	subdir.
	* pwd/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* rt/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* shadow/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* soft-fp/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* streams/Makefile: Likewise.
	* string/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	(all): Remove target.
	* sysvipc/Makefile: Include Makeconfig immediately after defining
	subdir.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* timezone/Makefile: Likewise.
	(all): Remove target.
	* wcsmbs/Makefile: Include Makeconfig immediately after defining
	subdir.
	* wctype/Makefile: Likewise.

libidn/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

localedata/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
	(all): Remove target.

nptl/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

nptl_db/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
-rw-r--r--ChangeLog73
-rw-r--r--argp/Makefile2
-rw-r--r--assert/Makefile3
-rw-r--r--benchtests/Makefile4
-rw-r--r--catgets/Makefile2
-rw-r--r--conform/Makefile2
-rw-r--r--crypt/Makefile4
-rw-r--r--csu/Makefile6
-rw-r--r--ctype/Makefile3
-rw-r--r--debug/Makefile4
-rw-r--r--dirent/Makefile2
-rw-r--r--dlfcn/Makefile5
-rw-r--r--gmon/Makefile4
-rw-r--r--gnulib/Makefile2
-rw-r--r--grp/Makefile5
-rw-r--r--gshadow/Makefile2
-rw-r--r--hesiod/Makefile2
-rw-r--r--hurd/Makefile4
-rw-r--r--iconvdata/Makefile4
-rw-r--r--inet/Makefile2
-rw-r--r--intl/Makefile5
-rw-r--r--io/Makefile2
-rw-r--r--libidn/ChangeLog4
-rw-r--r--libidn/Makefile5
-rw-r--r--libio/Makefile6
-rw-r--r--locale/Makefile2
-rw-r--r--localedata/ChangeLog5
-rw-r--r--localedata/Makefile5
-rw-r--r--login/Makefile4
-rw-r--r--mach/Makefile4
-rw-r--r--malloc/Makefile4
-rw-r--r--manual/Makefile5
-rw-r--r--math/Makefile4
-rw-r--r--misc/Makefile4
-rw-r--r--nis/Makefile4
-rw-r--r--nptl/ChangeLog4
-rw-r--r--nptl/Makefile4
-rw-r--r--nptl_db/ChangeLog4
-rw-r--r--nptl_db/Makefile2
-rw-r--r--nss/Makefile4
-rw-r--r--po/Makefile6
-rw-r--r--posix/Makefile4
-rw-r--r--pwd/Makefile3
-rw-r--r--resolv/Makefile4
-rw-r--r--resource/Makefile2
-rw-r--r--rt/Makefile2
-rw-r--r--setjmp/Makefile2
-rw-r--r--shadow/Makefile2
-rw-r--r--signal/Makefile2
-rw-r--r--socket/Makefile2
-rw-r--r--soft-fp/Makefile2
-rw-r--r--stdio-common/Makefile4
-rw-r--r--stdlib/Makefile4
-rw-r--r--streams/Makefile2
-rw-r--r--string/Makefile2
-rw-r--r--sunrpc/Makefile6
-rw-r--r--sysvipc/Makefile2
-rw-r--r--termios/Makefile2
-rw-r--r--time/Makefile2
-rw-r--r--timezone/Makefile6
-rw-r--r--wcsmbs/Makefile2
-rw-r--r--wctype/Makefile2
62 files changed, 205 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index 157649be53..4ef5ccc317 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,76 @@
+2014-02-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* argp/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* assert/Makefile: Likewise.
+	* benchtests/Makefile: Likewise.
+	* catgets/Makefile: Likewise.
+	* conform/Makefile: Likewise.
+	* crypt/Makefile: Likewise.
+	* csu/Makefile: Likewise.
+	(all): Remove target.
+	* ctype/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* debug/Makefile: Likewise.
+	* dirent/Makefile: Likewise.
+	* dlfcn/Makefile: Likewise.
+	* gmon/Makefile: Likewise.
+	* gnulib/Makefile: Likewise.
+	* grp/Makefile: Likewise.
+	* gshadow/Makefile: Likewise.
+	* hesiod/Makefile: Likewise.
+	* hurd/Makefile: Likewise.
+	(all): Remove target.
+	* iconvdata/Makefile: Include Makeconfig immediately after
+	defining subdir.
+	* inet/Makefile: Likewise.
+	* intl/Makefile: Likewise.
+	* io/Makefile: Likewise.
+	* libio/Makefile: Likewise.
+	(all): Remove target.
+	* locale/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* login/Makefile: Likewise.
+	* mach/Makefile: Likewise.
+	(all): Remove target.
+	* malloc/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	(all): Remove target.
+	* manual/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* math/Makefile: Likewise.
+	* misc/Makefile: Likewise.
+	* nis/Makefile: Likewise.
+	* nss/Makefile: Likewise.
+	* po/Makefile: Likewise.
+	(all): Remove target.
+	* posix/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* pwd/Makefile: Likewise.
+	* resolv/Makefile: Likewise.
+	* resource/Makefile: Likewise.
+	* rt/Makefile: Likewise.
+	* setjmp/Makefile: Likewise.
+	* shadow/Makefile: Likewise.
+	* signal/Makefile: Likewise.
+	* socket/Makefile: Likewise.
+	* soft-fp/Makefile: Likewise.
+	* stdio-common/Makefile: Likewise.
+	* stdlib/Makefile: Likewise.
+	* streams/Makefile: Likewise.
+	* string/Makefile: Likewise.
+	* sunrpc/Makefile: Likewise.
+	(all): Remove target.
+	* sysvipc/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* termios/Makefile: Likewise.
+	* time/Makefile: Likewise.
+	* timezone/Makefile: Likewise.
+	(all): Remove target.
+	* wcsmbs/Makefile: Include Makeconfig immediately after defining
+	subdir.
+	* wctype/Makefile: Likewise.
+
 2014-02-26  Steve Ellcey  <sellcey@mips.com>
 
 	* sysdeps/mips/math_private.h (_FPU_MASK_ALL) New.
diff --git a/argp/Makefile b/argp/Makefile
index 35f1088a26..997424e2f8 100644
--- a/argp/Makefile
+++ b/argp/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= argp
 
+include ../Makeconfig
+
 headers		= argp.h
 routines	= $(addprefix argp-, ba fmtstream fs-xinl help parse pv \
 				     pvh xinl eexst)
diff --git a/assert/Makefile b/assert/Makefile
index 60ec53d001..97fb476cd6 100644
--- a/assert/Makefile
+++ b/assert/Makefile
@@ -19,6 +19,9 @@
 #	Sub-makefile for assert portion of the library.
 #
 subdir	:= assert
+
+include ../Makeconfig
+
 headers	:= assert.h
 
 routines := assert assert-perr __assert
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 8bfb03917e..55d957af35 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -20,6 +20,9 @@
 # Add benchmark functions in alphabetical order.
 
 subdir := benchtests
+
+include ../Makeconfig
+
 bench := acos acosh asin asinh atan atanh cos cosh exp exp2 log log2 modf pow \
 	 rint sin sincos sinh sqrt tan tanh
 
@@ -65,7 +68,6 @@ LDLIBS-bench-sincos = -lm
 # affect their performance.
 .NOTPARALLEL:
 
-include ../Makeconfig
 include ../Rules
 
 binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
diff --git a/catgets/Makefile b/catgets/Makefile
index 7c2a1170e1..899d929db6 100644
--- a/catgets/Makefile
+++ b/catgets/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= catgets
 
+include ../Makeconfig
+
 headers		= nl_types.h
 routines	= catgets open_catalog
 others		= gencat
diff --git a/conform/Makefile b/conform/Makefile
index 0761a1c294..41f0bb3f57 100644
--- a/conform/Makefile
+++ b/conform/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= conform
 
+include ../Makeconfig
+
 include ../Rules
 
 ifneq (yes,$(fast-check))
diff --git a/crypt/Makefile b/crypt/Makefile
index 9f69ecbdb7..b1645dee55 100644
--- a/crypt/Makefile
+++ b/crypt/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= crypt
 
+include ../Makeconfig
+
 headers := crypt.h
 
 extra-libs := libcrypt
@@ -30,8 +32,6 @@ libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
 
 tests := cert md5c-test sha256c-test sha512c-test badsalttest
 
-include ../Makeconfig
-
 ifeq ($(crypt-in-libc),yes)
 routines += $(libcrypt-routines)
 endif
diff --git a/csu/Makefile b/csu/Makefile
index b5afea0dec..ebd4b4efed 100644
--- a/csu/Makefile
+++ b/csu/Makefile
@@ -24,6 +24,8 @@
 
 subdir := csu
 
+include ../Makeconfig
+
 routines = init-first libc-start $(libc-init) sysdep version check_fds \
 	   libc-tls elf-init dso_handle
 aux	 = errno
@@ -43,10 +45,6 @@ before-compile = $(objpfx)version-info.h
 tests := tst-empty tst-atomic tst-atomic-long
 tests-static := tst-empty
 
-all: # Make this the default target; it will be defined in Rules.
-
-include ../Makeconfig
-
 ifeq (yes,$(build-shared))
 extra-objs += S$(start-installed-name)
 install-lib += S$(start-installed-name)
diff --git a/ctype/Makefile b/ctype/Makefile
index 7bfc928425..8a41f9c499 100644
--- a/ctype/Makefile
+++ b/ctype/Makefile
@@ -19,6 +19,9 @@
 #	Sub-makefile for ctype portion of the library.
 #
 subdir	:= ctype
+
+include ../Makeconfig
+
 headers	:= ctype.h
 
 routines	:= ctype ctype-extn ctype_l isctype
diff --git a/debug/Makefile b/debug/Makefile
index fc15ef3aec..963460ecf9 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= debug
 
+include ../Makeconfig
+
 headers	:= execinfo.h
 
 # Note that ptsname_r_chk and getlogin_r are not here, but in
@@ -161,8 +163,6 @@ others = pcprofiledump
 install-bin = pcprofiledump
 install-bin-script = xtrace
 
-include ../Makeconfig
-
 ifeq ($(build-shared),yes)
 install-bin-script += catchsegv
 endif
diff --git a/dirent/Makefile b/dirent/Makefile
index a67d2e6f20..c9bd5dd62c 100644
--- a/dirent/Makefile
+++ b/dirent/Makefile
@@ -20,6 +20,8 @@
 #
 subdir		:= dirent
 
+include ../Makeconfig
+
 headers		:= dirent.h bits/dirent.h
 routines	:= opendir closedir readdir readdir_r rewinddir \
 		   seekdir telldir scandir alphasort versionsort \
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index bf20063902..39f18d7c7b 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -16,6 +16,9 @@
 # <http://www.gnu.org/licenses/>.
 
 subdir		:= dlfcn
+
+include ../Makeconfig
+
 headers		:= bits/dlfcn.h dlfcn.h
 extra-libs	:= libdl
 libdl-routines	:= dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \
@@ -25,8 +28,6 @@ elide-routines.os := $(routines)
 
 extra-libs-others := libdl
 
-include ../Makeconfig
-
 ifeq ($(build-shared),yes)
 libdl-routines	+= dlopenold
 libdl-shared-only-routines := dlopenold dlfcn
diff --git a/gmon/Makefile b/gmon/Makefile
index b069fbdfde..a82db98418 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -20,13 +20,13 @@
 #
 subdir	:= gmon
 
+include ../Makeconfig
+
 headers	:= sys/gmon.h sys/gmon_out.h sys/profil.h
 routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq
 
 elide-routines.os = bb_init_func bb_exit_func
 
-include ../Makeconfig
-
 tests	= tst-sprofil
 ifeq ($(build-profile),yes)
 tests	+= tst-profile-static
diff --git a/gnulib/Makefile b/gnulib/Makefile
index e767570dcd..69c1e850bc 100644
--- a/gnulib/Makefile
+++ b/gnulib/Makefile
@@ -17,6 +17,8 @@
 
 subdir := gnulib
 
+include ../Makeconfig
+
 # Maybe this is the right place for a test of gcc's interface.
 tests = tst-gcc
 
diff --git a/grp/Makefile b/grp/Makefile
index b8d1d81db5..3ed8471fdd 100644
--- a/grp/Makefile
+++ b/grp/Makefile
@@ -19,14 +19,15 @@
 #	Sub-makefile for grp portion of the library.
 #
 subdir	:= grp
+
+include ../Makeconfig
+
 headers := grp.h
 
 routines := fgetgrent initgroups setgroups \
 	    getgrent getgrgid getgrnam putgrent \
 	    getgrent_r getgrgid_r getgrnam_r fgetgrent_r
 
-include ../Makeconfig
-
 tests := testgrp
 
 ifeq (yes,$(build-shared))
diff --git a/gshadow/Makefile b/gshadow/Makefile
index 213da06e99..1b41eabd0f 100644
--- a/gshadow/Makefile
+++ b/gshadow/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= gshadow
 
+include ../Makeconfig
+
 headers		= gshadow.h
 routines	= getsgent getsgnam sgetsgent fgetsgent putsgent \
 		  getsgent_r getsgnam_r sgetsgent_r fgetsgent_r
diff --git a/hesiod/Makefile b/hesiod/Makefile
index b640cec8f2..19952af65a 100644
--- a/hesiod/Makefile
+++ b/hesiod/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= hesiod
 
+include ../Makeconfig
+
 extra-libs := libnss_hesiod
 extra-libs-others = $(extra-libs)
 
diff --git a/hurd/Makefile b/hurd/Makefile
index fb334d8ab5..b9f23f01c1 100644
--- a/hurd/Makefile
+++ b/hurd/Makefile
@@ -17,12 +17,8 @@
 
 subdir := hurd
 
-all:
-
-# Some things below (but before including Rules) use configuration variables.
 include ../Makeconfig
 
-
 headers = hurd.h $(interface-headers) \
 	  $(addprefix hurd/,fd.h id.h port.h signal.h sigpreempt.h ioctl.h\
 			    userlink.h resource.h threadvar.h lookup.h)
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
index 3a355208be..01f50d2ac7 100644
--- a/iconvdata/Makefile
+++ b/iconvdata/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= iconvdata
 
+include ../Makeconfig
+
 # Names of all the shared objects which implement the transformations.
 modules	:= ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5		 \
 	   ISO8859-6 ISO8859-7 ISO8859-8 ISO8859-9 ISO8859-10		 \
@@ -63,8 +65,6 @@ modules	:= ISO8859-1 ISO8859-2 ISO8859-3 ISO8859-4 ISO8859-5		 \
 
 modules.so := $(addsuffix .so, $(modules))
 
-include ../Makeconfig
-
 ifeq (yes,$(build-shared))
 tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
 	tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9
diff --git a/inet/Makefile b/inet/Makefile
index f4c3273916..2f1186fa1b 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= inet
 
+include ../Makeconfig
+
 headers	:= netinet/ether.h netinet/in.h netinet/in_systm.h \
 	   netinet/if_ether.h netinet/igmp.h \
 	   netinet/tcp.h netinet/ip.h $(wildcard arpa/*.h protocols/*.h) \
diff --git a/intl/Makefile b/intl/Makefile
index 8a96a857f1..b21f4d9295 100644
--- a/intl/Makefile
+++ b/intl/Makefile
@@ -18,14 +18,15 @@
 # Makefile for intl subdirectory: message handling code from GNU gettext.
 
 subdir = intl
+
+include ../Makeconfig
+
 headers = libintl.h
 routines = bindtextdom dcgettext dgettext gettext	\
 	   dcigettext dcngettext dngettext ngettext \
 	   finddomain loadmsgcat localealias textdomain
 aux =	   l10nflist explodename plural plural-exp hash-string
 
-include ../Makeconfig
-
 multithread-test-srcs := tst-gettext4 tst-gettext5 tst-gettext6
 test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3
 ifeq ($(have-thread-library),yes)
diff --git a/io/Makefile b/io/Makefile
index bb32b86eef..8d38612b06 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= io
 
+include ../Makeconfig
+
 headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
 	   sys/statvfs.h bits/statvfs.h fcntl.h sys/fcntl.h bits/fcntl.h \
 	   poll.h sys/poll.h bits/poll.h bits/fcntl2.h bits/poll2.h \
diff --git a/libidn/ChangeLog b/libidn/ChangeLog
index e8130bb5b4..7a48fd5c6d 100644
--- a/libidn/ChangeLog
+++ b/libidn/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile: Include Makeconfig immediately after defining subdir.
+
 2013-10-30  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.in: Moved to ...
diff --git a/libidn/Makefile b/libidn/Makefile
index 542840d947..a40f08e9fd 100644
--- a/libidn/Makefile
+++ b/libidn/Makefile
@@ -19,6 +19,8 @@
 
 subdir	:= libidn
 
+include ../Makeconfig
+
 routines = idn-stub
 
 extra-libs		= libcidn
@@ -27,9 +29,6 @@ extra-libs-others	= $(extra-libs)
 libcidn-routines := punycode toutf8 nfkc stringprep rfc3454 profiles idna \
 		    iconvme
 
-
-include $(..)Makeconfig
-
 libcidn-inhibit-o = $(filter-out .os,$(object-suffixes))
 
 include $(..)Rules
diff --git a/libio/Makefile b/libio/Makefile
index 9bbe71259d..fb6ec70d20 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= libio
 
+include ../Makeconfig
+
 headers	:= stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
 	   bits/sys_errlist.h bits/stdio2.h bits/stdio-ldbl.h bits/libio-ldbl.h
 
@@ -46,8 +48,6 @@ routines	:=							      \
 									      \
 	libc_fatal fmemopen
 
-include ../Makeconfig
-
 tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
 	tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 \
 	tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-swscanf tst-sscanf	      \
@@ -68,8 +68,6 @@ tests += tst-fopenloc
 endif
 test-srcs = test-freopen
 
-all: # Make this the default target; it will be defined in Rules.
-
 ifeq ($(build-shared),yes)
 routines += oldiofopen oldiofdopen oldiofclose oldiopopen oldpclose \
 	    oldtmpfile oldiofgetpos oldiofgetpos64 oldiofsetpos	    \
diff --git a/locale/Makefile b/locale/Makefile
index 51b383afa8..eeff2cbd78 100644
--- a/locale/Makefile
+++ b/locale/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= locale
 
+include ../Makeconfig
+
 headers		= locale.h bits/locale.h langinfo.h xlocale.h
 routines	= setlocale findlocale loadlocale loadarchive \
 		  localeconv nl_langinfo nl_langinfo_l mb_cur_max \
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 1857fc1f81..2bd966dc1f 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile: Include Makeconfig immediately after defining subdir.
+	(all): Remove target.
+
 2014-02-21  Joseph Myers  <joseph@codesourcery.com>
 
 	* Makefile ($(objpfx)sort-test.out): Use $(evaluate-test).
diff --git a/localedata/Makefile b/localedata/Makefile
index a69ec41aee..881337452e 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -19,7 +19,7 @@
 
 subdir := localedata
 
-all: # Make this the default target; it will be defined in Rules.
+include ../Makeconfig
 
 # List with all available character set descriptions.
 charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
@@ -56,9 +56,6 @@ generated := $(test-input) $(test-output) sort-test.out tst-locale.out \
 generated-dirs := $(ld-test-names) tt_TT de_DE.437			\
 		  $(addprefix tstfmon_,$(fmon-tests))			\
 
-# Get $(inst_i18ndir) defined.
-include ../Makeconfig
-
 ifeq ($(run-built-tests),yes)
 locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl            \
 		     tst_iswctype tst_iswdigit tst_iswgraph            \
diff --git a/login/Makefile b/login/Makefile
index 91947024e6..ca55808127 100644
--- a/login/Makefile
+++ b/login/Makefile
@@ -21,6 +21,8 @@
 
 subdir	:= login
 
+include ../Makeconfig
+
 headers	:= utmp.h bits/utmp.h lastlog.h pty.h
 
 routines := getlogin getlogin_r setlogin getlogin_r_chk \
@@ -32,8 +34,6 @@ CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
 
 others = utmpdump
 
-include ../Makeconfig
-
 ifeq (yes,$(build-pt-chown))
 others += pt_chown
 others-pie = pt_chown
diff --git a/mach/Makefile b/mach/Makefile
index c804fa30c4..c316e7a942 100644
--- a/mach/Makefile
+++ b/mach/Makefile
@@ -17,12 +17,8 @@
 
 subdir := mach
 
-all:
-
-# Some things below (but before including Rules) use configuration variables.
 include ../Makeconfig
 
-
 headers = mach_init.h mach.h mach_error.h mach-shortcuts.h mach/mach_traps.h \
 	  $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
 	  $(lock-headers) machine-sp.h
diff --git a/malloc/Makefile b/malloc/Makefile
index d2d3c8e0a1..12b4ec6b43 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -20,7 +20,7 @@
 #
 subdir	:= malloc
 
-all:
+include ../Makeconfig
 
 dist-headers := malloc.h
 headers := $(dist-headers) obstack.h mcheck.h
@@ -48,8 +48,6 @@ extra-objs = mcheck-init.o libmcheck.a
 # Include the cleanup handler.
 aux := set-freeres thread-freeres
 
-include ../Makeconfig
-
 CPPFLAGS-memusagestat = -DNOT_IN_libc
 
 # The Perl script to analyze the output of the mtrace functions.
diff --git a/manual/Makefile b/manual/Makefile
index 1129136c89..5c62f9a95d 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -19,14 +19,13 @@
 
 subdir := manual
 
+include ../Makeconfig
+
 # Allow override
 INSTALL_INFO = install-info
 
 .PHONY: dvi pdf info html
 
-# Get glibc's configuration info.
-include ../Makeconfig
-
 dvi: $(objpfx)libc.dvi
 pdf: $(objpfx)libc.pdf
 
diff --git a/math/Makefile b/math/Makefile
index cc27935acd..09d14a0dcd 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -19,6 +19,8 @@
 
 subdir		:= math
 
+include ../Makeconfig
+
 # Installed header files.
 headers		:= math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
 		   bits/huge_valf.h bits/huge_vall.h bits/inf.h bits/nan.h \
@@ -61,8 +63,6 @@ libm-calls = e_acos e_acosh e_asin e_atan2 e_atanh e_cosh e_exp e_fmod	\
 	     s_isinf_ns s_issignaling $(calls:s_%=m_%) x2y2m1 k_casinh	\
 	     gamma_product
 
-include ../Makeconfig
-
 dbl-only-routines := branred doasin dosincos halfulp mpa mpatan2	\
 		     mpatan mpexp mplog mpsqrt mptan sincos32 slowexp	\
 		     slowpow sincostab
diff --git a/misc/Makefile b/misc/Makefile
index 66d0ab7b18..1897f6c368 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -21,6 +21,8 @@
 
 subdir	:= misc
 
+include ../Makeconfig
+
 headers	:= sys/uio.h bits/uio.h sys/ioctl.h bits/ioctls.h bits/ioctl-types.h \
 	   sys/ptrace.h sys/file.h sys/dir.h sys/cdefs.h \
 	   ar.h a.out.h libgen.h stab.h bits/stab.def sgtty.h \
@@ -69,8 +71,6 @@ routines := brk sbrk sstk ioctl \
 
 generated := tst-error1.mtrace tst-error1-mem
 
-include ../Makeconfig
-
 aux := init-misc
 install-lib := libg.a
 gpl2lgpl := error.c error.h
diff --git a/nis/Makefile b/nis/Makefile
index 15f86baaa9..76886047aa 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -20,10 +20,10 @@
 #
 subdir	:= nis
 
-aux			:= nis_hash
-
 include ../Makeconfig
 
+aux			:= nis_hash
+
 ifeq ($(link-obsolete-rpc),yes)
 headers			:= $(wildcard rpcsvc/*.[hx])
 endif
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 793b662f4c..a1d0f11d4b 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile: Include Makeconfig immediately after defining subdir.
+
 2014-02-21  Joseph Myers  <joseph@codesourcery.com>
 
 	* Makefile ($(objpfx)tst-stack3-mem): Use $(evaluate-test).
diff --git a/nptl/Makefile b/nptl/Makefile
index 253e7dd293..d568e5d34d 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= nptl
 
+include ../Makeconfig
+
 headers := pthread.h semaphore.h bits/semaphore.h
 
 extra-libs := libpthread
@@ -282,8 +284,6 @@ LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
 CFLAGS-tst-cleanup2.c = -fno-builtin
 CFLAGS-tst-cleanupx2.c = -fno-builtin
 
-include ../Makeconfig
-
 ifeq ($(have-forced-unwind),yes)
 tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
 	 tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \
diff --git a/nptl_db/ChangeLog b/nptl_db/ChangeLog
index f4787ee2d8..85cf2ba7a1 100644
--- a/nptl_db/ChangeLog
+++ b/nptl_db/ChangeLog
@@ -1,3 +1,7 @@
+2014-02-26  Joseph Myers  <joseph@codesourcery.com>
+
+	* Makefile: Include Makeconfig immediately after defining subdir.
+
 2014-02-21  Joseph Myers  <joseph@codesourcery.com>
 
 	* Makefile ($(objpfx)db-symbols.out): Use
diff --git a/nptl_db/Makefile b/nptl_db/Makefile
index 5d20dd5427..f321b539dc 100644
--- a/nptl_db/Makefile
+++ b/nptl_db/Makefile
@@ -19,6 +19,8 @@
 
 subdir          := nptl_db
 
+include ../Makeconfig
+
 nptl_db-version = 1.0
 
 extra-libs = libthread_db
diff --git a/nss/Makefile b/nss/Makefile
index c8880c061c..1fa7f1f397 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= nss
 
+include ../Makeconfig
+
 headers			:= nss.h
 
 # This is the trivial part which goes into libc itself.
@@ -40,8 +42,6 @@ extra-objs		+= $(makedb-modules:=.o)
 tests			= test-netdb tst-nss-test1 test-digits-dots
 xtests			= bug-erange
 
-include ../Makeconfig
-
 # Specify rules for the nss_* modules.  We have some services.
 services		:= files db
 
diff --git a/po/Makefile b/po/Makefile
index 99f28160d2..9d90f6bb1c 100644
--- a/po/Makefile
+++ b/po/Makefile
@@ -19,6 +19,8 @@
 
 subdir := po
 
+include ../Makeconfig
+
 # Add names of the languages with broken .po files here.
 BROKEN_LINGUAS =
 
@@ -36,10 +38,6 @@ endif
 # Text domain name to install under; must match ../locale/SYS_libc.c string.
 domainname = libc
 
-all: # Make this the default target; it will be defined in Rules.
-
-include ../Makeconfig
-
 # Pattern for where message catalog object for language % gets installed.
 mo-installed = $(inst_msgcatdir)/%/LC_MESSAGES/$(domainname).mo
 
diff --git a/posix/Makefile b/posix/Makefile
index ea06d392be..304238ffe8 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= posix
 
+include ../Makeconfig
+
 headers	:= sys/utsname.h sys/times.h sys/wait.h sys/types.h unistd.h	      \
 	   glob.h regex.h wordexp.h fnmatch.h getopt.h			      \
 	   bits/types.h bits/typesizes.h bits/pthreadtypes.h		      \
@@ -59,8 +61,6 @@ routines :=								      \
 	posix_madvise							      \
 	get_child_max sched_cpucount sched_cpualloc sched_cpufree
 
-include ../Makeconfig
-
 aux		:= init-posix environ
 tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-preadwrite tst-preadwrite64 test-vfork regexbug1 \
diff --git a/pwd/Makefile b/pwd/Makefile
index a19ddb5632..e063686cee 100644
--- a/pwd/Makefile
+++ b/pwd/Makefile
@@ -19,6 +19,9 @@
 #	Sub-makefile for pwd portion of the library.
 #
 subdir	:= pwd
+
+include ../Makeconfig
+
 headers := pwd.h
 
 routines := fgetpwent getpw putpwent \
diff --git a/resolv/Makefile b/resolv/Makefile
index 7a102cd443..9e4daee8c2 100644
--- a/resolv/Makefile
+++ b/resolv/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= resolv
 
+include ../Makeconfig
+
 headers	:= resolv.h \
 	   netdb.h bits/netdb.h \
 	   arpa/nameser.h arpa/nameser_compat.h \
@@ -33,8 +35,6 @@ xtests = tst-leaks2
 
 generate := mtrace-tst-leaks tst-leaks.mtrace tst-leaks2.mtrace
 
-include ../Makeconfig
-
 extra-libs := libresolv libnss_dns
 ifeq ($(have-thread-library),yes)
 extra-libs += libanl
diff --git a/resource/Makefile b/resource/Makefile
index 9441b2b2f5..6334b6ee18 100644
--- a/resource/Makefile
+++ b/resource/Makefile
@@ -17,6 +17,8 @@
 
 subdir := resource
 
+include ../Makeconfig
+
 headers	  := sys/resource.h bits/resource.h sys/vlimit.h sys/vtimes.h	\
 	     ulimit.h
 
diff --git a/rt/Makefile b/rt/Makefile
index 6e99da0ebb..875deb377c 100644
--- a/rt/Makefile
+++ b/rt/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= rt
 
+include ../Makeconfig
+
 headers	:= aio.h mqueue.h bits/mqueue.h bits/mqueue2.h
 
 aio-routines   := aio_cancel aio_error aio_fsync aio_misc aio_read	\
diff --git a/setjmp/Makefile b/setjmp/Makefile
index 285b90982c..fe0fb5dc6d 100644
--- a/setjmp/Makefile
+++ b/setjmp/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= setjmp
 
+include ../Makeconfig
+
 headers	:= setjmp.h bits/setjmp.h bits/setjmp2.h
 
 routines	:= setjmp sigjmp bsd-setjmp bsd-_setjmp \
diff --git a/shadow/Makefile b/shadow/Makefile
index c5cb358375..72ee8e438b 100644
--- a/shadow/Makefile
+++ b/shadow/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= shadow
 
+include ../Makeconfig
+
 headers		= shadow.h
 routines	= getspent getspnam sgetspent fgetspent putspent \
 		  getspent_r getspnam_r sgetspent_r fgetspent_r \
diff --git a/signal/Makefile b/signal/Makefile
index f9d5f715b9..427c7a1e6f 100644
--- a/signal/Makefile
+++ b/signal/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= signal
 
+include ../Makeconfig
+
 headers	:= signal.h sys/signal.h bits/signum.h bits/sigcontext.h \
 	   bits/sigaction.h bits/sigset.h bits/siginfo.h bits/sigstack.h \
 	   bits/sigthread.h
diff --git a/socket/Makefile b/socket/Makefile
index a297084cc7..b347693872 100644
--- a/socket/Makefile
+++ b/socket/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= socket
 
+include ../Makeconfig
+
 headers	:= sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
 	   bits/socket2.h sys/socketvar.h net/if.h
 
diff --git a/soft-fp/Makefile b/soft-fp/Makefile
index 8a7efa3dfd..b131309353 100644
--- a/soft-fp/Makefile
+++ b/soft-fp/Makefile
@@ -21,6 +21,8 @@
 #
 subdir	:= soft-fp
 
+include ../Makeconfig
+
 gcc-single-routines := negsf2 addsf3 subsf3 mulsf3 divsf3 eqsf2 \
 	lesf2 gesf2 unordsf2 fixsfsi fixunssfsi floatsisf fixsfdi        \
 	fixunssfdi floatdisf sqrtsf2 floatunsisf floatundisf
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index c401f25fbb..ba0bf64fc0 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= stdio-common
 
+include ../Makeconfig
+
 headers	:= stdio_ext.h printf.h bits/printf-ldbl.h bits/stdio_lim.h
 
 routines	:=							      \
@@ -39,8 +41,6 @@ routines	:=							      \
 	isoc99_vsscanf							      \
 	psiginfo
 
-include ../Makeconfig
-
 aux	:= errlist siglist printf-parsemb printf-parsewc fxprintf
 
 tests := tstscanf test_rdwr test-popen tstgetln test-fseek \
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 8e5623c89d..5f2c10cec2 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= stdlib
 
+include ../Makeconfig
+
 headers	:= stdlib.h bits/stdlib.h bits/stdlib-ldbl.h bits/stdlib-float.h      \
 	   monetary.h bits/monetary-ldbl.h				      \
 	   inttypes.h stdint.h bits/wordsize.h				      \
@@ -76,8 +78,6 @@ tests-static	:= tst-secure-getenv
 
 modules-names	= tst-tls-atexit-lib
 
-include ../Makeconfig
-
 ifeq ($(build-shared),yes)
 tests		+= tst-putenv
 endif
diff --git a/streams/Makefile b/streams/Makefile
index eeacd3ab50..9ae27048ae 100644
--- a/streams/Makefile
+++ b/streams/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= streams
 
+include ../Makeconfig
+
 headers		= stropts.h sys/stropts.h bits/stropts.h bits/xtitypes.h
 routines	= isastream getmsg getpmsg putmsg putpmsg fattach fdetach
 
diff --git a/string/Makefile b/string/Makefile
index 3759229587..543b5f68e4 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= string
 
+include ../Makeconfig
+
 headers	:= string.h strings.h memory.h endian.h bits/endian.h \
 	   argz.h envz.h byteswap.h bits/byteswap.h bits/byteswap-16.h \
 	   bits/string.h bits/string2.h bits/string3.h
diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index b36e3dd513..9ffcb23e97 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= sunrpc
 
+include ../Makeconfig
+
 # The code in this subdirectory is taken from Sun's RPCSRC-4.0
 # distribution with some additional changes from the TI-RPC package
 # which is also available from Sun.  The files are heavily changed to
@@ -58,8 +60,6 @@ generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
 	    $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
 generated-dirs := rpcsvc
 
-include ../Makeconfig
-
 ifeq ($(link-obsolete-rpc),yes)
 headers += $(headers-in-tirpc) $(headers-not-in-tirpc)
 endif
@@ -94,8 +94,6 @@ rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
 extra-objs = $(rpcgen-objs) $(addprefix cross-,$(rpcgen-objs))
 others += rpcgen
 
-all: # Make this the default target; it will be defined in Rules.
-
 tests = tst-xdrmem tst-xdrmem2
 xtests := tst-getmyaddr
 
diff --git a/sysvipc/Makefile b/sysvipc/Makefile
index dbf629aa92..fe23f0a27c 100644
--- a/sysvipc/Makefile
+++ b/sysvipc/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= sysvipc
 
+include ../Makeconfig
+
 headers	:= sys/ipc.h sys/msg.h sys/sem.h sys/shm.h \
 	   bits/ipctypes.h bits/ipc.h bits/msq.h bits/sem.h bits/shm.h
 
diff --git a/termios/Makefile b/termios/Makefile
index 446910dcdd..fc164029eb 100644
--- a/termios/Makefile
+++ b/termios/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= termios
 
+include ../Makeconfig
+
 headers	:= termios.h bits/termios.h sys/ttydefaults.h sys/termios.h \
 	   sys/ttychars.h
 
diff --git a/time/Makefile b/time/Makefile
index 227a4a0c44..b7f3dba784 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= time
 
+include ../Makeconfig
+
 headers	:= time.h sys/time.h sys/timeb.h bits/time.h
 
 routines := offtime asctime clock ctime ctime_r difftime \
diff --git a/timezone/Makefile b/timezone/Makefile
index 6c640fd144..a4ff4fe73c 100644
--- a/timezone/Makefile
+++ b/timezone/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= timezone
 
+include ../Makeconfig
+
 extra-objs := scheck.o ialloc.o
 
 others	:= zdump zic
@@ -38,10 +40,6 @@ install-sbin := zic zdump
 
 generated-dirs = testdata
 
-all: # Make this the default target; it will be defined in Rules.
-
-include ../Makeconfig	# Get objpfx defined so we can use it below.
-
 CPPFLAGS-zic = -DNOT_IN_libc
 
 install-bin-script = tzselect
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index c139b4fd30..197ca7d7e2 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= wcsmbs
 
+include ../Makeconfig
+
 headers	:= wchar.h bits/wchar.h bits/wchar2.h bits/wchar-ldbl.h uchar.h
 
 routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
diff --git a/wctype/Makefile b/wctype/Makefile
index 073cc0baee..ea9040ceb2 100644
--- a/wctype/Makefile
+++ b/wctype/Makefile
@@ -20,6 +20,8 @@
 #
 subdir	:= wctype
 
+include ../Makeconfig
+
 headers		:= wctype.h
 routines	:= wcfuncs wctype iswctype wctrans towctrans \
 		   wcfuncs_l wctype_l iswctype_l wctrans_l towctrans_l