1# $FreeBSD$ 2 3.PATH: ${LDRSRC} ${BOOTSRC}/libsa 4 5CFLAGS+=-I${LDRSRC} 6 7SRCS+= boot.c commands.c console.c devopen.c interp.c 8SRCS+= interp_backslash.c interp_parse.c ls.c misc.c 9SRCS+= module.c 10 11.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 12SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 13SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 14.elif ${MACHINE_CPUARCH} == "aarch64" 15SRCS+= load_elf64.c reloc_elf64.c 16.elif ${MACHINE_CPUARCH} == "arm" 17SRCS+= load_elf32.c reloc_elf32.c 18.elif ${MACHINE_CPUARCH} == "powerpc" 19SRCS+= load_elf32.c reloc_elf32.c 20SRCS+= load_elf64.c reloc_elf64.c 21SRCS+= metadata.c 22.elif ${MACHINE_CPUARCH} == "sparc64" 23SRCS+= load_elf64.c reloc_elf64.c 24SRCS+= metadata.c 25.elif ${MACHINE_ARCH:Mmips64*} != "" 26SRCS+= load_elf64.c reloc_elf64.c 27SRCS+= metadata.c 28.elif ${MACHINE} == "mips" 29SRCS+= load_elf32.c reloc_elf32.c 30SRCS+= metadata.c 31.endif 32 33.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 34SRCS+= disk.c part.c vdisk.c 35.endif 36 37.if ${LOADER_NET_SUPPORT:Uno} == "yes" 38SRCS+= dev_net.c 39.endif 40 41.if defined(HAVE_BCACHE) 42SRCS+= bcache.c 43.endif 44 45.if defined(MD_IMAGE_SIZE) 46CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 47SRCS+= md.c 48.else 49CLEANFILES+= md.o 50.endif 51 52# Machine-independant ISA PnP 53.if defined(HAVE_ISABUS) 54SRCS+= isapnp.c 55.endif 56.if defined(HAVE_PNP) 57SRCS+= pnp.c 58.endif 59 60.if ${LOADER_INTERP} == "lua" 61SRCS+= interp_lua.c 62.include "${BOOTSRC}/lua.mk" 63LDR_INTERP= ${LIBLUA} 64LDR_INTERP32= ${LIBLUA32} 65.elif ${LOADER_INTERP} == "4th" 66SRCS+= interp_forth.c 67.include "${BOOTSRC}/ficl.mk" 68LDR_INTERP= ${LIBFICL} 69LDR_INTERP32= ${LIBFICL32} 70.elif ${LOADER_INTERP} == "simp" 71SRCS+= interp_simple.c 72.else 73.error Unknown interpreter ${LOADER_INTERP} 74.endif 75 76.if ${MK_LOADER_VERIEXEC} != "no" 77CFLAGS+= -DLOADER_VERIEXEC -I${SRCTOP}/lib/libsecureboot/h 78.endif 79 80.if ${MK_LOADER_VERIEXEC_PASS_MANIFEST} != "no" 81CFLAGS+= -DLOADER_VERIEXEC_PASS_MANIFEST -I${SRCTOP}/lib/libsecureboot/h 82.endif 83 84.if defined(BOOT_PROMPT_123) 85CFLAGS+= -DBOOT_PROMPT_123 86.endif 87 88.if defined(LOADER_INSTALL_SUPPORT) 89SRCS+= install.c 90.endif 91 92# Filesystem support 93.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 94CFLAGS+= -DLOADER_CD9660_SUPPORT 95.endif 96.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 97CFLAGS+= -DLOADER_EXT2FS_SUPPORT 98.endif 99.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 100CFLAGS+= -DLOADER_MSDOS_SUPPORT 101.endif 102.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 103CFLAGS+= -DLOADER_NANDFS_SUPPORT 104.endif 105.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 106CFLAGS+= -DLOADER_UFS_SUPPORT 107.endif 108 109# Compression 110.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 111CFLAGS+= -DLOADER_GZIP_SUPPORT 112.endif 113.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 114CFLAGS+= -DLOADER_BZIP2_SUPPORT 115.endif 116 117# Network related things 118.if ${LOADER_NET_SUPPORT:Uno} == "yes" 119CFLAGS+= -DLOADER_NET_SUPPORT 120.endif 121.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 122CFLAGS+= -DLOADER_NFS_SUPPORT 123.endif 124.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 125CFLAGS+= -DLOADER_TFTP_SUPPORT 126.endif 127 128# Partition support 129.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 130CFLAGS+= -DLOADER_GPT_SUPPORT 131.endif 132.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 133CFLAGS+= -DLOADER_MBR_SUPPORT 134.endif 135 136.if ${HAVE_ZFS:Uno} == "yes" 137CFLAGS+= -DLOADER_ZFS_SUPPORT 138CFLAGS+= -I${ZFSSRC} 139CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 140SRCS+= zfs_cmd.c 141.endif 142 143LIBFICL= ${BOOTOBJ}/ficl/libficl.a 144.if ${MACHINE} == "i386" 145LIBFICL32= ${LIBFICL} 146.else 147LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 148.endif 149 150LIBLUA= ${BOOTOBJ}/liblua/liblua.a 151.if ${MACHINE} == "i386" 152LIBLUA32= ${LIBLUA} 153.else 154LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a 155.endif 156 157CLEANFILES+= vers.c 158VERSION_FILE?= ${.CURDIR}/version 159.if ${MK_REPRODUCIBLE_BUILD} != no 160REPRO_FLAG= -r 161.endif 162vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 163 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 164 ${NEWVERSWHAT} 165 166.if ${MK_LOADER_VERBOSE} != "no" 167CFLAGS+= -DELF_VERBOSE 168.endif 169 170.if !empty(HELP_FILES) 171HELP_FILES+= ${LDRSRC}/help.common 172 173CLEANFILES+= loader.help 174FILES+= loader.help 175 176loader.help: ${HELP_FILES} 177 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 178.endif 179