7 # In-tree GCC does not support __attribute__((ms_abi)).
8 .if ${COMPILER_TYPE} != "gcc"
15 # architecture-specific loader code
16 SRCS= boot1.c self_reloc.c start.S
19 CFLAGS+= -I${.CURDIR}/../include
20 CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
21 CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
22 CFLAGS+= -I${.CURDIR}/../../..
24 # Always add MI sources and REGULAR efi loader bits
25 .PATH: ${.CURDIR}/../loader/arch/${MACHINE}
26 .PATH: ${.CURDIR}/../loader
27 .PATH: ${.CURDIR}/../../common
28 CFLAGS+= -I${.CURDIR}/../../common
30 FILES= boot1.efi boot1.efifat
31 FILESMODE_boot1.efi= ${BINMODE}
33 LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
34 LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
36 .if ${MACHINE_CPUARCH} == "aarch64"
37 CFLAGS+= -msoft-float -mgeneral-regs-only
39 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
41 LDFLAGS+= -Wl,-znocombreloc
44 .if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386"
46 # Add libstand for the runtime functions used by the compiler - for example
47 # __aeabi_* (arm) or __divdi3 (i386).
58 .if ${MACHINE_CPUARCH} == "amd64"
59 EFI_TARGET= efi-app-x86_64
60 .elif ${MACHINE_CPUARCH} == "i386"
61 EFI_TARGET= efi-app-ia32
67 if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
68 ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
71 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
72 -j .dynamic -j .dynsym -j .rel.dyn \
73 -j .rela.dyn -j .reloc -j .eh_frame \
74 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
76 boot1.o: ${.CURDIR}/../../common/ufsread.c
78 # The following inserts our objects into a template FAT file system
79 # created by generate-fat.sh
81 .include "${.CURDIR}/Makefile.fat"
83 boot1.efifat: boot1.efi
85 uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
86 mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
87 bzip2 -f -d ${.TARGET}.bz2
88 dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
90 CLEANFILES= boot1.efi boot1.efifat
92 .endif # ${COMPILER_TYPE} != "gcc"
94 .include <bsd.prog.mk>
96 beforedepend ${OBJS}: machine
101 ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
103 .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
104 beforedepend ${OBJS}: x86
108 ln -sf ${.CURDIR}/../../../x86/include x86