Makefile revision 294265
11057Salm# $FreeBSD: head/sys/boot/efi/boot1/Makefile 294265 2016-01-18 12:02:05Z smh $ 21057Salm 31057SalmMAN= 41057Salm 51057Salm.include <src.opts.mk> 61057Salm 71057SalmMK_SSP= no 81057Salm 91057SalmPROG= boot1.sym 10INTERNALPROG= 11WARNS?= 6 12 13.if ${MK_ZFS} != "no" 14# Disable warnings that are currently incompatible with the zfs boot code 15CWARNFLAGS.zfs_module.c += -Wno-array-bounds 16CWARNFLAGS.zfs_module.c += -Wno-cast-align 17CWARNFLAGS.zfs_module.c += -Wno-cast-qual 18CWARNFLAGS.zfs_module.c += -Wno-missing-prototypes 19CWARNFLAGS.zfs_module.c += -Wno-sign-compare 20CWARNFLAGS.zfs_module.c += -Wno-unused-parameter 21CWARNFLAGS.zfs_module.c += -Wno-unused-function 22.endif 23 24# architecture-specific loader code 25SRCS= boot1.c self_reloc.c start.S ufs_module.c 26.if ${MK_ZFS} != "no" 27SRCS+= zfs_module.c 28.endif 29 30CFLAGS+= -I. 31CFLAGS+= -I${.CURDIR}/../include 32CFLAGS+= -I${.CURDIR}/../include/${MACHINE} 33CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include 34CFLAGS+= -I${.CURDIR}/../../.. 35CFLAGS+= -DEFI_UFS_BOOT 36.ifdef(EFI_DEBUG) 37CFLAGS+= -DEFI_DEBUG 38.endif 39 40.if ${MK_ZFS} != "no" 41CFLAGS+= -I${.CURDIR}/../../zfs/ 42CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/ 43CFLAGS+= -DEFI_ZFS_BOOT 44.endif 45 46# Always add MI sources and REGULAR efi loader bits 47.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 48.PATH: ${.CURDIR}/../loader 49.PATH: ${.CURDIR}/../../common 50CFLAGS+= -I${.CURDIR}/../../common 51 52FILES= boot1.efi boot1.efifat 53FILESMODE_boot1.efi= ${BINMODE} 54 55LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 56LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared 57 58.if ${MACHINE_CPUARCH} == "aarch64" 59CFLAGS+= -msoft-float -mgeneral-regs-only 60.endif 61.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 62CFLAGS+= -fPIC 63LDFLAGS+= -Wl,-znocombreloc 64.endif 65 66# 67# Add libstand for the runtime functions used by the compiler - for example 68# __aeabi_* (arm) or __divdi3 (i386). 69# as well as required string and memory functions for all platforms. 70# 71DPADD+= ${LIBSTAND} 72LDADD+= -lstand 73 74DPADD+= ${LDSCRIPT} 75 76OBJCOPY?= objcopy 77OBJDUMP?= objdump 78 79.if ${MACHINE_CPUARCH} == "amd64" 80EFI_TARGET= efi-app-x86_64 81.elif ${MACHINE_CPUARCH} == "i386" 82EFI_TARGET= efi-app-ia32 83.else 84EFI_TARGET= binary 85.endif 86 87boot1.efi: ${PROG} 88 if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \ 89 ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \ 90 exit 1; \ 91 fi 92 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 93 -j .dynamic -j .dynsym -j .rel.dyn \ 94 -j .rela.dyn -j .reloc -j .eh_frame \ 95 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 96 97boot1.o: ${.CURDIR}/../../common/ufsread.c 98 99# The following inserts our objects into a template FAT file system 100# created by generate-fat.sh 101 102.include "${.CURDIR}/Makefile.fat" 103BOOT1_MAXSIZE?= 131072 104 105boot1.efifat: boot1.efi 106 @set -- `ls -l boot1.efi`; \ 107 x=$$(($$5-${BOOT1_MAXSIZE})); \ 108 if [ $$x -ge 0 ]; then \ 109 echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\ 110 exit 1; \ 111 fi 112 echo ${.OBJDIR} 113 uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu 114 mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 115 bzip2 -f -d ${.TARGET}.bz2 116 dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc 117 118CLEANFILES= boot1.efi boot1.efifat 119 120.include <bsd.prog.mk> 121 122beforedepend ${OBJS}: machine 123 124CLEANFILES+= machine 125 126machine: 127 ln -sf ${.CURDIR}/../../../${MACHINE}/include machine 128 129.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 130beforedepend ${OBJS}: x86 131CLEANFILES+= x86 132 133x86: 134 ln -sf ${.CURDIR}/../../../x86/include x86 135.endif 136