1 2.PATH: ${LDRSRC} ${BOOTSRC}/libsa 3 4CFLAGS+=-I${LDRSRC} 5 6SRCS+= boot.c commands.c console.c devopen.c interp.c 7SRCS+= interp_backslash.c interp_parse.c ls.c misc.c 8SRCS+= modinfo.c 9SRCS+= module.c nvstore.c pnglite.c tslog.c 10 11CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite 12 13.PATH: ${SRCTOP}/contrib/pnglite 14CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite 15CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib 16 17.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 18SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 19SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 20.elif ${MACHINE_CPUARCH} == "aarch64" 21SRCS+= load_elf64.c reloc_elf64.c 22.elif ${MACHINE_CPUARCH} == "arm" 23SRCS+= load_elf32.c reloc_elf32.c 24.elif ${MACHINE_CPUARCH} == "powerpc" 25SRCS+= load_elf32.c reloc_elf32.c 26SRCS+= load_elf64.c reloc_elf64.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-independent 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.include "${BOOTSRC}/veriexec.mk" 79 80.if defined(BOOT_PROMPT_123) 81CFLAGS+= -DBOOT_PROMPT_123 82.endif 83 84.if defined(LOADER_INSTALL_SUPPORT) 85SRCS+= install.c 86.endif 87 88# Filesystem support 89.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 90CFLAGS+= -DLOADER_CD9660_SUPPORT 91.endif 92.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 93CFLAGS+= -DLOADER_EXT2FS_SUPPORT 94.endif 95.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 96CFLAGS+= -DLOADER_MSDOS_SUPPORT 97.endif 98.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 99CFLAGS+= -DLOADER_UFS_SUPPORT 100.endif 101 102# Compression 103.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 104CFLAGS+= -DLOADER_GZIP_SUPPORT 105.endif 106.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 107CFLAGS+= -DLOADER_BZIP2_SUPPORT 108.endif 109 110# Network related things 111.if ${LOADER_NET_SUPPORT:Uno} == "yes" 112CFLAGS+= -DLOADER_NET_SUPPORT 113.endif 114.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 115CFLAGS+= -DLOADER_NFS_SUPPORT 116.endif 117.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 118CFLAGS+= -DLOADER_TFTP_SUPPORT 119.endif 120 121# Partition support 122.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 123CFLAGS+= -DLOADER_GPT_SUPPORT 124.endif 125.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 126CFLAGS+= -DLOADER_MBR_SUPPORT 127.endif 128 129.if ${HAVE_ZFS:Uno} == "yes" 130CFLAGS+= -DLOADER_ZFS_SUPPORT 131CFLAGS+= -I${ZFSSRC} 132CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 133CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common 134SRCS+= zfs_cmd.c 135.endif 136 137LIBFICL= ${BOOTOBJ}/ficl/libficl.a 138.if ${MACHINE} == "i386" 139LIBFICL32= ${LIBFICL} 140.else 141LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 142.endif 143 144LIBLUA= ${BOOTOBJ}/liblua/liblua.a 145.if ${MACHINE} == "i386" 146LIBLUA32= ${LIBLUA} 147.else 148LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a 149.endif 150 151CLEANFILES+= vers.c 152VERSION_FILE?= ${.CURDIR}/version 153.if ${MK_REPRODUCIBLE_BUILD} != no 154REPRO_FLAG= -r 155.endif 156vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 157 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 158 ${NEWVERSWHAT} 159 160.if ${MK_LOADER_VERBOSE} != "no" 161CFLAGS+= -DELF_VERBOSE 162.endif 163 164# Each loader variant defines their own help filename. Optional or 165# build-specific commands are included by augmenting HELP_FILES. 166.if !defined(HELP_FILENAME) 167.error Define HELP_FILENAME before including loader.mk 168.endif 169 170HELP_FILES+= ${LDRSRC}/help.common 171 172CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\" 173.if ${INSTALL_LOADER_HELP_FILE:Uyes} == "yes" 174CLEANFILES+= ${HELP_FILENAME} 175FILES+= ${HELP_FILENAME} 176.endif 177 178${HELP_FILENAME}: ${HELP_FILES} 179 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 180