World - Change default compiler from gcc-5 to gcc-8
[dragonfly.git] / share / mk / bsd.cpu.mk
CommitLineData
984263bc
MD
1# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.2.2.5 2002/07/19 08:09:32 ru Exp $
2
5228fe46
MD
3# include compiler-specific bsd.cpu.mk. Note that CCVER may or may not
4# be passed as an environment variable. If not set we make it consistent
5# within make but do not otherwise export it.
6#
7# _CCVER is used to detect changes to CCVER made in Makefile's after the
8# fact.
4db2a28c
MD
9#
10# HOST_CCVER is used by the native system compiler and defaults to CCVER.
11# It is not subject to local CCVER overrides in Makefiles and it is inherited
12# by all sub-makes.
c0cbcbce
MD
13#
14# If the host system does not have the desired compiler for HOST_CCVER
15# we back off to something it probably does have.
4db2a28c 16
2a89766a 17_DEFAULT_CCVER= gcc80
5cc5a38c 18_DEFAULT_BINUTILSVER= binutils227
4f5ea479
SS
19
20CCVER ?= ${_DEFAULT_CCVER}
5228fe46 21_CCVER := ${CCVER}
4f5ea479 22.if exists(/usr/libexec/${_CCVER}/cc) || exists(/usr/libexec/custom/cc)
4db2a28c 23HOST_CCVER?= ${_CCVER}
c0cbcbce 24.else
4f5ea479 25HOST_CCVER?= ${_DEFAULT_CCVER}
c97b9141 26.endif
984263bc 27
6b6a9e55 28.if exists(/usr/libexec/${_DEFAULT_BINUTILSVER}/elf/as)
123dec51 29HOST_BINUTILSVER?= ${_DEFAULT_BINUTILSVER}
6b6a9e55 30.else
0fcba03f 31_NEXTAS!= find -s /usr/libexec/binutils* -name as -print0 -quit
7d605bf6 32HOST_BINUTILSVER?= ${_NEXTAS:H:H:T}
6b6a9e55 33.endif
123dec51 34
eb45cc97
SZ
35.if defined(FORCE_CPUTYPE)
36CPUTYPE= ${FORCE_CPUTYPE}
37.endif
38
4f5ea479 39.if defined(CCVER_BSD_CPU_MK)
85d641d8
JS
40. if ${CCVER_BSD_CPU_MK} != ""
41. include "${CCVER_BSD_CPU_MK}"
984263bc 42. endif
fa004253 43.elif ${CCVER} == gcc47
f0140465 44. include <bsd.cpu.gcc47.mk>
b399af11
JM
45.elif ${CCVER} == gcc50
46. include <bsd.cpu.gcc50.mk>
40f0590f 47.elif ${CCVER} == gcc80
48. include <bsd.cpu.gcc80.mk>
e3c44cf9
JM
49.elif ${CCVER:Mclang*}
50. include <bsd.cpu.clang.mk>
85d641d8 51.else
c97b9141 52. include <bsd.cpu.custom.mk>
5228fe46
MD
53.endif
54
55# /usr/bin/cc depend on the CCVER environment variable, make sure CCVER is
56# exported for /usr/bin/cc and friends. Note that CCVER is unsupported when
57# cross compiling from 4.x or older versions of DFly and should not be set
58# by the user.
59#
3da8e88f
JM
60.export CCVER
61.export HOST_CCVER
984263bc 62
5228fe46
MD
63# We can reassign _CPUCFLAGS and CFLAGS will evaluate properly to the
64# new value, we do not have to add the variable to CFLAGS twice.
65#
66.if !defined(NO_CPU_CFLAGS) && !defined(_CPUCFLAGS_ASSIGNED)
67_CPUCFLAGS_ASSIGNED=TRUE
68CFLAGS += ${_CPUCFLAGS}
984263bc 69.endif
85d641d8 70