3 .PATH: ${LDRSRC} ${BOOTSRC}/libsa
7 SRCS+= boot.c commands.c console.c devopen.c interp.c
8 SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
10 SRCS+= module.c nvstore.c pnglite.c tslog.c
12 CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
14 .PATH: ${SRCTOP}/contrib/pnglite
15 CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite
16 CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
18 .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
19 SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
20 SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
21 .elif ${MACHINE_CPUARCH} == "aarch64"
22 SRCS+= load_elf64.c reloc_elf64.c
23 .elif ${MACHINE_CPUARCH} == "arm"
24 SRCS+= load_elf32.c reloc_elf32.c
25 .elif ${MACHINE_CPUARCH} == "powerpc"
26 SRCS+= load_elf32.c reloc_elf32.c
27 SRCS+= load_elf64.c reloc_elf64.c
29 .elif ${MACHINE_ARCH:Mmips64*} != ""
30 SRCS+= load_elf64.c reloc_elf64.c
32 .elif ${MACHINE} == "mips"
33 SRCS+= load_elf32.c reloc_elf32.c
35 .elif ${MACHINE_CPUARCH} == "riscv"
36 SRCS+= load_elf64.c reloc_elf64.c
40 .if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
41 CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
42 SRCS+= disk.c part.c vdisk.c
45 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
49 .if defined(HAVE_BCACHE)
53 .if defined(MD_IMAGE_SIZE)
54 CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
60 # Machine-independent ISA PnP
61 .if defined(HAVE_ISABUS)
68 .if ${LOADER_INTERP} == "lua"
70 .include "${BOOTSRC}/lua.mk"
72 LDR_INTERP32= ${LIBLUA32}
73 CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules
74 .elif ${LOADER_INTERP} == "4th"
76 .include "${BOOTSRC}/ficl.mk"
77 LDR_INTERP= ${LIBFICL}
78 LDR_INTERP32= ${LIBFICL32}
79 .elif ${LOADER_INTERP} == "simp"
80 SRCS+= interp_simple.c
82 .error Unknown interpreter ${LOADER_INTERP}
85 .include "${BOOTSRC}/veriexec.mk"
87 .if defined(BOOT_PROMPT_123)
88 CFLAGS+= -DBOOT_PROMPT_123
91 .if defined(LOADER_INSTALL_SUPPORT)
96 .if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
97 CFLAGS+= -DLOADER_CD9660_SUPPORT
99 .if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
100 CFLAGS+= -DLOADER_EXT2FS_SUPPORT
102 .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
103 CFLAGS+= -DLOADER_MSDOS_SUPPORT
105 .if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
106 CFLAGS+= -DLOADER_UFS_SUPPORT
110 .if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
111 CFLAGS+= -DLOADER_GZIP_SUPPORT
113 .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
114 CFLAGS+= -DLOADER_BZIP2_SUPPORT
117 # Network related things
118 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
119 CFLAGS+= -DLOADER_NET_SUPPORT
121 .if ${LOADER_NFS_SUPPORT:Uno} == "yes"
122 CFLAGS+= -DLOADER_NFS_SUPPORT
124 .if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
125 CFLAGS+= -DLOADER_TFTP_SUPPORT
129 .if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
130 CFLAGS+= -DLOADER_GPT_SUPPORT
132 .if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
133 CFLAGS+= -DLOADER_MBR_SUPPORT
136 .if ${HAVE_ZFS:Uno} == "yes"
137 CFLAGS+= -DLOADER_ZFS_SUPPORT
139 CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
140 CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
144 LIBFICL= ${BOOTOBJ}/ficl/libficl.a
145 .if ${MACHINE} == "i386"
146 LIBFICL32= ${LIBFICL}
148 LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a
151 LIBLUA= ${BOOTOBJ}/liblua/liblua.a
152 .if ${MACHINE} == "i386"
155 LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a
159 VERSION_FILE?= ${.CURDIR}/version
160 .if ${MK_REPRODUCIBLE_BUILD} != no
163 vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
164 sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
167 .if ${MK_LOADER_VERBOSE} != "no"
168 CFLAGS+= -DELF_VERBOSE
171 # Each loader variant defines their own help filename. Optional or
172 # build-specific commands are included by augmenting HELP_FILES.
173 .if !defined(HELP_FILENAME)
174 .error Define HELP_FILENAME before including loader.mk
177 HELP_FILES+= ${LDRSRC}/help.common
179 CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\"
180 CLEANFILES+= ${HELP_FILENAME}
181 FILES+= ${HELP_FILENAME}
183 ${HELP_FILENAME}: ${HELP_FILES}
184 cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}