summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2020-06-30 21:22:19 +0000
committerriastradh <riastradh@NetBSD.org>2020-06-30 21:22:19 +0000
commit32e2e1bfc4a73baa6d0d2f80f95335abd3b093ef (patch)
treeb98650d8d86bca5cd473f32e6267a3c39c07daf9
parent84a1dc2ad9a28ab9c02b8145035d213318acdee0 (diff)
New build.sh option: -c <compiler>
Could never remember what the incantation is to do a clang build, so now it's just `build.sh -c clang'.
-rwxr-xr-xbuild.sh29
-rw-r--r--doc/BUILDING.mdoc19
2 files changed, 42 insertions, 6 deletions
diff --git a/build.sh b/build.sh
index df05f7918e6..ed4de0eabf8 100755
--- a/build.sh
+++ b/build.sh
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.341 2020/06/13 18:00:29 riastradh Exp $
+# $NetBSD: build.sh,v 1.342 2020/06/30 21:22:19 riastradh Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1028,8 +1028,8 @@ usage()
cat <<_usage_
Usage: ${progname} [-EhnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras]
- [-D dest] [-j njob] [-M obj] [-m mach] [-N noisy]
- [-O obj] [-R release] [-S seed] [-T tools]
+ [-c compiler>] [-D dest] [-j njob] [-M obj] [-m mach]
+ [-N noisy] [-O obj] [-R release] [-S seed] [-T tools]
[-V var=[value]] [-w wrapper] [-X x11src] [-Y extsrcsrc]
[-Z var]
operation [...]
@@ -1081,6 +1081,10 @@ Usage: ${progname} [-EhnoPRrUuxy] [-a arch] [-B buildid] [-C cdextras]
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
-B buildid Set BUILDID to buildid.
-C cdextras Append cdextras to CDEXTRA variable for inclusion on CD-ROM.
+ -c compiler Select compiler:
+ clang
+ gcc
+ [Default: gcc]
-D dest Set DESTDIR to dest. [Default: destdir.MACHINE]
-E Set "expert" mode; disables various safety checks.
Should not be used without expert knowledge of the build system.
@@ -1130,7 +1134,7 @@ _usage_
parseoptions()
{
- opts='a:B:C:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:'
+ opts='a:B:C:c:D:Ehj:M:m:N:nO:oPR:rS:T:UuV:w:X:xY:yZ:'
opt_a=false
opt_m=false
@@ -1176,6 +1180,21 @@ parseoptions()
CDEXTRA="${CDEXTRA}${CDEXTRA:+ }${OPTARG}"
;;
+ -c)
+ eval ${optargcmd}
+ case "${OPTARG}" in
+ gcc) # default, no variables needed
+ ;;
+ clang) setmakeenv HAVE_LLVM yes
+ setmakeenv MKLLVM yes
+ setmakeenv MKGCC no
+ ;;
+ #pcc) ...
+ # ;;
+ *) bomb "Unknown compiler: ${OPTARG}"
+ esac
+ ;;
+
-D)
eval ${optargcmd}; resolvepath OPTARG
setmakeenv DESTDIR "${OPTARG}"
@@ -1942,7 +1961,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from: \$NetBSD: build.sh,v 1.341 2020/06/13 18:00:29 riastradh Exp $
+# Generated from: \$NetBSD: build.sh,v 1.342 2020/06/30 21:22:19 riastradh Exp $
# with these arguments: ${_args}
#
diff --git a/doc/BUILDING.mdoc b/doc/BUILDING.mdoc
index 76f1ea5d1df..1bf523b2580 100644
--- a/doc/BUILDING.mdoc
+++ b/doc/BUILDING.mdoc
@@ -1,4 +1,4 @@
-.\" $NetBSD: BUILDING.mdoc,v 1.126 2019/05/08 14:03:57 leot Exp $
+.\" $NetBSD: BUILDING.mdoc,v 1.127 2020/06/30 21:22:19 riastradh Exp $
.\"
.\" Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -1693,6 +1693,23 @@ Multiple paths may be specified via multiple
options, or via a single option whose argument contains multiple
space-separated paths.
.
+.It Fl c Ar compiler
+Select the compiler for the toolchain to build
+.Nx
+and for inclusion in the
+.Nx
+distribution.
+Supported choices:
+.Bl -inset -offset indent
+.It clang
+.It gcc
+[default]
+.El
+.Pp
+The compiler used to build the toolchain can be different; see
+.Sy HOST_CC
+and
+.Sy HOST_CXX .
.It Fl D Ar dest
Set the value of
.Sy DESTDIR