xref: /freebsd/stand/loader.mk (revision ca987d4641cdcd7f27e153db17c5bf064934faf5)
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.if defined(HAVE_ZFS)
73CFLAGS+=	-DLOADER_ZFS_SUPPORT
74CFLAGS+=	-I${ZFSSRC}
75CFLAGS+=	-I${SYSDIR}/cddl/boot/zfs
76.if ${MACHINE} == "amd64"
77# Have to override to use 32-bit version of zfs library...
78# kinda lame to select that there XXX
79LIBZFSBOOT=	${BOOTOBJ}/zfs32/libzfsboot.a
80.else
81LIBZFSBOOT=	${BOOTOBJ}/zfs/libzfsboot.a
82.endif
83.endif
84
85CLEANFILES+=	vers.c
86VERSION_FILE?=	${.CURDIR}/version
87.if ${MK_REPRODUCIBLE_BUILD} != no
88REPRO_FLAG=	-r
89.endif
90vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
91	sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
92	    ${NEWVERSWHAT}
93
94.if !empty(HELP_FILES)
95CLEANFILES+=	loader.help
96FILES+=		loader.help
97
98loader.help: ${HELP_FILES}
99	cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}
100.endif
101