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