MFC: following 4 commits:
[dragonfly.git] / share / mk / bsd.cpu.mk
blobe7aa9a2f3b814de56cf31945558d386297973f98
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 $
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.
8 # _CCVER is used to detect changes to CCVER made in Makefile's after the
9 # fact.
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.
15 # If the host system does not have the desired compiler for HOST_CCVER
16 # we back off to something it probably does have.
18 CCVER ?= gcc41
19 _CCVER := ${CCVER}
20 .if exists(/usr/libexec/${_CCVER}/cc)
21 HOST_CCVER?= ${_CCVER}
22 .else
23 HOST_CCVER?= gcc34
24 .endif
26 .if ${CCVER} == "gcc34"
27 . include <bsd.cpu.gcc34.mk>
28 .elif ${CCVER} == "gcc41"
29 . include <bsd.cpu.gcc41.mk>
30 .elif defined(CCVER_BSD_CPU_MK)
31 . if ${CCVER_BSD_CPU_MK} != ""
32 . include "${CCVER_BSD_CPU_MK}"
33 . endif
34 .else
35 .error "Either set CCVER to a known compiler or specify CCVER_BSD_CPU_MK"
36 .endif
38 # /usr/bin/cc depend on the CCVER environment variable, make sure CCVER is
39 # exported for /usr/bin/cc and friends. Note that CCVER is unsupported when
40 # cross compiling from 4.x or older versions of DFly and should not be set
41 # by the user.
43 .if defined(.DIRECTIVE_MAKEENV)
44 .makeenv CCVER
45 .makeenv HOST_CCVER
46 .endif
48 # We can reassign _CPUCFLAGS and CFLAGS will evaluate properly to the
49 # new value, we do not have to add the variable to CFLAGS twice.
51 .if !defined(NO_CPU_CFLAGS) && !defined(_CPUCFLAGS_ASSIGNED)
52 _CPUCFLAGS_ASSIGNED=TRUE
53 CFLAGS += ${_CPUCFLAGS}
54 .endif