1 ## SPDX-License-Identifier: GPL-2.0-only
3 compressionobj
+= compress.o
5 compressionobj
+= lz4.o
6 compressionobj
+= lz4hc.o
7 compressionobj
+= lz4frame.o
8 compressionobj
+= xxhash.o
9 compressionobj
+= lz4_wrapper.o
11 compressionobj
+= lzma.o
12 compressionobj
+= LzFind.o
13 compressionobj
+= LzmaDec.o
14 compressionobj
+= LzmaEnc.o
19 cbfsobj
+= cbfs_image.o
20 cbfsobj
+= cbfs-mkstage.o
21 cbfsobj
+= cbfs-mkpayload.o
22 cbfsobj
+= elfheaders.o
25 cbfsobj
+= partitioned_file.o
26 cbfsobj
+= platform_fixups.o
28 cbfsobj
+= cbfs_private.o
29 cbfsobj
+= fsp_relocate.o
35 cbfsobj
+= linux_trampoline.o
36 cbfsobj
+= cbfs-payload-linux.o
37 # compression algorithms
38 cbfsobj
+= $(compressionobj
)
42 fmapobj
+= cbfs_sections.o
43 fmapobj
+= fmap_from_fmd.o
45 fmapobj
+= fmd_parser.o
46 fmapobj
+= fmd_scanner.o
56 rmodobj
+= elfheaders.o
67 ifitobj
+= cbfs_image.o
70 ifitobj
+= elfheaders.o
71 ifitobj
+= partitioned_file.o
72 ifitobj
+= cbfs-mkstage.o
73 ifitobj
+= cbfs-mkpayload.o
79 # compression algorithms
80 ifitobj
+= $(compressionobj
)
84 cbfscompobj
+= $(compressionobj
)
85 cbfscompobj
+= cbfscomptool.o
88 amdcompobj
+= amdcompress.o
89 amdcompobj
+= elfheaders.o
90 amdcompobj
+= common.o
101 include $(top
)/util
/cbfstool
/fpt_formats
/Makefile.mk
103 cse_fpt_obj
+= cse_fpt.o
104 cse_fpt_obj
+= common.o
105 cse_fpt_obj
+= cse_helpers.o
106 cse_fpt_obj
+= $(foreach var
, $(fpt_formats_obj
), $(var
))
108 include $(top
)/util
/cbfstool
/bpdt_formats
/Makefile.mk
110 cse_serger_obj
+= cse_serger.o
111 cse_serger_obj
+= common.o
112 cse_serger_obj
+= cse_helpers.o
113 cse_serger_obj
+= $(foreach var
, $(bpdt_formats_obj
), $(var
))
115 TOOLCFLAGS ?
= -Werror
-Wall
-Wextra
-Wshadow
116 TOOLCFLAGS
+= -Wcast-qual
-Wmissing-prototypes
-Wredundant-decls
-Wshadow
117 TOOLCFLAGS
+= -Wstrict-prototypes
-Wwrite-strings
119 TOOLCPPFLAGS ?
= -D_DEFAULT_SOURCE
# memccpy() from string.h
120 TOOLCPPFLAGS
+= -D_BSD_SOURCE
-D_SVID_SOURCE
# _DEFAULT_SOURCE for older glibc
121 TOOLCPPFLAGS
+= -D_GNU_SOURCE
# memmem() from string.h
122 TOOLCPPFLAGS
+= -I
$(top
)/util
/cbfstool
/flashmap
123 TOOLCPPFLAGS
+= -I
$(top
)/util
/cbfstool
124 TOOLCPPFLAGS
+= -I
$(objutil
)/cbfstool
125 TOOLCPPFLAGS
+= -I
$(top
)/src
/commonlib
/include -I
$(top
)/src
/commonlib
/bsd
/include
126 TOOLCPPFLAGS
+= -include $(top
)/src
/commonlib
/bsd
/include/commonlib
/bsd
/compiler.h
127 TOOLCPPFLAGS
+= -I
$(VBOOT_SOURCE
)/firmware
/include
128 TOOLCPPFLAGS
+= -I
$(VBOOT_SOURCE
)/firmware
/2lib
/include
129 TOOLCPPFLAGS
+= -I
$(VBOOT_SOURCE
)/host
/include
130 TOOLCPPFLAGS
+= -I
$(VBOOT_SOURCE
)/host
/lib
/include
131 # UEFI header file support. It's not pretty, but that's what we currently
133 TOOLCPPFLAGS
+= -I
$(top
)/src
134 TOOLCPPFLAGS
+= -I
$(top
)/src
/vendorcode
/intel
/edk2
/uefi_2.4
/MdePkg
/Include
138 ifeq ($(shell uname
-s | cut
-c-7
2>/dev
/null
), MINGW32
)
139 HOSTCFLAGS
+= -fms-extensions
140 TOOLCFLAGS
+= -mno-ms-bitfields
142 ifeq ($(shell uname
-o
2>/dev
/null
), Cygwin
)
143 TOOLCFLAGS
+=-std
=gnu11
144 TOOLCPPFLAGS
+=-D_GNU_SOURCE
149 LZ4CFLAGS ?
= -Wno-strict-prototypes
151 VBOOT_HOSTLIB
= $(VBOOT_HOST_BUILD
)/libvboot_host.a
154 printf
" MAKE $(subst $(objutil)/,,$(@))\n"
155 unset CFLAGS LDFLAGS
; $(MAKE
) -C
$(VBOOT_SOURCE
) \
156 BUILD
=$(VBOOT_HOST_BUILD
) \
164 $(objutil
)/cbfstool
/%.o
: $(objutil
)/cbfstool
/%.c
165 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
166 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
168 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/%.c
169 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
170 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
172 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/flashmap
/%.c
173 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
174 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
176 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/lzma
/%.c
177 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
178 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
180 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/lzma
/C
/%.c
181 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
182 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
184 $(objutil
)/cbfstool
/%.o
: $(top
)/src
/commonlib
/%.c
185 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
186 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
188 $(objutil
)/cbfstool
/%.o
: $(top
)/src
/commonlib
/bsd
/%.c
189 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
190 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
192 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/lz4
/lib
/%.c
193 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
194 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) $(LZ4CFLAGS
) -c
-o
$@
$<
196 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/fpt_formats
/%.c
197 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
198 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
200 $(objutil
)/cbfstool
/%.o
: $(top
)/util
/cbfstool
/bpdt_formats
/%.c
201 printf
" HOSTCC $(subst $(objutil)/,,$(@))\n"
202 $(HOSTCC
) $(TOOLCPPFLAGS
) $(TOOLCFLAGS
) $(HOSTCFLAGS
) -c
-o
$@
$<
204 $(objutil
)/cbfstool
/cbfstool
: $(addprefix $(objutil
)/cbfstool
/,$(cbfsobj
)) $(VBOOT_HOSTLIB
)
205 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
206 $(HOSTCC
) -v
$(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(cbfsobj
)) $(VBOOT_HOSTLIB
)
208 $(objutil
)/cbfstool
/fmaptool
: $(addprefix $(objutil
)/cbfstool
/,$(fmapobj
))
209 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
210 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(fmapobj
))
212 $(objutil
)/cbfstool
/rmodtool
: $(addprefix $(objutil
)/cbfstool
/,$(rmodobj
))
213 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
214 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(rmodobj
))
216 $(objutil
)/cbfstool
/ifwitool
: $(addprefix $(objutil
)/cbfstool
/,$(ifwiobj
))
217 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
218 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(ifwiobj
))
220 $(objutil
)/cbfstool
/ifittool
: $(addprefix $(objutil
)/cbfstool
/,$(ifitobj
)) $(VBOOT_HOSTLIB
)
221 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
222 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(ifitobj
)) $(VBOOT_HOSTLIB
)
224 $(objutil
)/cbfstool
/cbfs-compression-tool
: $(addprefix $(objutil
)/cbfstool
/,$(cbfscompobj
))
225 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
226 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(cbfscompobj
))
228 $(objutil
)/cbfstool
/amdcompress
: $(addprefix $(objutil
)/cbfstool
/,$(amdcompobj
))
229 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
230 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(amdcompobj
)) -lz
232 $(objutil
)/cbfstool
/elogtool
: $(addprefix $(objutil
)/cbfstool
/,$(elogobj
)) $(VBOOT_HOSTLIB
)
233 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
234 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(elogobj
)) $(VBOOT_HOSTLIB
)
236 $(objutil
)/cbfstool
/cse_fpt
: $(addprefix $(objutil
)/cbfstool
/,$(cse_fpt_obj
))
237 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
238 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(cse_fpt_obj
))
240 $(objutil
)/cbfstool
/cse_serger
: $(addprefix $(objutil
)/cbfstool
/,$(cse_serger_obj
))
241 printf
" HOSTCC $(subst $(objutil)/,,$(@)) (link)\n"
242 $(HOSTCC
) $(TOOLLDFLAGS
) -o
$@
$(addprefix $(objutil
)/cbfstool
/,$(cse_serger_obj
))
244 # Yacc source is superset of header
245 $(objutil
)/cbfstool
/fmd.o
: TOOLCFLAGS
+= -Wno-redundant-decls
246 $(objutil
)/cbfstool
/fmd_parser.o
: TOOLCFLAGS
+= -Wno-redundant-decls
247 # Lex generates unneeded functions and declarations
248 $(objutil
)/cbfstool
/fmd_scanner.o
: TOOLCFLAGS
+= -Wno-redundant-decls
249 $(objutil
)/cbfstool
/fmd_scanner.o
: TOOLCFLAGS
+= -Wno-unused-function
250 # Tolerate lzma sdk warnings
251 $(objutil
)/cbfstool
/LzmaEnc.o
: TOOLCFLAGS
+= -Wno-sign-compare
-Wno-cast-qual
252 # Tolerate commonlib warnings
253 $(objutil
)/cbfstool
/cbfs_private.o
: TOOLCFLAGS
+= -Wno-sign-compare
254 # Tolerate lz4 warnings
255 $(objutil
)/cbfstool
/lz4.o
: TOOLCFLAGS
+= -Wno-missing-prototypes
256 $(objutil
)/cbfstool
/lz4_wrapper.o
: TOOLCFLAGS
+= -Wno-attributes
258 $(objutil
)/cbfstool
/fmd.o
: $(objutil
)/cbfstool
/fmd_parser.h
259 $(objutil
)/cbfstool
/fmd.o
: $(objutil
)/cbfstool
/fmd_scanner.h
260 $(objutil
)/cbfstool
/fmd_parser.o
: $(objutil
)/cbfstool
/fmd.o
261 $(objutil
)/cbfstool
/fmd_scanner.o
: $(objutil
)/cbfstool
/fmd.o
262 $(objutil
)/cbfstool
/fmd_scanner.o
: TOOLCFLAGS
+= -Wno-sign-compare
264 $(objutil
)/cbfstool
/%: $(top
)/util
/cbfstool
/%_shipped
268 ifeq ($(CONFIG_FMD_GENPARSER
),y
)
272 # the .c rule also creates .h
273 $(top
)/util
/cbfstool
/fmd_scanner.h_shipped
: $(top
)/util
/cbfstool
/fmd_scanner.c_shipped
274 $(top
)/util
/cbfstool
/fmd_scanner.c_shipped
: $(top
)/util
/cbfstool
/fmd_scanner.l
275 echo
" LEX util/cbfstool/fmd_scanner.[ch]"
276 $(TOOLLEX
) -L
-o
$@
--header-file
=$(patsubst %.c_shipped
,%.h_shipped
,$@
) $<
278 # the .c rule also creates .h
279 $(top
)/util
/cbfstool
/fmd_parser.h_shipped
: $(top
)/util
/cbfstool
/fmd_parser.c_shipped
280 $(top
)/util
/cbfstool
/fmd_parser.c_shipped
: $(top
)/util
/cbfstool
/fmd_parser.y
281 echo
" YACC util/cbfstool/fmd_parser.[ch]"
282 $(TOOLYACC
) -l
-o
$@
--defines
=$(patsubst %.c_shipped
,%.h_shipped
,$@
) $<
284 endif # CONFIG_FMD_GENPARSER