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