xref: /freebsd/share/mk/local.sys.dirdeps.env.mk (revision d1c8420702b7ad118ca909e9f7f39af8a6358e73)
1
2# For universe we want to potentially
3# build for multiple MACHINE_ARCH per MACHINE
4# so we need more than MACHINE in TARGET_SPEC
5TARGET_SPEC_VARS?= MACHINE MACHINE_ARCH
6
7# this is sufficient for most of the tree.
8.MAKE.DEPENDFILE_DEFAULT = ${.MAKE.DEPENDFILE_PREFIX}
9
10# but if we have a machine qualified file it should be used in preference
11.MAKE.DEPENDFILE_PREFERENCE = \
12	${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
13	${.MAKE.DEPENDFILE_PREFIX}
14
15# before we process TARGET_SPEC
16# we assume that MK_DIRDEPS_BUILD=yes
17
18# from src/Makefile (for universe)
19# would be nice to have this sort of info in sys.machine.mk
20TARGET_ARCHES_arm?=     armv6 armv7
21TARGET_ARCHES_arm64?=   aarch64
22TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpc64le powerpcspe
23TARGET_ARCHES_riscv?=   riscv64
24
25# some corner cases
26BOOT_MACHINE_DIR.amd64 = boot/i386
27MACHINE_ARCH.host = ${_HOST_ARCH}
28
29# the list of machines we support
30ALL_MACHINE_LIST?= amd64 arm arm64 i386 powerpc riscv
31
32.-include <site.sys.dirdeps.env.mk>
33
34.for m in ${ALL_MACHINE_LIST:O:u}
35MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m}
36MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]}
37BOOT_MACHINE_DIR.$m ?= boot/$m
38.endfor
39
40.if empty(MACHINE_ARCH)
41.if !empty(TARGET_ARCH)
42MACHINE_ARCH= ${TARGET_ARCH}
43.else
44MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
45.endif
46.endif
47MACHINE_ARCH?= ${MACHINE_ARCH.${MACHINE}}
48MACHINE_ARCH:= ${MACHINE_ARCH}
49
50HOST_OBJTOP ?= ${OBJROOT}${HOST_TARGET}
51
52.if ${REQUESTED_MACHINE:U${MACHINE}} == "host"
53MACHINE= host
54.if ${TARGET_MACHINE:Uno} == ${HOST_TARGET}
55# not what we want
56TARGET_MACHINE= host
57.endif
58.endif
59.if ${MACHINE} == "host"
60OBJTOP := ${HOST_OBJTOP}
61MACHINE_ARCH= ${MACHINE_ARCH.${MACHINE}}
62.endif
63
64
65.if ${.MAKE.LEVEL} == 0 || empty(PYTHON)
66PYTHON ?= /usr/local/bin/python
67.export PYTHON
68
69# _SKIP_BUILD is not 100% as it requires wrapping all 'all:' targets to avoid
70# building in MAKELEVEL0.  Just prohibit 'all' entirely in this case to avoid
71# problems.
72.if make(all)
73.error DIRDEPS_BUILD: Please run '${MAKE}' instead of '${MAKE} all'.
74.endif
75.endif
76
77.if ${.MAKE.OS} != "FreeBSD" || ${_HOST_OSREL:R} < ${OS_REVISION:R}
78# a pseudo option to indicate we need libegacy for host
79MK_host_egacy= yes
80.endif
81