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