Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/share/mk - Add a new bsd.host.mk that contains all the HOST_...
details: https://anonhg.NetBSD.org/src/rev/b8458070778e
branches: trunk
changeset: 326022:b8458070778e
user: christos <christos%NetBSD.org@localhost>
date: Thu Jan 16 01:19:46 2014 +0000
description:
- 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)
diffstat:
share/mk/bsd.README | 188 +++++++++++++++++++++++++++++++----------------
share/mk/bsd.host.mk | 58 ++++++++++++++
share/mk/bsd.own.mk | 22 +-----
share/mk/bsd.sys.mk | 45 ++---------
share/mk/bsd.syscall.mk | 3 +-
5 files changed, 192 insertions(+), 124 deletions(-)
diffs (truncated from 406 to 300 lines):
diff -r ae3c3746c06d -r b8458070778e share/mk/bsd.README
--- a/share/mk/bsd.README Thu Jan 16 01:15:32 2014 +0000
+++ b/share/mk/bsd.README Thu Jan 16 01:19:46 2014 +0000
@@ -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 @@
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=4
WARNS=5
-=-=-=-=-= 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>.
-
+=-=-=-=-= bsd.host.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.
+
+HOST_AR The host archive processing command
+
+HOST_CC The host c compiler
+
+HOST_CFLAGS The host c compiler flags
+
+HOST_COMPILE.c The host c compiler line with flags
+
+HOST_COMPILE.cc The host c++ compiler line with flags
+
+HOST_CPP The host c pre-processor
+
+HOST_CPPFLAGS The cost c pre-processor flags
+
+HOST_CXX The host c++ compiler
+
+HOST_CXXFLAGS The host c++ compiler flags
+
+HOST_INSTALL_DIR The host command to install a directory
+
+HOST_INSTALL_FILE The host command to install a file
+
+HOST_INSTALL_SYMLINK The host command to install a symlink
+
+HOST_LD The host linker command
+
+HOST_LDFLAGS The host linker flags
+
+HOST_LINK.c The host c linker line with flags
+
+HOST_LINK.cc The host c++ linker line with flags
+
+HOST_LN The host command to link two files
+
+HOST_MKDEP The host command to create dependencies for c programs
+
+HOST_MKDEPCXX The host command to create dependencies for c++ programs
+
+HOST_OSTYPE The host OSNAME-RELEASE-ARCH tupple
+
+HOST_RANLIB The host command to create random access archives
+
+HOST_SH The host Bourne shell interpreter name (absolute path)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
diff -r ae3c3746c06d -r b8458070778e share/mk/bsd.host.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/bsd.host.mk Thu Jan 16 01:19:46 2014 +0000
@@ -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
diff -r ae3c3746c06d -r b8458070778e share/mk/bsd.own.mk
--- a/share/mk/bsd.own.mk Thu Jan 16 01:15:32 2014 +0000
+++ b/share/mk/bsd.own.mk Thu Jan 16 01:19:46 2014 +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.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 @@
#
# 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>
Home |
Main Index |
Thread Index |
Old Index