Makefile revision 281027
1264391Snwhitehorn# $FreeBSD: head/sys/boot/efi/boot1/Makefile 281027 2015-04-03 15:25:59Z andrew $ 2264391Snwhitehorn 3264925SimpMAN= 4264391Snwhitehorn 5264391Snwhitehorn.include <bsd.own.mk> 6264391Snwhitehorn 7264391Snwhitehorn# In-tree GCC does not support __attribute__((ms_abi)). 8264391Snwhitehorn.if ${COMPILER_TYPE} != "gcc" 9264391Snwhitehorn 10264391SnwhitehornMK_SSP= no 11264391Snwhitehorn 12264391SnwhitehornPROG= loader.sym 13264391SnwhitehornINTERNALPROG= 14264391Snwhitehorn 15264391Snwhitehorn# architecture-specific loader code 16264391SnwhitehornSRCS= boot1.c reloc.c start.S 17264391Snwhitehorn 18264391SnwhitehornCFLAGS+= -fPIC 19264391SnwhitehornCFLAGS+= -I. 20280950SandrewCFLAGS+= -I${.CURDIR}/../include 21280950SandrewCFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH} 22264391SnwhitehornCFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include 23264391SnwhitehornCFLAGS+= -I${.CURDIR}/../../.. 24264391Snwhitehorn 25264403Snwhitehorn# Always add MI sources and REGULAR efi loader bits 26281027Sandrew.PATH: ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH} ${.CURDIR}/../../common 27264391SnwhitehornCFLAGS+= -I${.CURDIR}/../../common 28264391Snwhitehorn 29264975SnwhitehornFILES= boot1.efi boot1.efifat 30264391SnwhitehornFILESMODE_boot1.efi= ${BINMODE} 31264391Snwhitehorn 32280950SandrewLDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE_CPUARCH}/ldscript.${MACHINE_CPUARCH} 33281027SandrewLDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared 34264391Snwhitehorn 35281027Sandrew.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 36281027SandrewLDFLAGS+= -Wl,-znocombreloc 37281027Sandrew.endif 38281027Sandrew 39264391Snwhitehorn${PROG}: ${LDSCRIPT} 40264391Snwhitehorn 41264391SnwhitehornOBJCOPY?= objcopy 42264391SnwhitehornOBJDUMP?= objdump 43264391Snwhitehorn 44264391Snwhitehorn.if ${MACHINE_CPUARCH} == "amd64" 45264391SnwhitehornEFI_TARGET= efi-app-x86_64 46280950Sandrew.elif ${MACHINE_CPUARCH} == "i386" 47264391SnwhitehornEFI_TARGET= efi-app-ia32 48264391Snwhitehorn.endif 49264391Snwhitehorn 50264391Snwhitehornboot1.efi: loader.sym 51264391Snwhitehorn if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \ 52264391Snwhitehorn ${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \ 53264391Snwhitehorn exit 1; \ 54264391Snwhitehorn fi 55264391Snwhitehorn ${OBJCOPY} -j .text -j .sdata -j .data \ 56264391Snwhitehorn -j .dynamic -j .dynsym -j .rel.dyn \ 57264391Snwhitehorn -j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \ 58276146Semaste --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 59264391Snwhitehorn 60264414Snwhitehornboot1.o: ${.CURDIR}/../../common/ufsread.c 61264414Snwhitehorn 62264975Snwhitehorn# The following inserts out objects into a template FAT file system 63264975Snwhitehorn# created by generate-fat.sh 64264975Snwhitehorn 65264975Snwhitehorn.include "${.CURDIR}/Makefile.fat" 66264975Snwhitehorn 67264975Snwhitehornboot1.efifat: boot1.efi 68264975Snwhitehorn echo ${.OBJDIR} 69264975Snwhitehorn uudecode ${.CURDIR}/fat.tmpl.bz2.uu 70264975Snwhitehorn mv fat.tmpl.bz2 ${.TARGET}.bz2 71264975Snwhitehorn bzip2 -f -d ${.TARGET}.bz2 72264975Snwhitehorn dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc 73264975Snwhitehorn 74264975SnwhitehornCLEANFILES= boot1.efifat 75264975Snwhitehorn 76264391Snwhitehorn.endif # ${COMPILER_TYPE} != "gcc" 77264391Snwhitehorn 78264391Snwhitehorn.include <bsd.prog.mk> 79264391Snwhitehorn 80281027Sandrew.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 81264391Snwhitehornbeforedepend ${OBJS}: machine x86 82264391Snwhitehorn 83268975SsbrunoCLEANFILES+= machine x86 boot1.efi 84264391Snwhitehorn 85264391Snwhitehornmachine: 86264391Snwhitehorn ln -sf ${.CURDIR}/../../../amd64/include machine 87264391Snwhitehorn 88264391Snwhitehornx86: 89264391Snwhitehorn ln -sf ${.CURDIR}/../../../x86/include x86 90281027Sandrew.endif 91