Makefile revision 328866
1# $FreeBSD: stable/11/sys/boot/efi/boot1/Makefile 328866 2018-02-05 04:00:59Z kevans $ 2 3MAN= 4 5.include <src.opts.mk> 6 7MK_SSP= no 8 9PROG= 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 22CWARNFLAGS.skein.c += -Wno-cast-align 23.if ${COMPILER_TYPE} == "clang" 24CWARNFLAGS.skein.c += -Wno-missing-variable-declarations 25.else if ${COMPILER_TYPE} == "gcc" 26CWARNFLAGS.skein.c += -Wno-missing-declarations 27.endif 28.endif 29 30# architecture-specific loader code 31SRCS= boot1.c self_reloc.c start.S ufs_module.c 32.if ${MK_ZFS} != "no" 33SRCS+= zfs_module.c 34SRCS+= skein.c skein_block.c 35# Do not unroll skein loops, reduce code size 36CFLAGS+= -DSKEIN_LOOP=111 37.PATH: ${.CURDIR}/../../../crypto/skein 38.endif 39 40.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} > 40201 41CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized 42.endif 43 44CFLAGS+= -I. 45CFLAGS+= -I${.CURDIR}/../include 46CFLAGS+= -I${.CURDIR}/../include/${MACHINE} 47CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include 48CFLAGS+= -I${.CURDIR}/../../.. 49CFLAGS+= -DEFI_UFS_BOOT 50.ifdef(EFI_DEBUG) 51CFLAGS+= -DEFI_DEBUG 52.endif 53 54.if ${MK_ZFS} != "no" 55CFLAGS+= -I${.CURDIR}/../../zfs/ 56CFLAGS+= -I${.CURDIR}/../../../cddl/boot/zfs/ 57CFLAGS+= -I${.CURDIR}/../../../crypto/skein 58CFLAGS+= -DEFI_ZFS_BOOT 59.endif 60 61# Always add MI sources and REGULAR efi loader bits 62.PATH: ${.CURDIR}/../loader/arch/${MACHINE} 63.PATH: ${.CURDIR}/../loader 64.PATH: ${.CURDIR}/../../common 65CFLAGS+= -I${.CURDIR}/../../common 66 67FILES= boot1.efi boot1.efifat 68FILESMODE_boot1.efi= ${BINMODE} 69 70LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE} 71LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared 72 73.if ${MACHINE_CPUARCH} == "aarch64" 74CFLAGS+= -msoft-float -mgeneral-regs-only 75.endif 76.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 77CFLAGS+= -fPIC 78LDFLAGS+= -Wl,-znocombreloc 79.endif 80 81# 82# Add libstand for the runtime functions used by the compiler - for example 83# __aeabi_* (arm) or __divdi3 (i386). 84# as well as required string and memory functions for all platforms. 85# 86DPADD+= ${LIBSTAND} 87LDADD+= -lstand 88 89DPADD+= ${LDSCRIPT} 90 91NM?= nm 92OBJCOPY?= objcopy 93 94.if ${MACHINE_CPUARCH} == "amd64" 95EFI_TARGET= efi-app-x86_64 96.elif ${MACHINE_CPUARCH} == "i386" 97EFI_TARGET= efi-app-ia32 98.else 99EFI_TARGET= binary 100.endif 101 102# Arbitrarily set the PE/COFF header timestamps to 1 Jan 2016 00:00:00 103# for build reproducibility. 104SOURCE_DATE_EPOCH?=1451606400 105boot1.efi: ${PROG} 106 if ${NM} ${.ALLSRC} | grep ' U '; then \ 107 echo "Undefined symbols in ${.ALLSRC}"; \ 108 exit 1; \ 109 fi 110 SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \ 111 ${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \ 112 -j .dynamic -j .dynsym -j .rel.dyn \ 113 -j .rela.dyn -j .reloc -j .eh_frame \ 114 --output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET} 115 116boot1.o: ${.CURDIR}/../../common/ufsread.c 117 118# The following inserts our objects into a template FAT file system 119# created by generate-fat.sh 120 121.include "${.CURDIR}/Makefile.fat" 122BOOT1_MAXSIZE?= 131072 123 124boot1.efifat: boot1.efi 125 @set -- `ls -l ${.ALLSRC}`; \ 126 x=$$(($$5-${BOOT1_MAXSIZE})); \ 127 if [ $$x -ge 0 ]; then \ 128 echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\ 129 exit 1; \ 130 fi 131 echo ${.OBJDIR} 132 uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu 133 mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2 134 bzip2 -f -d ${.TARGET}.bz2 135 ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc 136 137CLEANFILES= boot1.efi boot1.efifat 138 139.include <bsd.prog.mk> 140 141beforedepend ${OBJS}: machine 142 143CLEANFILES+= machine 144 145machine: .NOMETA 146 ln -sf ${.CURDIR}/../../../${MACHINE}/include machine 147 148.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" 149beforedepend ${OBJS}: x86 150CLEANFILES+= x86 151 152x86: .NOMETA 153 ln -sf ${.CURDIR}/../../../x86/include x86 154.endif 155