1# $FreeBSD$ 2 3.include "defs.mk" 4 5.PATH: ${LDRSRC} ${BOOTSRC}/libsa 6 7CFLAGS+=-I${LDRSRC} 8 9SRCS+= boot.c commands.c console.c devopen.c interp.c 10SRCS+= interp_backslash.c interp_parse.c ls.c misc.c 11SRCS+= module.c 12 13.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" 14SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c 15SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c 16.elif ${MACHINE_CPUARCH} == "aarch64" 17SRCS+= load_elf64.c reloc_elf64.c 18.elif ${MACHINE_CPUARCH} == "arm" 19SRCS+= load_elf32.c reloc_elf32.c 20.elif ${MACHINE_CPUARCH} == "powerpc" 21SRCS+= load_elf32.c reloc_elf32.c 22SRCS+= load_elf64.c reloc_elf64.c 23.elif ${MACHINE_CPUARCH} == "sparc64" 24SRCS+= load_elf64.c reloc_elf64.c 25.elif ${MACHINE_ARCH:Mmips64*} != "" 26SRCS+= load_elf64.c reloc_elf64.c 27.elif ${MACHINE} == "mips" 28SRCS+= load_elf32.c reloc_elf32.c 29.endif 30 31.if ${LOADER_DISK_SUPPORT:Uyes} == "yes" 32SRCS+= disk.c part.c 33.endif 34 35.if ${LOADER_NET_SUPPORT:Uno} == "yes" 36SRCS+= dev_net.c 37.endif 38 39.if defined(HAVE_BCACHE) 40SRCS+= bcache.c 41.endif 42 43.if defined(MD_IMAGE_SIZE) 44CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE} 45SRCS+= md.c 46.else 47CLEANFILES+= md.o 48.endif 49 50# Machine-independant ISA PnP 51.if defined(HAVE_ISABUS) 52SRCS+= isapnp.c 53.endif 54.if defined(HAVE_PNP) 55SRCS+= pnp.c 56.endif 57 58# Forth interpreter 59.if ${MK_FORTH} != "no" 60SRCS+= interp_forth.c 61.include "${BOOTSRC}/ficl.mk" 62.endif 63 64.if defined(BOOT_PROMPT_123) 65CFLAGS+= -DBOOT_PROMPT_123 66.endif 67 68.if defined(LOADER_INSTALL_SUPPORT) 69SRCS+= install.c 70.endif 71 72# Filesystem support 73.if ${LOADER_CD9660_SUPPORT:Uno} == "yes" 74CFLAGS+= -DLOADER_CD9660_SUPPORT 75.endif 76.if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes" 77CFLAGS+= -DLOADER_EXT2FS_SUPPORT 78.endif 79.if ${LOADER_MSDOS_SUPPORT:Uno} == "yes" 80CFLAGS+= -DLOADER_MSDOS_SUPPORT 81.endif 82.if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes" 83CFLAGS+= -DLOADER_NANDFS_SUPPORT 84.endif 85.if ${LOADER_UFS_SUPPORT:Uyes} == "yes" 86CFLAGS+= -DLOADER_UFS_SUPPORT 87.endif 88 89# Compression 90.if ${LOADER_GZIP_SUPPORT:Uno} == "yes" 91CFLAGS+= -DLOADER_GZIP_SUPPORT 92.endif 93.if ${LOADER_BZIP2_SUPPORT:Uno} == "yes" 94CFLAGS+= -DLOADER_BZIP2_SUPPORT 95.endif 96 97# Network related things 98.if ${LOADER_NET_SUPPORT:Uno} == "yes" 99CFLAGS+= -DLOADER_NET_SUPPORT 100.endif 101.if ${LOADER_NFS_SUPPORT:Uno} == "yes" 102CFLAGS+= -DLOADER_NFS_SUPPORT 103.endif 104.if ${LOADER_TFTP_SUPPORT:Uno} == "yes" 105CFLAGS+= -DLOADER_TFTP_SUPPORT 106.endif 107 108# Partition support 109.if ${LOADER_GPT_SUPPORT:Uyes} == "yes" 110CFLAGS+= -DLOADER_GPT_SUPPORT 111.endif 112.if ${LOADER_MBR_SUPPORT:Uyes} == "yes" 113CFLAGS+= -DLOADER_MBR_SUPPORT 114.endif 115 116.if defined(HAVE_ZFS) 117CFLAGS+= -DLOADER_ZFS_SUPPORT 118CFLAGS+= -I${ZFSSRC} 119CFLAGS+= -I${SYSDIR}/cddl/boot/zfs 120.if ${MACHINE} == "amd64" 121# Have to override to use 32-bit version of zfs library... 122# kinda lame to select that there XXX 123LIBZFSBOOT= ${BOOTOBJ}/zfs32/libzfsboot.a 124.else 125LIBZFSBOOT= ${BOOTOBJ}/zfs/libzfsboot.a 126.endif 127.endif 128 129# NB: The makefiles depend on these being empty when we don't build forth. 130.if ${MK_FORTH} != "no" 131LIBFICL= ${BOOTOBJ}/ficl/libficl.a 132.if ${MACHINE} == "i386" 133LIBFICL32= ${LIBFICL} 134.else 135LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a 136.endif 137.endif 138 139CLEANFILES+= vers.c 140VERSION_FILE?= ${.CURDIR}/version 141.if ${MK_REPRODUCIBLE_BUILD} != no 142REPRO_FLAG= -r 143.endif 144vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} 145 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \ 146 ${NEWVERSWHAT} 147 148.if !empty(HELP_FILES) 149HELP_FILES+= ${LDRSRC}/help.common 150 151CLEANFILES+= loader.help 152FILES+= loader.help 153 154loader.help: ${HELP_FILES} 155 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} 156.endif 157