Add a wrapper script to allow "foreign" compilers into our build system.
[dragonfly.git] / share / mk / bsd.cpu.mk
CommitLineData
984263bc 1# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.2.2.5 2002/07/19 08:09:32 ru Exp $
c0cbcbce 2# $DragonFly: src/share/mk/bsd.cpu.mk,v 1.16 2007/09/26 22:14:17 dillon Exp $
984263bc 3
5228fe46
MD
4# include compiler-specific bsd.cpu.mk. Note that CCVER may or may not
5# be passed as an environment variable. If not set we make it consistent
6# within make but do not otherwise export it.
7#
8# _CCVER is used to detect changes to CCVER made in Makefile's after the
9# fact.
4db2a28c
MD
10#
11# HOST_CCVER is used by the native system compiler and defaults to CCVER.
12# It is not subject to local CCVER overrides in Makefiles and it is inherited
13# by all sub-makes.
c0cbcbce
MD
14#
15# If the host system does not have the desired compiler for HOST_CCVER
16# we back off to something it probably does have.
4db2a28c 17
de588dd0 18CCVER ?= gcc41
5228fe46 19_CCVER := ${CCVER}
c97b9141 20.if ${_CCVER} == "gcc34" || ${_CCVER} == "gcc41"
c0cbcbce 21.if exists(/usr/libexec/${_CCVER}/cc)
4db2a28c 22HOST_CCVER?= ${_CCVER}
c0cbcbce
MD
23.else
24HOST_CCVER?= gcc34
25.endif
c97b9141
SW
26.else
27.if exists(/usr/libexec/custom/cc)
28HOST_CCVER?= ${CCVER}
29.else
30HOST_CCVER?= gcc34
31.endif
32.endif
984263bc 33
d90d8005 34.if ${CCVER} == "gcc34"
aad05129 35. include <bsd.cpu.gcc34.mk>
ddf7cc86
SS
36.elif ${CCVER} == "gcc41"
37. include <bsd.cpu.gcc41.mk>
85d641d8
JS
38.elif defined(CCVER_BSD_CPU_MK)
39. if ${CCVER_BSD_CPU_MK} != ""
40. include "${CCVER_BSD_CPU_MK}"
984263bc 41. endif
85d641d8 42.else
c97b9141 43. include <bsd.cpu.custom.mk>
5228fe46
MD
44.endif
45
46# /usr/bin/cc depend on the CCVER environment variable, make sure CCVER is
47# exported for /usr/bin/cc and friends. Note that CCVER is unsupported when
48# cross compiling from 4.x or older versions of DFly and should not be set
49# by the user.
50#
51.if defined(.DIRECTIVE_MAKEENV)
52.makeenv CCVER
4db2a28c 53.makeenv HOST_CCVER
5228fe46 54.endif
984263bc 55
5228fe46
MD
56# We can reassign _CPUCFLAGS and CFLAGS will evaluate properly to the
57# new value, we do not have to add the variable to CFLAGS twice.
58#
59.if !defined(NO_CPU_CFLAGS) && !defined(_CPUCFLAGS_ASSIGNED)
60_CPUCFLAGS_ASSIGNED=TRUE
61CFLAGS += ${_CPUCFLAGS}
984263bc 62.endif
85d641d8 63