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 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# Forth interpreter 61.if ${MK_LOADER_LUA} != "no" 62SRCS+= interp_lua.c 63.include "${BOOTSRC}/lua.mk" 64LDR_INTERP= ${LIBLUA} 65LDR_INTERP32= ${LIBLUA32} 66.elif ${MK_FORTH} != "no" 67SRCS+= interp_forth.c 68.include "${BOOTSRC}/ficl.mk" 69LDR_INTERP= ${LIBFICL} 70LDR_INTERP32= ${LIBFICL32} 71.else 72SRCS+= interp_simple.c 73.endif 74 75.if defined(BOOT_PROMPT_123) 76CFLAGS+= -DBOOT_PROMPT_123 77.endif 78 79.if defined(LOADER_INSTALL_SUPPORT) 80SRCS+= install.c 81.endif 82 83# Filesystem support 84.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 85CFLAGS+= -DLOADER_CD9660_SUPPORT 86.endif 87.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 88CFLAGS+= -DLOADER_EXT2FS_SUPPORT 89.endif 90.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 91CFLAGS+= -DLOADER_MSDOS_SUPPORT 92.endif 93.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 94CFLAGS+= -DLOADER_NANDFS_SUPPORT 95.endif 96.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 97CFLAGS+= -DLOADER_UFS_SUPPORT 98.endif 99 100# Compression 101.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 102CFLAGS+= -DLOADER_GZIP_SUPPORT 103.endif 104.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 105CFLAGS+= -DLOADER_BZIP2_SUPPORT 106.endif 107 108# Network related things 109.if ${LOADER_NET_SUPPORT:Uno} == "yes" 110CFLAGS+= -DLOADER_NET_SUPPORT 111.endif 112.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 113CFLAGS+= -DLOADER_NFS_SUPPORT 114.endif 115.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 116CFLAGS+= -DLOADER_TFTP_SUPPORT 117.endif 118 119# Partition support 120.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 121CFLAGS+= -DLOADER_GPT_SUPPORT 122.endif 123.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 124CFLAGS+= -DLOADER_MBR_SUPPORT 125.endif 126 127.if ${HAVE_ZFS:Uno} == "yes" 128CFLAGS+= -DLOADER_ZFS_SUPPORT 129CFLAGS+= -I${ZFSSRC} 130CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 131SRCS+= zfs_cmd.c 132.endif 133 134LIBFICL= ${BOOTOBJ}/ficl/libficl.a 135.if ${MACHINE} == "i386" 136LIBFICL32= ${LIBFICL} 137.else 138LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 139.endif 140 141LIBLUA= ${BOOTOBJ}/liblua/liblua.a 142.if ${MACHINE} == "i386" 143LIBLUA32= ${LIBLUA} 144.else 145LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a 146.endif 147 148CLEANFILES+= vers.c 149VERSION_FILE?= ${.CURDIR}/version 150.if ${MK_REPRODUCIBLE_BUILD} != no 151REPRO_FLAG= -r 152.endif 153vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 154 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 155 ${NEWVERSWHAT} 156 157.if !empty(HELP_FILES) 158HELP_FILES+= ${LDRSRC}/help.common 159 160CLEANFILES+= loader.help 161FILES+= loader.help 162 163loader.help: ${HELP_FILES} 164 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 165.endif 166