Change build infrastructure to allow building both gcc and clang. This
authorkettenis <kettenis@openbsd.org>
Mon, 17 Apr 2017 15:53:21 +0000 (15:53 +0000)
committerkettenis <kettenis@openbsd.org>
Mon, 17 Apr 2017 15:53:21 +0000 (15:53 +0000)
doesn't actually flip the switch yet, so aarch64 continues to be the only
architecture for which we build clang.

ok jsg@, deraadt@

gnu/lib/Makefile
gnu/usr.bin/Makefile
gnu/usr.bin/clang/Makefile.inc
include/Makefile
lib/libcompiler_rt/Makefile
lib/libcxx/Makefile
lib/libcxxabi/Makefile
share/mk/bsd.own.mk

index 8122d17..6050bae 100644 (file)
@@ -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
index fc125c0..1806c27 100644 (file)
@@ -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
index 1229abf..27678e1 100644 (file)
@@ -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
index 8f9f24f..1d7f894 100644 (file)
@@ -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
 
index 11c8c13..a2a249c 100644 (file)
@@ -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=
index 91cb529..779f31a 100644 (file)
@@ -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
index d86f649..6203cc3 100644 (file)
@@ -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
index 9b09226..3a976d0 100644 (file)
@@ -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})