xref: /freebsd/stand/Makefile.inc (revision cdadbf097128130443a6dc84e756ffcbe925d3d9)
1# $FreeBSD$
2
3.include "defs.mk"
4
5.if !defined(__BOOT_MAKEFILE_INC__)
6__BOOT_MAKEFILE_INC__=${MFILE}
7
8CFLAGS+=-I${SASRC}
9
10SSP_CFLAGS=
11
12# Add in the no float / no SIMD stuff and announce we're freestanding
13# aarch64 and riscv don't have -msoft-float, but all others do. riscv
14# currently has no /boot/loader, but may soon.
15CFLAGS+=	-ffreestanding ${CFLAGS_NO_SIMD}
16.if ${MACHINE_CPUARCH} == "aarch64"
17CFLAGS+=	-mgeneral-regs-only
18.elif ${MACHINE_CPUARCH} != "riscv"
19CFLAGS+=	-msoft-float
20.endif
21
22.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1)
23CFLAGS+=	-march=i386
24CFLAGS.gcc+=	-mpreferred-stack-boundary=2
25.endif
26
27
28.if ${MACHINE_CPUARCH} == "arm"
29# Do not generate movt/movw, because the relocation fixup for them does not
30# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
31# Also, the fpu is not available in a standalone environment.
32.if ${COMPILER_VERSION} < 30800
33CFLAGS.clang+=	-mllvm -arm-use-movt=0
34.else
35CFLAGS.clang+=	-mno-movt
36.endif
37CFLAGS.clang+=  -mfpu=none
38.endif
39
40# The boot loader build uses dd status=none, where possible, for reproducible
41# build output (since performance varies from run to run). Trouble is that
42# option was recently (10.3) added to FreeBSD and is non-standard. Only use it
43# when this test succeeds rather than require dd to be a bootstrap tool.
44DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true
45DD=dd ${DD_NOSTATUS}
46
47.if ${MK_LOADER_FORCE_LE} != "no"
48.if ${MACHINE_ARCH} == "powerpc64"
49CFLAGS+=	-mlittle-endian
50.endif
51.endif
52
53.endif
54