]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/loader.mk
Make __libsys_interposing_slot libsys only
[FreeBSD/FreeBSD.git] / stand / loader.mk
1
2 .PATH: ${LDRSRC} ${BOOTSRC}/libsa
3
4 CFLAGS+=-I${LDRSRC}
5
6 SRCS+=  boot.c commands.c console.c devopen.c interp.c 
7 SRCS+=  interp_backslash.c interp_parse.c ls.c misc.c 
8 SRCS+=  modinfo.c
9 SRCS+=  module.c nvstore.c pnglite.c tslog.c
10
11 CFLAGS.module.c += -I$(SRCTOP)/sys/teken -I${SRCTOP}/contrib/pnglite
12
13 .PATH: ${SRCTOP}/contrib/pnglite
14 CFLAGS.pnglite.c+= -I${SRCTOP}/contrib/pnglite
15 CFLAGS.pnglite.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
16
17 .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
18 SRCS+=  load_elf32.c load_elf32_obj.c reloc_elf32.c
19 SRCS+=  load_elf64.c load_elf64_obj.c reloc_elf64.c
20 .elif ${MACHINE_CPUARCH} == "aarch64"
21 SRCS+=  load_elf64.c reloc_elf64.c
22 .elif ${MACHINE_CPUARCH} == "arm"
23 SRCS+=  load_elf32.c reloc_elf32.c
24 .elif ${MACHINE_CPUARCH} == "powerpc"
25 SRCS+=  load_elf32.c reloc_elf32.c
26 SRCS+=  load_elf64.c reloc_elf64.c
27 SRCS+=  metadata.c
28 .elif ${MACHINE_CPUARCH} == "riscv"
29 SRCS+=  load_elf64.c reloc_elf64.c
30 SRCS+=  metadata.c
31 .endif
32
33 .if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
34 CFLAGS.part.c+= -DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib
35 SRCS+=  disk.c part.c vdisk.c
36 .endif
37
38 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
39 SRCS+= dev_net.c
40 .endif
41
42 .if defined(HAVE_BCACHE)
43 SRCS+=  bcache.c
44 .endif
45
46 .if defined(MD_IMAGE_SIZE)
47 CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
48 SRCS+=  md.c
49 .else
50 CLEANFILES+=    md.o
51 .endif
52
53 # Machine-independent ISA PnP
54 .if defined(HAVE_ISABUS)
55 SRCS+=  isapnp.c
56 .endif
57 .if defined(HAVE_PNP)
58 SRCS+=  pnp.c
59 .endif
60
61 .if ${LOADER_INTERP} == "lua"
62 SRCS+=  interp_lua.c
63 .include "${BOOTSRC}/lua.mk"
64 LDR_INTERP=     ${LIBLUA}
65 LDR_INTERP32=   ${LIBLUA32}
66 CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules
67 .elif ${LOADER_INTERP} == "4th"
68 SRCS+=  interp_forth.c
69 .include "${BOOTSRC}/ficl.mk"
70 LDR_INTERP=     ${LIBFICL}
71 LDR_INTERP32=   ${LIBFICL32}
72 .elif ${LOADER_INTERP} == "simp"
73 SRCS+=  interp_simple.c
74 .else
75 .error Unknown interpreter ${LOADER_INTERP}
76 .endif
77
78 .include "${BOOTSRC}/veriexec.mk"
79
80 .if defined(BOOT_PROMPT_123)
81 CFLAGS+=        -DBOOT_PROMPT_123
82 .endif
83
84 .if defined(LOADER_INSTALL_SUPPORT)
85 SRCS+=  install.c
86 .endif
87
88 # Filesystem support
89 .if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
90 CFLAGS+=        -DLOADER_CD9660_SUPPORT
91 .endif
92 .if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
93 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
94 .endif
95 .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
96 CFLAGS+=        -DLOADER_MSDOS_SUPPORT
97 .endif
98 .if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
99 CFLAGS+=        -DLOADER_UFS_SUPPORT
100 .endif
101
102 # Compression
103 .if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
104 CFLAGS+=        -DLOADER_GZIP_SUPPORT
105 .endif
106 .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
107 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
108 .endif
109
110 # Network related things
111 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
112 CFLAGS+=        -DLOADER_NET_SUPPORT
113 .endif
114 .if ${LOADER_NFS_SUPPORT:Uno} == "yes"
115 CFLAGS+=        -DLOADER_NFS_SUPPORT
116 .endif
117 .if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
118 CFLAGS+=        -DLOADER_TFTP_SUPPORT
119 .endif
120
121 # Partition support
122 .if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
123 CFLAGS+= -DLOADER_GPT_SUPPORT
124 .endif
125 .if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
126 CFLAGS+= -DLOADER_MBR_SUPPORT
127 .endif
128
129 .if ${HAVE_ZFS:Uno} == "yes"
130 CFLAGS+=        -DLOADER_ZFS_SUPPORT
131 CFLAGS+=        -I${ZFSSRC}
132 CFLAGS+=        -I${SYSDIR}/cddl/boot/zfs
133 CFLAGS+=        -I${SYSDIR}/cddl/contrib/opensolaris/uts/common
134 SRCS+=          zfs_cmd.c
135 .endif
136
137 LIBFICL=        ${BOOTOBJ}/ficl/libficl.a
138 .if ${MACHINE} == "i386"
139 LIBFICL32=      ${LIBFICL}
140 .else
141 LIBFICL32=      ${BOOTOBJ}/ficl32/libficl.a
142 .endif
143
144 LIBLUA=         ${BOOTOBJ}/liblua/liblua.a
145 .if ${MACHINE} == "i386"
146 LIBLUA32=       ${LIBLUA}
147 .else
148 LIBLUA32=       ${BOOTOBJ}/liblua32/liblua.a
149 .endif
150
151 CLEANFILES+=    vers.c
152 VERSION_FILE?=  ${.CURDIR}/version
153 .if ${MK_REPRODUCIBLE_BUILD} != no
154 REPRO_FLAG=     -r
155 .endif
156 vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE}
157         sh ${LDRSRC}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
158             ${NEWVERSWHAT}
159
160 .if ${MK_LOADER_VERBOSE} != "no"
161 CFLAGS+=        -DELF_VERBOSE
162 .endif
163
164 # Each loader variant defines their own help filename. Optional or
165 # build-specific commands are included by augmenting HELP_FILES.
166 .if !defined(HELP_FILENAME)
167 .error Define HELP_FILENAME before including loader.mk
168 .endif
169
170 HELP_FILES+=    ${LDRSRC}/help.common
171
172 CFLAGS+=        -DHELP_FILENAME=\"${HELP_FILENAME}\"
173 .if ${INSTALL_LOADER_HELP_FILE:Uyes} == "yes"
174 CLEANFILES+=    ${HELP_FILENAME}
175 FILES+=         ${HELP_FILENAME}
176 .endif
177
178 ${HELP_FILENAME}: ${HELP_FILES}
179         cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET}