xref: /dragonfly/share/mk/bsd.cpu.mk (revision bcb3e04d)
1# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.2.2.5 2002/07/19 08:09:32 ru Exp $
2# $DragonFly: src/share/mk/bsd.cpu.mk,v 1.16 2007/09/26 22:14:17 dillon Exp $
3
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.
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.
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.
17
18_DEFAULT_CCVER=	gcc41
19
20CCVER ?= ${_DEFAULT_CCVER}
21_CCVER := ${CCVER}
22.if exists(/usr/libexec/${_CCVER}/cc) || exists(/usr/libexec/custom/cc)
23HOST_CCVER?= ${_CCVER}
24.else
25HOST_CCVER?= ${_DEFAULT_CCVER}
26.endif
27
28_DEFAULT_BINUTILSVER=	binutils217
29HOST_BINUTILSVER?=	${_DEFAULT_BINUTILSVER}
30
31.if defined(CCVER_BSD_CPU_MK)
32.  if ${CCVER_BSD_CPU_MK} != ""
33.    include "${CCVER_BSD_CPU_MK}"
34.  endif
35.elif ${CCVER} == "gcc41"
36.  include <bsd.cpu.gcc41.mk>
37.elif ${CCVER} == "gcc44"
38.  include <bsd.cpu.gcc44.mk>
39.else
40.  include <bsd.cpu.custom.mk>
41.endif
42
43# /usr/bin/cc depend on the CCVER environment variable, make sure CCVER is
44# exported for /usr/bin/cc and friends.  Note that CCVER is unsupported when
45# cross compiling from 4.x or older versions of DFly and should not be set
46# by the user.
47#
48.makeenv CCVER
49.makeenv HOST_CCVER
50
51# We can reassign _CPUCFLAGS and CFLAGS will evaluate properly to the
52# new value, we do not have to add the variable to CFLAGS twice.
53#
54.if !defined(NO_CPU_CFLAGS) && !defined(_CPUCFLAGS_ASSIGNED)
55_CPUCFLAGS_ASSIGNED=TRUE
56CFLAGS += ${_CPUCFLAGS}
57.endif
58
59