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