etc/protocols - sync with NetBSD-8
[minix.git] / share / mk / bsd.host.mk
blob1a105e6df2f9fdb360240e51d22734444fcc6fa4
1 # $NetBSD: bsd.host.mk,v 1.2 2014/04/10 19:02:18 plunky Exp $
3 .if !defined(_BSD_HOST_MK_)
4 _BSD_HOST_MK_=1
6 .if ${HOST_OSTYPE:C/\-.*//:U} == "Minix"
7 HOST_LDFLAGS?= -static
9 #LSC: Be a bit smarter about the default compiler
10 .if exists(/usr/pkg/bin/clang) || exists(/usr/bin/clang)
11 HOST_CC?= clang
12 .endif
14 .if exists(/usr/pkg/bin/gcc) || exists(/usr/bin/gcc)
15 HOST_CC?= gcc
16 .endif
17 .endif # ${HOST_OSTYPE:C/\-.*//:U} == "Minix"
19 # Helpers for cross-compiling
20 HOST_CC?= cc
21 HOST_CFLAGS?= -O
22 HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
23 HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c
24 HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
25 .if defined(HOSTPROG_CXX)
26 HOST_LINK.c?= ${HOST_LINK.cc}
27 .else
28 HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
29 .endif
31 HOST_CXX?= c++
32 HOST_CXXFLAGS?= -O
34 HOST_CPP?= cpp
35 HOST_CPPFLAGS?=
37 HOST_LD?= ld
38 HOST_LDFLAGS?=
40 HOST_AR?= ar
41 HOST_RANLIB?= ranlib
43 HOST_LN?= ln
45 # HOST_SH must be an absolute path
46 HOST_SH?= /bin/sh
48 .if !defined(HOST_OSTYPE)
49 _HOST_OSNAME!= uname -s
50 _HOST_OSREL!= uname -r
51 # For _HOST_ARCH, if uname -p fails, or prints "unknown", or prints
52 # something that does not look like an identifier, then use uname -m.
53 _HOST_ARCH!= uname -p 2>/dev/null
54 _HOST_ARCH:= ${HOST_ARCH:tW:C/.*[^-_A-Za-z0-9].*//:S/unknown//}
55 .if empty(_HOST_ARCH)
56 _HOST_ARCH!= uname -m
57 .endif
58 HOST_OSTYPE:= ${_HOST_OSNAME}-${_HOST_OSREL:C/\([^\)]*\)//g:[*]:C/ /_/g}-${_HOST_ARCH:C/\([^\)]*\)//g:[*]:C/ /_/g}
59 .MAKEOVERRIDES+= HOST_OSTYPE
60 .endif # !defined(HOST_OSTYPE)
62 .if ${USETOOLS} == "yes"
63 HOST_MKDEP?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
64 HOST_MKDEPCXX?= ${TOOLDIR}/bin/${_TOOL_PREFIX}host-mkdep
65 .else
66 HOST_MKDEP?= CC=${HOST_CC:Q} mkdep
67 HOST_MKDEPCXX?= CC=${HOST_CXX:Q} mkdep
68 .endif
70 .if ${NEED_OWN_INSTALL_TARGET} != "no"
71 HOST_INSTALL_FILE?= ${INSTALL} ${COPY} ${PRESERVE} ${RENAME}
72 HOST_INSTALL_DIR?= ${INSTALL} -d
73 HOST_INSTALL_SYMLINK?= ${INSTALL} ${SYMLINK} ${RENAME}
74 .endif
76 .endif