NetBSD/share/mk/bsd.host.mk
christos 5344ef6679 - 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)
2014-01-16 01:19:46 +00:00

59 lines
1.5 KiB
Makefile

# $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