? new
? o
Index: Makefile
===================================================================
RCS file: /cvsroot/src/share/mk/Makefile,v
retrieving revision 1.48
diff -u -p -u -r1.48 Makefile
--- Makefile	14 Jan 2014 18:51:45 -0000	1.48
+++ Makefile	15 Jan 2014 01:14:41 -0000
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.48 2014/01/14 18:51:45 christos Exp $
+#	$NetBSD: Makefile,v 1.47 2012/11/15 23:51:53 joerg Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/8/93
 
 NOOBJ=	# defined
@@ -7,8 +7,8 @@ NOOBJ=	# defined
 
 .if ${MKSHARE} != "no"
 FILES=	bsd.README bsd.buildinstall.mk bsd.clang-analyze.mk bsd.clean.mk \
-	bsd.dep.mk bsd.doc.mk bsd.endian.mk bsd.files.mk \
-	bsd.gcc.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \
+	bsd.dep.mk bsd.doc.mk bsd.endian.mk bsd.files.mk bsd.gcc.mk \
+	bsd.host.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \
 	bsd.init.mk bsd.ioconf.mk bsd.kernobj.mk bsd.kinc.mk bsd.klinks.mk \
 	bsd.kmodule.mk bsd.lib.mk bsd.links.mk bsd.lua.mk \
 	bsd.man.mk bsd.nls.mk \
Index: bsd.README
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.README,v
retrieving revision 1.325
diff -u -p -u -r1.325 bsd.README
--- bsd.README	14 Jan 2014 18:51:45 -0000	1.325
+++ bsd.README	15 Jan 2014 01:14:41 -0000
@@ -1750,11 +1750,81 @@ SUBDIR		For all of the directories liste
 		and other special sources.
 
 
+=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
+
+The include file <bsd.x11.mk> contains parameters and targets for
+cross-building X11 from ${X11SRCDIR.xc} / ${X11MITSRCDIR.*}.
+It should be included after the general Makefile contents but before
+the include files such as <bsd.prog.mk> and <bsd.lib.mk>.
+
+It provides the following targets:
+	.man.1 .man.3 .man.4 .man.5 .man.7:
+		If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
+		these rules convert from X11's manual page source
+		into an mdoc.old source file.
+
+It sets the following variables:
+
+BINDIR			Set to ${X11BINDIR}.
+			To override, define after including <bsd.x11.mk>
+
+LIBDIR			Set to ${X11USRLIBDIR}.
+			To override, define after including <bsd.x11.mk>
+
+MANDIR			Set to ${X11MANDIR}.
+			To override, define after including <bsd.x11.mk>
+
+CPPFLAGS		Appended with definitions to include from
+			${DESTDIR}${X11INCDIR}
+
+LDFLAGS			Appended with definitions to link from
+			${DESTDIR}${X11USRLIBDIR}
+
+X11FLAGS.CONNECTION	Equivalent to X11's CONNECTION_FLAGS.
+
+X11FLAGS.EXTENSION	Equivalent to X11's EXT_DEFINES.
+
+X11FLAGS.LOADABLE	Equivalent to X11's LOADABLE.
+
+X11FLAGS.OS_DEFINES	Equivalent to X11's OS_DEFINES.
+
+X11FLAGS.SERVER		Equivalent to X11's ServerDefines.
+
+X11FLAGS.THREADLIB	Equivalent to X11's THREADS_DEFINES for libraries.
+
+X11FLAGS.THREADS	Equivalent to X11's THREADS_DEFINES.
+
+X11FLAGS.VERSION	cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
+
+X11FLAGS.DIX		Equivalent to X11's DIX_DEFINES.
+
+X11TOOL_UNXCOMM		Commandline to convert `XCOMM' comments to `#'
+
+It uses the following variables:
+
+APPDEFS			List of app-default files to install.
+
+CPPSCRIPTS		List of files/scripts to run through cpp(1)
+			and then ${X11TOOL_UNXCOMM}.  The source files
+			have a `.cpp' suffix, the generated files do not.
+
+CPPSCRIPTFLAGS		Additional flags to cpp(1) when building CPPSCRIPTS.
+
+CPPSCRIPTFLAGS_<fn>	Additional flags to cpp(1) when building CPPSCRIPT <fn>.
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+The following files are described here for completion, but they are not
+supposed to be included directly from other Makefiles; they are used
+internally by other system files.
+
 =-=-=-=-=   bsd.sys.mk   =-=-=-=-=
 
-The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
-<bsd.lib.mk>.  It contains overrides that are used when building
-the NetBSD source tree.
+The include file <bsd.sys.mk> is used by other system mk files and
+it is not intended to be included standalone. It contains rules and
+system build variables. It requires bsd.own.mk to be included first.
+It contains overrides that are used when building the NetBSD source tree.
 
 The following variables control how various files are compiled/built.
 (Note that these may be overridden in <bsd.own.mk> if USETOOLS == "yes"):
@@ -1875,67 +1945,53 @@ WARNS		Crank up compiler warning options
 			WARNS=4
 			WARNS=5
 
-=-=-=-=-=   bsd.x11.mk   =-=-=-=-=
+=-=-=-=-=   bsd.host.mk  =-=-=-=-=
 
-The include file <bsd.x11.mk> contains parameters and targets for
-cross-building X11 from ${X11SRCDIR.xc} / ${X11MITSRCDIR.*}.
-It should be included after the general Makefile contents but before
-the include files such as <bsd.prog.mk> and <bsd.lib.mk>.
+This file is automatically included from bsd.own.mk. It contains settings
+for all the HOST_* variables that are used in host programs and libraries.
 
-It provides the following targets:
-	.man.1 .man.3 .man.4 .man.5 .man.7:
-		If ${MAN} or ${PROG} is set and ${MKMAN} != "no",
-		these rules convert from X11's manual page source
-		into an mdoc.old source file.
+HOST_AR			The host archive processing command
 
-It sets the following variables:
-
-BINDIR			Set to ${X11BINDIR}.
-			To override, define after including <bsd.x11.mk>
+HOST_CC			The host c compiler
 
-LIBDIR			Set to ${X11USRLIBDIR}.
-			To override, define after including <bsd.x11.mk>
+HOST_CFLAGS		The host c compiler flags
 
-MANDIR			Set to ${X11MANDIR}.
-			To override, define after including <bsd.x11.mk>
+HOST_COMPILE.c		The host c compiler line with flags
 
-CPPFLAGS		Appended with definitions to include from
-			${DESTDIR}${X11INCDIR}
+HOST_COMPILE.cc		The host c++ compiler line with flags
 
-LDFLAGS			Appended with definitions to link from
-			${DESTDIR}${X11USRLIBDIR}
+HOST_CPP		The host c pre-processor
 
-X11FLAGS.CONNECTION	Equivalent to X11's CONNECTION_FLAGS.
+HOST_CPPFLAGS		The cost c pre-processor flags
 
-X11FLAGS.EXTENSION	Equivalent to X11's EXT_DEFINES.
+HOST_CXX		The host c++ compiler
 
-X11FLAGS.LOADABLE	Equivalent to X11's LOADABLE.
+HOST_CXXFLAGS		The host c++ compiler flags
 
-X11FLAGS.OS_DEFINES	Equivalent to X11's OS_DEFINES.
+HOST_INSTALL_DIR	The host command to install a directory
 
-X11FLAGS.SERVER		Equivalent to X11's ServerDefines.
+HOST_INSTALL_FILE	The host command to install a file
 
-X11FLAGS.THREADLIB	Equivalent to X11's THREADS_DEFINES for libraries.
+HOST_INSTALL_SYMLINK	The host command to install a symlink
 
-X11FLAGS.THREADS	Equivalent to X11's THREADS_DEFINES.
+HOST_LD			The host linker command
 
-X11FLAGS.VERSION	cpp(1) definitions of OSMAJORVERSION and OSMINORVERSION.
+HOST_LDFLAGS		The host linker flags
 
-X11FLAGS.DIX		Equivalent to X11's DIX_DEFINES.
+HOST_LINK.c		The host c linker line with flags
 
-X11TOOL_UNXCOMM		Commandline to convert `XCOMM' comments to `#'
+HOST_LINK.cc		The host c++ linker line with flags
 
-It uses the following variables:
+HOST_LN			The host command to link two files
 
-APPDEFS			List of app-default files to install.
+HOST_MKDEP		The host command to create dependencies for c programs
 
-CPPSCRIPTS		List of files/scripts to run through cpp(1)
-			and then ${X11TOOL_UNXCOMM}.  The source files
-			have a `.cpp' suffix, the generated files do not.
+HOST_MKDEPCXX		The host command to create dependencies for c++ programs
 
-CPPSCRIPTFLAGS		Additional flags to cpp(1) when building CPPSCRIPTS.
+HOST_OSTYPE		The host OSNAME-RELEASE-ARCH tupple
 
-CPPSCRIPTFLAGS_<fn>	Additional flags to cpp(1) when building CPPSCRIPT <fn>.
+HOST_RANLIB		The host command to create random access archives
 
+HOST_SH			The host Bourne shell interpreter name (absolute path)
 
 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Index: bsd.host.mk
===================================================================
RCS file: bsd.host.mk
diff -N bsd.host.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bsd.host.mk	15 Jan 2014 01:14:41 -0000
@@ -0,0 +1,58 @@
+#	$NetBSD$
+
+.if !defined(_BSD_HOST_MK_)
+_BSD_HOST_MK_=1
+
+# Helpers for cross-compiling
+HOST_CC?=	cc
+HOST_CFLAGS?=	-O
+HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
+HOST_COMPILE.cc?=      ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c
+HOST_LINK.cc?=  ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
+.if defined(HOSTPROG_CXX)
+HOST_LINK.c?=   ${HOST_LINK.cc}
+.else
+HOST_LINK.c?=	${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
+.endif
+
+HOST_CXX?=	c++
+HOST_CXXFLAGS?=	-O
+
+HOST_CPP?=	cpp
+HOST_CPPFLAGS?=
+
+HOST_LD?=	ld
+HOST_LDFLAGS?=
+
+HOST_AR?=	ar
+HOST_RANLIB?=	ranlib
+
+HOST_LN?=	ln
+
+# HOST_SH must be an absolute path
+HOST_SH?=	/bin/sh
+
+.if !defined(HOST_OSTYPE)
+_HOST_OSNAME!=	uname -s
+_HOST_OSREL!=	uname -r
+# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
+# something that does not look like an identifier, then use uname -m.
+_HOST_ARCH!=	uname -p 2>/dev/null
+_HOST_ARCH:=	${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}
+.if empty(_HOST_ARCH)
+_HOST_ARCH!=	uname -m
+.endif
+HOST_OSTYPE:=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
+.MAKEOVERRIDES+= HOST_OSTYPE
+.endif # !defined(HOST_OSTYPE)
+
+HOST_MKDEP?=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
+HOST_MKDEPCXX?=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
+
+.if ${NEED_OWN_INSTALL_TARGET} != "no"
+HOST_INSTALL_FILE?=	${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
+HOST_INSTALL_DIR?=	${INSTALL} -d
+HOST_INSTALL_SYMLINK?=	${INSTALL} ${SYMLINK} ${RENAME}
+.endif
+
+.endif
Index: bsd.own.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.own.mk,v
retrieving revision 1.761
diff -u -p -u -r1.761 bsd.own.mk
--- bsd.own.mk	14 Jan 2014 11:14:27 -0000	1.761
+++ bsd.own.mk	15 Jan 2014 01:14:41 -0000
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.761 2014/01/14 11:14:27 apb Exp $
+#	$NetBSD: bsd.own.mk,v 1.760 2013/12/31 18:46:09 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -159,19 +159,7 @@ USETOOLS?=	no
 #
 # Host platform information; may be overridden
 #
-.if !defined(HOST_OSTYPE)
-_HOST_OSNAME!=	uname -s
-_HOST_OSREL!=	uname -r
-# For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
-# something that does not look like an identifier, then use uname -m.
-_HOST_ARCH!=	uname -p 2>/dev/null
-_HOST_ARCH:=	${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}
-.if empty(_HOST_ARCH)
-_HOST_ARCH!=	uname -m
-.endif
-HOST_OSTYPE:=	${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
-.MAKEOVERRIDES+= HOST_OSTYPE
-.endif # !defined(HOST_OSTYPE)
+.include <bsd.host.mk>
 
 .if ${USETOOLS} == "yes"						# {
 
@@ -261,9 +249,6 @@ LDFLAGS+=	--sysroot=/
 .endif
 .endif	# EXTERNAL_TOOLCHAIN						# }
 
-HOST_MKDEP=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
-HOST_MKDEPCXX=	${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
-
 DBSYM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
 ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
 ELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
@@ -1085,9 +1070,6 @@ INSTALL_DIR?=		${INSTALL} ${INSTPRIV} -d
 INSTALL_FILE?=		${INSTALL} ${INSTPRIV} ${COPY} ${PRESERVE} ${RENAME}
 INSTALL_LINK?=		${INSTALL} ${INSTPRIV} ${HRDLINK} ${RENAME}
 INSTALL_SYMLINK?=	${INSTALL} ${INSTPRIV} ${SYMLINK} ${RENAME}
-HOST_INSTALL_FILE?=	${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
-HOST_INSTALL_DIR?=	${INSTALL} -d
-HOST_INSTALL_SYMLINK?=	${INSTALL} ${SYMLINK} ${RENAME}
 .endif
 
 #
Index: bsd.sys.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.sys.mk,v
retrieving revision 1.234
diff -u -p -u -r1.234 bsd.sys.mk
--- bsd.sys.mk	10 Jan 2014 16:20:14 -0000	1.234
+++ bsd.sys.mk	15 Jan 2014 01:14:41 -0000
@@ -5,10 +5,14 @@
 .if !defined(_BSD_SYS_MK_)
 _BSD_SYS_MK_=1
 
-#.if !empty(.INCLUDEDFROMFILE:MMakefile*)
-#error:
-#	@(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1)
-#.endif
+.if !empty(.INCLUDEDFROMFILE:MMakefile*)
+error1:
+	@(echo "bsd.sys.mk should not be included from Makefiles" >& 2; exit 1)
+.endif
+.if !defined(_BSD_OWN_MK_)
+error2:
+	@(echo "bsd.own.mk must be included before bsd.sys.mk" >& 2; exit 1)
+.endif
 
 .if ${MKREPRO:Uno} == "yes"
 CPPFLAGS+=	-Wp,-iremap,${NETBSDSRCDIR}:/usr/src
@@ -152,35 +156,6 @@ PIE_LDFLAGS?=       -Wl,-pie -shared-lib
 PIE_AFLAGS?=	    -fPIC
 .endif
 
-# Helpers for cross-compiling
-HOST_CC?=	cc
-HOST_CFLAGS?=	-O
-HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
-HOST_COMPILE.cc?=      ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c
-HOST_LINK.cc?=  ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
-.if defined(HOSTPROG_CXX)
-HOST_LINK.c?=   ${HOST_LINK.cc}
-.else
-HOST_LINK.c?=	${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
-.endif
-
-HOST_CXX?=	c++
-HOST_CXXFLAGS?=	-O
-
-HOST_CPP?=	cpp
-HOST_CPPFLAGS?=
-
-HOST_LD?=	ld
-HOST_LDFLAGS?=
-
-HOST_AR?=	ar
-HOST_RANLIB?=	ranlib
-
-HOST_LN?=	ln
-
-# HOST_SH must be an absolute path
-HOST_SH?=	/bin/sh
-
 ELF2ECOFF?=	elf2ecoff
 MKDEP?=		mkdep
 MKDEPCXX?=	mkdep
@@ -189,8 +164,6 @@ OBJDUMP?=	objdump
 PAXCTL?=	paxctl
 STRIP?=		strip
 
-# TOOL_* variables are defined in bsd.own.mk
-
 .SUFFIXES:	.o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h}
 
 # C
Index: bsd.syscall.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.syscall.mk,v
retrieving revision 1.1
diff -u -p -u -r1.1 bsd.syscall.mk
--- bsd.syscall.mk	14 Jan 2014 18:51:45 -0000	1.1
+++ bsd.syscall.mk	15 Jan 2014 01:14:41 -0000
@@ -1,7 +1,6 @@
 # $NetBSD: bsd.syscall.mk,v 1.1 2014/01/14 18:51:45 christos Exp $
 #
 .include <bsd.own.mk>
-.include <bsd.sys.mk>
 
 SYSCALL_OBJS?=	${SYSCALL_PREFIX}_sysent.c ${SYSCALL_PREFIX}_syscalls.c \
 	${SYSCALL_PREFIX}_syscall.h ${SYSCALL_PREFIX}_syscallargs.h