Makefile revision 296769
144301Swollman# $FreeBSD: head/sys/boot/efi/boot1/Makefile 296769 2016-03-12 21:44:33Z emaste $ 244301Swollman 344301SwollmanMAN= 493151Sphk 544301Swollman.include <src.opts.mk> 644301Swollman 744301SwollmanMK_SSP= no 844301Swollman 944301SwollmanPROG= boot1.sym 1050476SpeterINTERNALPROG= 1144301SwollmanWARNS?= 6 12263955Sgjb 1344301Swollman.if ${MK_ZFS} != "no" 1479531Sru# Disable warnings that are currently incompatible with the zfs boot code 1544301SwollmanCWARNFLAGS.zfs_module.c += -Wno-array-bounds 1644301SwollmanCWARNFLAGS.zfs_module.c += -Wno-cast-align 1744301SwollmanCWARNFLAGS.zfs_module.c += -Wno-cast-qual 1844301SwollmanCWARNFLAGS.zfs_module.c += -Wno-missing-prototypes 1944301SwollmanCWARNFLAGS.zfs_module.c += -Wno-sign-compare 2044301SwollmanCWARNFLAGS.zfs_module.c += -Wno-unused-parameter 2174385SphkCWARNFLAGS.zfs_module.c += -Wno-unused-function 2244301Swollman.endif 2344301Swollman 2459512Sphantom# architecture-specific loader code 2559512SphantomSRCS= boot1.c self_reloc.c start.S ufs_module.c 2644301Swollman.if ${MK_ZFS} != "no" 2784306SruSRCS+= zfs_module.c 2884306Sru.endif 2944301Swollman 3044301SwollmanCFLAGS+= -I. 3144301SwollmanCFLAGS+= -I${.CURDIR}/../include 3244301SwollmanCFLAGS+= -I${.CURDIR}/../include/${MACHINE} 3344301SwollmanCFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include 3444301SwollmanCFLAGS+= -I${.CURDIR}/../../.. 3544301SwollmanCFLAGS+= -DEFI_UFS_BOOT 3644301Swollman.ifdef(EFI_DEBUG) 3744301SwollmanCFLAGS+= -DEFI_DEBUG 3844301Swollman.endif 3944301Swollman 4074385Sphk.if ${MK_ZFS} != "no" 4174385SphkCFLAGS+= -I${.CURDIR}/../../zfs/ 4244301SwollmanCFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/ 4344301SwollmanCFLAGS+= -DEFI_ZFS_BOOT 4444301Swollman.endif 4544301Swollman 4644301Swollman# Always add MI sources and REGULAR efi loader bits 47120957Shmp.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 48120957Shmp.PATH: ${.CURDIR}/../loader 4944301Swollman.PATH: ${.CURDIR}/../../common 50120957ShmpCFLAGS+= -I${.CURDIR}/../../common 51120957Shmp 52120957ShmpFILES= boot1.efi boot1.efifat 53141846SruFILESMODE_boot1.efi= ${BINMODE} 5444301Swollman 5544301SwollmanLDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 56131539SruLDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared 5744301Swollman 5844301Swollman.if ${MACHINE_CPUARCH} == "aarch64" 5944301SwollmanCFLAGS+= -msoft-float -mgeneral-regs-only 60120957Shmp.endif 61120957Shmp.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 62120957ShmpCFLAGS+= -fPIC 63120957ShmpLDFLAGS+= -Wl,-znocombreloc 6444301Swollman.endif 6544301Swollman 6644301Swollman# 6744301Swollman# Add libstand for the runtime functions used by the compiler - for example 6844301Swollman# __aeabi_* (arm) or __divdi3 (i386). 6944301Swollman# as well as required string and memory functions for all platforms. 70112541Scharnier# 7144301SwollmanDPADD+= ${LIBSTAND} 72112541ScharnierLDADD+= -lstand 7344301Swollman 7444301SwollmanDPADD+= ${LDSCRIPT} 7544301Swollman 7644301SwollmanNM?= nm 7744301SwollmanOBJCOPY?= objcopy 7844301Swollman 79112541Scharnier.if ${MACHINE_CPUARCH} == "amd64" 8044301SwollmanEFI_TARGET= efi-app-x86_64 81112541Scharnier.elif ${MACHINE_CPUARCH} == "i386" 8244301SwollmanEFI_TARGET= efi-app-ia32 8344301Swollman.else 8444301SwollmanEFI_TARGET= binary 85112541Scharnier.endif 8674385Sphk 87112541Scharnierboot1.efi: ${PROG} 8874385Sphk if ${NM} ${.ALLSRC} | grep ' U '; then \ 8974385Sphk echo "Undefined symbols in ${.ALLSRC}"; \ 9074385Sphk exit 1; \ 9175161Sru fi 9274385Sphk ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 9375161Sru -j .dynamic -j .dynsym -j .rel.dyn \ 9474385Sphk -j .rela.dyn -j .reloc -j .eh_frame \ 9574385Sphk --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 9675161Sru 9774385Sphkboot1.o: ${.CURDIR}/../../common/ufsread.c 9874385Sphk 9974385Sphk# The following inserts our objects into a template FAT file system 10074385Sphk# created by generate-fat.sh 10175161Sru 10274385Sphk.include "${.CURDIR}/Makefile.fat" 103112541ScharnierBOOT1_MAXSIZE?= 131072 10444301Swollman 105112541Scharnierboot1.efifat: boot1.efi 10644301Swollman @set -- `ls -l boot1.efi`; \ 10744301Swollman x=$$(($$5-${BOOT1_MAXSIZE})); \ 10844301Swollman if [ $$x -ge 0 ]; then \ 10944301Swollman echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\ 11044301Swollman exit 1; \ 11144301Swollman fi 11244301Swollman echo ${.OBJDIR} 11344301Swollman uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu 11479754Sdd mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 11575161Sru bzip2 -f -d ${.TARGET}.bz2 11644301Swollman dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc \ 11744301Swollman status=none 11844301Swollman 11944301SwollmanCLEANFILES= boot1.efi boot1.efifat 12044301Swollman 12144301Swollman.include <bsd.prog.mk> 12279754Sdd 12375161Srubeforedepend ${OBJS}: machine 12444301Swollman 12544301SwollmanCLEANFILES+= machine 12644301Swollman 12744301Swollmanmachine: .NOMETA 12844301Swollman ln -sf ${.CURDIR}/../../../${MACHINE}/include machine 129140505Sru 130140505Sru.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 131140505Srubeforedepend ${OBJS}: x86 13244301SwollmanCLEANFILES+= x86 13344301Swollman 13444301Swollmanx86: .NOMETA 13544301Swollman ln -sf ${.CURDIR}/../../../x86/include x86 13644301Swollman.endif 13744301Swollman