xref: /freebsd/stand/efi/Makefile.inc (revision 22921f4b4aedb5017b727e62045130ab69c3dd1b)
1*22921f4bSEd Maste.include <src.opts.mk>
2*22921f4bSEd Maste
3ca987d46SWarner Losh# Options used when building app-specific efi components
4ca987d46SWarner Losh# See conf/kern.mk for the correct set of these
58a4217aaSWarner LoshCFLAGS+=	-Wformat
6ca987d46SWarner LoshLDFLAGS+=	-nostdlib
7ca987d46SWarner Losh
8ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "amd64"
9ca987d46SWarner LoshCFLAGS+=	-fshort-wchar
10ca987d46SWarner LoshCFLAGS+=	-mno-red-zone
11ca987d46SWarner Losh.endif
12ca987d46SWarner Losh
13ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "aarch64"
14ca987d46SWarner LoshCFLAGS+=	-fshort-wchar
15ca987d46SWarner LoshCFLAGS+=	-fPIC
16ca987d46SWarner Losh.endif
17ca987d46SWarner Losh
18ca987d46SWarner Losh.if ${MACHINE_CPUARCH} == "arm"
19ca987d46SWarner LoshCFLAGS+=	-fPIC
20ca987d46SWarner Losh.endif
21ca987d46SWarner Losh
221f9bd5f6SWarner Losh.if ${MACHINE_CPUARCH} == "amd64"
23f8ca5d45SAhmad Khalifa.if ${DO32:U0} == 1
24f8ca5d45SAhmad KhalifaEFI_TARGET=	efi-app-ia32
25f8ca5d45SAhmad Khalifa.else
261f9bd5f6SWarner LoshEFI_TARGET=	efi-app-x86_64
27f8ca5d45SAhmad Khalifa.endif
281f9bd5f6SWarner Losh.else
291f9bd5f6SWarner LoshEFI_TARGET=	binary
301f9bd5f6SWarner Losh.endif
31*22921f4bSEd Maste
32*22921f4bSEd Maste# GNU or ELF Tool Chain objcopy is usable for building EFI objects.
33*22921f4bSEd Maste# LLVM objcopy is not.  Use elfcopy if we've bootstrapped it (and thus
34*22921f4bSEd Maste# known to be available) or objcopy is LLVM's.
35*22921f4bSEd Maste.if ${MK_ELFTOOLCHAIN_BOOTSTRAP} != "no"
36b885643bSEd MasteEFI_OBJCOPY?=	elfcopy
37*22921f4bSEd Maste.else
38*22921f4bSEd Maste_v!=		${OBJCOPY} --version
39*22921f4bSEd Maste.if ${_v:Mllvm-objcopy*} == ""
40*22921f4bSEd MasteEFI_OBJCOPY?=	${OBJCOPY}
41*22921f4bSEd Maste.else
42*22921f4bSEd MasteEFI_OBJCOPY?=	elfcopy
43*22921f4bSEd Maste.endif
44*22921f4bSEd Maste.endif
451f9bd5f6SWarner Losh
461b9cfd6aSEd Maste# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2024 00:00:00
471f9bd5f6SWarner Losh# for build reproducibility.
481b9cfd6aSEd MasteSOURCE_DATE_EPOCH?=1704067200
491f9bd5f6SWarner Losh
50ca987d46SWarner Losh.include "../Makefile.inc"
51