1293297Semaste# $FreeBSD: stable/10/sys/boot/efi/boot1/Makefile 319025 2017-05-28 01:14:59Z ngie $ 2293297Semaste 3293297SemasteMAN= 4293297Semaste 5293297Semaste.include <bsd.own.mk> 6293297Semaste 7293297SemasteMK_SSP= no 8293297Semaste 9294268SemastePROG= boot1.sym 10293297SemasteINTERNALPROG= 11294981SsmhWARNS?= 6 12293297Semaste 13294999Ssmh.if ${MK_ZFS} != "no" 14294999Ssmh# Disable warnings that are currently incompatible with the zfs boot code 15294999SsmhCWARNFLAGS.zfs_module.c += -Wno-array-bounds 16294999SsmhCWARNFLAGS.zfs_module.c += -Wno-cast-align 17294999SsmhCWARNFLAGS.zfs_module.c += -Wno-cast-qual 18294999SsmhCWARNFLAGS.zfs_module.c += -Wno-missing-prototypes 19294999SsmhCWARNFLAGS.zfs_module.c += -Wno-sign-compare 20294999SsmhCWARNFLAGS.zfs_module.c += -Wno-unused-parameter 21294999SsmhCWARNFLAGS.zfs_module.c += -Wno-unused-function 22294999Ssmh.endif 23294999Ssmh 24293297Semaste# architecture-specific loader code 25294997SsmhSRCS= boot1.c reloc.c start.S ufs_module.c 26294999Ssmh.if ${MK_ZFS} != "no" 27294999SsmhSRCS+= zfs_module.c 28294999Ssmh.endif 29293297Semaste 30293297SemasteCFLAGS+= -fPIC 31293297SemasteCFLAGS+= -I. 32293297SemasteCFLAGS+= -I${.CURDIR}/../include 33293347SemasteCFLAGS+= -I${.CURDIR}/../include/${MACHINE} 34293297SemasteCFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include 35293297SemasteCFLAGS+= -I${.CURDIR}/../../.. 36294997SsmhCFLAGS+= -DEFI_UFS_BOOT 37294999Ssmh.ifdef(EFI_DEBUG) 38294999SsmhCFLAGS+= -DEFI_DEBUG 39294999Ssmh.endif 40293297Semaste 41294999Ssmh.if ${MK_ZFS} != "no" 42294999SsmhCFLAGS+= -I${.CURDIR}/../../zfs/ 43294999SsmhCFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/ 44294999SsmhCFLAGS+= -DEFI_ZFS_BOOT 45294999Ssmh.endif 46294999Ssmh 47293297Semaste# Always add MI sources and REGULAR efi loader bits 48293347Semaste.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 49293347Semaste.PATH: ${.CURDIR}/../loader 50293347Semaste.PATH: ${.CURDIR}/../../common 51293297SemasteCFLAGS+= -I${.CURDIR}/../../common 52293297Semaste 53293297SemasteFILES= boot1.efi boot1.efifat 54293297SemasteFILESMODE_boot1.efi= ${BINMODE} 55293297Semaste 56293347SemasteLDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 57293649SemasteLDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared 58293297Semaste 59293649Semaste.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 60293649SemasteLDFLAGS+= -Wl,-znocombreloc 61293649Semaste.endif 62293649Semaste 63294726Ssmh# 64294726Ssmh# Add libstand for required string and memory functions for all platforms. 65294726Ssmh# 66294726SsmhDPADD+= ${LIBSTAND} 67294726SsmhLDADD+= -lstand 68294726Ssmh 69294268SemasteDPADD+= ${LDSCRIPT} 70293297Semaste 71297821SemasteNM?= nm 72293297SemasteOBJCOPY?= objcopy 73293297Semaste 74293297Semaste.if ${MACHINE_CPUARCH} == "amd64" 75293297SemasteEFI_TARGET= efi-app-x86_64 76293297Semaste.elif ${MACHINE_CPUARCH} == "i386" 77293297SemasteEFI_TARGET= efi-app-ia32 78293297Semaste.endif 79293297Semaste 80294268Semasteboot1.efi: ${PROG} 81297821Semaste if ${NM} ${.ALLSRC} | grep ' U '; then \ 82297821Semaste echo "Undefined symbols in ${.ALLSRC}"; \ 83293297Semaste exit 1; \ 84293297Semaste fi 85293297Semaste ${OBJCOPY} -j .text -j .sdata -j .data \ 86293297Semaste -j .dynamic -j .dynsym -j .rel.dyn \ 87294268Semaste -j .rela.dyn -j .reloc -j .eh_frame \ 88293297Semaste --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 89293297Semaste 90293297Semasteboot1.o: ${.CURDIR}/../../common/ufsread.c 91293297Semaste 92294268Semaste# The following inserts our objects into a template FAT file system 93293297Semaste# created by generate-fat.sh 94293297Semaste 95293297Semaste.include "${.CURDIR}/Makefile.fat" 96293297Semaste 97293297Semasteboot1.efifat: boot1.efi 98293297Semaste echo ${.OBJDIR} 99293347Semaste uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu 100293347Semaste mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 101293297Semaste bzip2 -f -d ${.TARGET}.bz2 102319025Sngie ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc 103293297Semaste 104294269SemasteCLEANFILES= boot1.efi boot1.efifat 105293297Semaste 106293297Semaste.include <bsd.prog.mk> 107293297Semaste 108293649Semaste.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 109293297Semastebeforedepend ${OBJS}: machine x86 110293297Semaste 111294269SemasteCLEANFILES+= machine x86 112293297Semaste 113293297Semastemachine: 114293297Semaste ln -sf ${.CURDIR}/../../../amd64/include machine 115293297Semaste 116293297Semastex86: 117293297Semaste ln -sf ${.CURDIR}/../../../x86/include x86 118293649Semaste.endif 119