summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2017-04-17 15:53:21 +0000
committerkettenis <kettenis@openbsd.org>2017-04-17 15:53:21 +0000
commitd8ee3b1570afd0531506bb87c4850b4e2c9b9d20 (patch)
treec4d19ee32da7e486bcdfc06a7c46db4c1320c2c1
parentRecognize nl_langinfo(CODESET) return values "646" and "" as aliases (diff)
downloadwireguard-openbsd-d8ee3b1570afd0531506bb87c4850b4e2c9b9d20.tar.xz
wireguard-openbsd-d8ee3b1570afd0531506bb87c4850b4e2c9b9d20.zip
Change build infrastructure to allow building both gcc and clang. This
doesn't actually flip the switch yet, so aarch64 continues to be the only architecture for which we build clang. ok jsg@, deraadt@
-rw-r--r--gnu/lib/Makefile7
-rw-r--r--gnu/usr.bin/Makefile10
-rw-r--r--gnu/usr.bin/clang/Makefile.inc7
-rw-r--r--include/Makefile10
-rw-r--r--lib/libcompiler_rt/Makefile9
-rw-r--r--lib/libcxx/Makefile9
-rw-r--r--lib/libcxxabi/Makefile9
-rw-r--r--share/mk/bsd.own.mk27
8 files changed, 65 insertions, 23 deletions
diff --git a/gnu/lib/Makefile b/gnu/lib/Makefile
index 8122d17a26b..6050bae902c 100644
--- a/gnu/lib/Makefile
+++ b/gnu/lib/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.20 2017/01/21 12:40:49 jsg Exp $
+# $OpenBSD: Makefile,v 1.21 2017/04/17 15:53:21 kettenis Exp $
.include <bsd.own.mk>
@@ -6,9 +6,10 @@ SUBDIR+=libiberty libreadline
.if make(obj)
SUBDIR+=libobjc libstdc++ libstdc++-v3 libsupc++-v3 ../usr.bin/cc/libobjc
.else
-. if ${COMPILER_VERSION:L} == "gcc3"
+. if ${BUILD_GCC3:L} == "yes"
SUBDIR+=libobjc libstdc++
-. elif ${COMPILER_VERSION:L} == "gcc4"
+. endif
+. if ${BUILD_GCC4:L} == "yes"
# XXX make sure we build libobjc & libstdc++-v3 from gcc4
SUBDIR+=../usr.bin/cc/libobjc
SUBDIR+=libstdc++-v3 libsupc++-v3
diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile
index fc125c08c8e..1806c279241 100644
--- a/gnu/usr.bin/Makefile
+++ b/gnu/usr.bin/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.58 2017/02/20 01:00:26 jsg Exp $
+# $OpenBSD: Makefile,v 1.59 2017/04/17 15:53:21 kettenis Exp $
# $NetBSD: Makefile,v 1.35 1996/04/03 21:20:52 chuck Exp $
.include <bsd.own.mk>
@@ -6,11 +6,13 @@
.if make(obj)
SUBDIR+= cc clang gcc
.else
-. if ${COMPILER_VERSION:L} == "gcc3"
+. if ${BUILD_GCC3:L} == "yes"
SUBDIR+= gcc
-. elif ${COMPILER_VERSION:L} == "gcc4"
+. endif
+. if ${BUILD_GCC4:L} == "yes"
SUBDIR+= cc
-. elif ${COMPILER_VERSION:L} == "clang"
+. endif
+. if ${BUILD_CLANG:L} == "yes"
SUBDIR+= clang
. endif
.endif
diff --git a/gnu/usr.bin/clang/Makefile.inc b/gnu/usr.bin/clang/Makefile.inc
index 1229abfe8f7..27678e1d38b 100644
--- a/gnu/usr.bin/clang/Makefile.inc
+++ b/gnu/usr.bin/clang/Makefile.inc
@@ -1,7 +1,12 @@
-# $OpenBSD: Makefile.inc,v 1.4 2017/02/16 02:08:42 jsg Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2017/04/17 15:53:21 kettenis Exp $
LLVM_SRCS?= ${.CURDIR}/../../../llvm
+.if ${COMPILER_VERSION:L} != "clang"
+CC= clang
+CXX= clang++
+.endif
+
BOOTSTRAP_CLANG?=no
.if ${BOOTSTRAP_CLANG} == "yes"
CC= egcc
diff --git a/include/Makefile b/include/Makefile
index 8f9f24fc5f5..1d7f894b595 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.218 2017/03/12 23:28:13 guenther Exp $
+# $OpenBSD: Makefile,v 1.219 2017/04/17 15:53:21 kettenis Exp $
# $NetBSD: Makefile,v 1.59 1996/05/15 21:36:43 jtc Exp $
# @(#)Makefile 5.45.1.1 (Berkeley) 5/6/91
@@ -42,13 +42,15 @@ RDIRS= ../lib/libcurses ../lib/libedit \
../usr.bin/lex ../gnu/lib/libreadline \
../sys/arch/${MACHINE}
-.if ${COMPILER_VERSION:L} == "gcc3"
+.if ${BUILD_GCC3:L} == "yes"
RDIRS+= ../gnu/usr.bin/gcc ../gnu/lib/libobjc
PRDIRS+= ../gnu/lib/libstdc++
-.elif ${COMPILER_VERSION:L} == "gcc4"
+.endif
+.if ${BUILD_GCC4:L} == "yes"
RDIRS+= ../gnu/usr.bin/cc/libobjc
PRDIRS+= ../gnu/lib/libstdc++-v3 ../gnu/usr.bin/cc/include
-.elif ${COMPILER_VERSION:L} == "clang"
+.endif
+.if ${BUILD_CLANG:L} == "yes"
RDIRS+= ../lib/libcxxabi ../lib/libcxx
.endif
diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
index 11c8c13478f..a2a249c83b9 100644
--- a/lib/libcompiler_rt/Makefile
+++ b/lib/libcompiler_rt/Makefile
@@ -1,8 +1,13 @@
-# $OpenBSD: Makefile,v 1.6 2017/04/09 21:47:05 kettenis Exp $
+# $OpenBSD: Makefile,v 1.7 2017/04/17 15:53:21 kettenis Exp $
.include <bsd.own.mk>
-.if ${COMPILER_VERSION:L} == "clang"
+.if ${COMPILER_VERSION:L} != "clang"
+CC= clang
+CXX= clang++
+.endif
+
+.if ${BUILD_CLANG:L} == "yes"
LIB= compiler_rt
NOPIC=
diff --git a/lib/libcxx/Makefile b/lib/libcxx/Makefile
index 91cb529249b..779f31aa75a 100644
--- a/lib/libcxx/Makefile
+++ b/lib/libcxx/Makefile
@@ -1,8 +1,13 @@
-# $OpenBSD: Makefile,v 1.5 2017/02/16 02:08:42 jsg Exp $
+# $OpenBSD: Makefile,v 1.6 2017/04/17 15:53:21 kettenis Exp $
.include <bsd.own.mk>
-.if ${COMPILER_VERSION:L} == "clang"
+.if ${COMPILER_VERSION:L} != "clang"
+CC= clang
+CXX= clang++
+.endif
+
+.if ${BUILD_CLANG:L} == "yes"
HDRDIR= ${.CURDIR}/include
SRCDIR= ${.CURDIR}/src
diff --git a/lib/libcxxabi/Makefile b/lib/libcxxabi/Makefile
index d86f649e1ca..6203cc34b91 100644
--- a/lib/libcxxabi/Makefile
+++ b/lib/libcxxabi/Makefile
@@ -1,8 +1,13 @@
-# $OpenBSD: Makefile,v 1.7 2017/04/06 09:28:29 kettenis Exp $
+# $OpenBSD: Makefile,v 1.8 2017/04/17 15:53:21 kettenis Exp $
.include <bsd.own.mk>
-.if ${COMPILER_VERSION:L} == "clang"
+.if ${COMPILER_VERSION:L} != "clang"
+CC= clang
+CXX= clang++
+.endif
+
+.if ${BUILD_CLANG:L} == "yes"
HDRDIR= ${.CURDIR}/include
SRCDIR= ${.CURDIR}/src
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 9b09226aef8..3a976d0d29c 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -1,4 +1,4 @@
-# $OpenBSD: bsd.own.mk,v 1.182 2016/12/18 17:02:21 patrick Exp $
+# $OpenBSD: bsd.own.mk,v 1.183 2017/04/17 15:53:21 kettenis Exp $
# $NetBSD: bsd.own.mk,v 1.24 1996/04/13 02:08:09 thorpej Exp $
# Host-specific overrides
@@ -16,6 +16,7 @@ SKEY?= yes
YP?= yes
CLANG_ARCH=aarch64
+GCC4_ARCH=alpha amd64 arm hppa i386 mips64 mips64el powerpc sh sparc64
GCC3_ARCH=m88k
# m88k: ?
@@ -23,12 +24,28 @@ PIE_ARCH=alpha amd64 arm hppa i386 mips64 mips64el powerpc sh sparc64
STATICPIE_ARCH=alpha amd64 arm hppa i386 mips64 mips64el powerpc sh sparc64
.for _arch in ${MACHINE_ARCH}
-.if !empty(CLANG_ARCH:M${_arch})
-COMPILER_VERSION?=clang
-.elif !empty(GCC3_ARCH:M${_arch})
+.if !empty(GCC3_ARCH:M${_arch})
COMPILER_VERSION?=gcc3
-.else
+.elif !empty(GCC4_ARCH:M${_arch})
COMPILER_VERSION?=gcc4
+.elif !empty(CLANG_ARCH:M${_arch})
+COMPILER_VERSION?=clang
+.endif
+
+.if !empty(GCC3_ARCH:M${_arch})
+BUILD_GCC3?=yes
+.else
+BUILD_GCC3?=no
+.endif
+.if !empty(GCC4_ARCH:M${_arch})
+BUILD_GCC4?=yes
+.else
+BUILD_GCC4?=no
+.endif
+.if !empty(CLANG_ARCH:M${_arch})
+BUILD_CLANG?=yes
+.else
+BUILD_CLANG?=no
.endif
.if !empty(STATICPIE_ARCH:M${_arch})