Module Name: src
Committed By: christos
Date: Thu Jan 16 01:19:46 UTC 2014
Modified Files:
src/share/mk: bsd.README bsd.own.mk bsd.sys.mk bsd.syscall.mk
Added Files:
src/share/mk: bsd.host.mk
Log Message:
- Add a new bsd.host.mk that contains all the HOST_ variables extracted from
bsd.sys.mk and bsd.own.mk
- Add protection requiring that:
1. bsd.sys.mk is not include from other Makefiles directly
2. bsd.own.mk must be included before bsd.sys.mk since it
sets variables that bsd.sys.mk uses as conditionals.
This is step 1 of removing all variable settings from bsd.sys.mk and
leaving behind only rules. This way, the structure of a standard Makefile
is:
variable overrides
optionally include bsd.own.mk
optionally include bsd.endian.mk
variable settings that use variables defined in bsd.own.mk
include a one or more rule .mk files (such as bsd.prog.mk etc)
To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/share/mk/bsd.README
cvs rdiff -u -r0 -r1.1 src/share/mk/bsd.host.mk
cvs rdiff -u -r1.761 -r1.762 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.235 -r1.236 src/share/mk/bsd.sys.mk
cvs rdiff -u -r1.1 -r1.2 src/share/mk/bsd.syscall.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.325 src/share/mk/bsd.README:1.326
--- src/share/mk/bsd.README:1.325 Tue Jan 14 13:51:45 2014
+++ src/share/mk/bsd.README Wed Jan 15 20:19:46 2014
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.README,v 1.325 2014/01/14 18:51:45 christos Exp $
+# $NetBSD: bsd.README,v 1.326 2014/01/16 01:19:46 christos Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the make "include" files for the NetBSD
@@ -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: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.761 src/share/mk/bsd.own.mk:1.762
--- src/share/mk/bsd.own.mk:1.761 Tue Jan 14 06:14:27 2014
+++ src/share/mk/bsd.own.mk Wed Jan 15 20:19:46 2014
@@ -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.762 2014/01/16 01:19:46 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: src/share/mk/bsd.sys.mk
diff -u src/share/mk/bsd.sys.mk:1.235 src/share/mk/bsd.sys.mk:1.236
--- src/share/mk/bsd.sys.mk:1.235 Wed Jan 15 09:00:09 2014
+++ src/share/mk/bsd.sys.mk Wed Jan 15 20:19:46 2014
@@ -1,14 +1,18 @@
-# $NetBSD: bsd.sys.mk,v 1.235 2014/01/15 14:00:09 joerg Exp $
+# $NetBSD: bsd.sys.mk,v 1.236 2014/01/16 01:19:46 christos Exp $
#
# Build definitions used for NetBSD source tree builds.
.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 ${${ACTIVE_
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: src/share/mk/bsd.syscall.mk
diff -u src/share/mk/bsd.syscall.mk:1.1 src/share/mk/bsd.syscall.mk:1.2
--- src/share/mk/bsd.syscall.mk:1.1 Tue Jan 14 13:51:45 2014
+++ src/share/mk/bsd.syscall.mk Wed Jan 15 20:19:46 2014
@@ -1,7 +1,6 @@
-# $NetBSD: bsd.syscall.mk,v 1.1 2014/01/14 18:51:45 christos Exp $
+# $NetBSD: bsd.syscall.mk,v 1.2 2014/01/16 01:19:46 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
Added files:
Index: src/share/mk/bsd.host.mk
diff -u /dev/null src/share/mk/bsd.host.mk:1.1
--- /dev/null Wed Jan 15 20:19:46 2014
+++ src/share/mk/bsd.host.mk Wed Jan 15 20:19:46 2014
@@ -0,0 +1,58 @@
+# $NetBSD: bsd.host.mk,v 1.1 2014/01/16 01:19:46 christos Exp $
+
+.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