Xeon-SP boards: Factor out OCP VPD `get_cxl_mode()` impl
[coreboot2.git] / util / cbfstool / Makefile
blob8dde77ba52a7f138df7d8baf2e2d812c7a434abc
1 top ?= $(abspath ../..)
2 objutil ?= $(top)/util
3 RM ?= rm
5 CONFIG_FMD_GENPARSER ?= n
7 HOSTCC ?= $(CC)
8 PREFIX ?= /usr/local
9 BINDIR ?= $(PREFIX)/bin
10 INSTALL ?= /usr/bin/env install
11 OBJCOPY ?= objcopy
12 override objutil := ..
14 VBOOT_SOURCE ?= $(top)/3rdparty/vboot
15 VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
17 .PHONY: all
18 all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
20 cbfstool: $(objutil)/cbfstool/cbfstool
22 fmaptool: $(objutil)/cbfstool/fmaptool
24 rmodtool: $(objutil)/cbfstool/rmodtool
26 ifwitool: $(objutil)/cbfstool/ifwitool
28 ifittool: $(objutil)/cbfstool/ifittool
30 cbfs-compression-tool: $(objutil)/cbfstool/cbfs-compression-tool
32 elogtool: $(objutil)/cbfstool/elogtool
34 cse_fpt: $(objutil)/cbfstool/cse_fpt
36 cse_serger: $(objutil)/cbfstool/cse_serger
38 .PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
39 clean:
40 $(RM) -f fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
41 $(RM) -f $(objutil)/cbfstool/cbfstool $(cbfsobj)
42 $(RM) -f $(objutil)/cbfstool/fmaptool $(fmapobj)
43 $(RM) -f $(objutil)/cbfstool/rmodtool $(rmodobj)
44 $(RM) -f $(objutil)/cbfstool/ifwitool $(ifwiobj)
45 $(RM) -f $(objutil)/cbfstool/ifittool $(ifitobj)
46 $(RM) -f $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
47 $(RM) -f $(objutil)/cbfstool/elogtool $(elogobj)
48 $(RM) -f $(objutil)/cbfstool/cse_fpt $(cse_fpt_obj)
49 $(RM) -f $(objutil)/cbfstool/cse_serger $(cse_serger_obj)
50 $(RM) -rf $(VBOOT_HOST_BUILD)
52 linux_trampoline.c: linux_trampoline.S
53 rm -f linux_trampoline.c
54 $(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
55 $(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
56 echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
57 echo "/* SPDX-License-Identifier: GPL-2.0-only */" >> trampoline.c
58 xxd -c 16 -i trampoline >> trampoline.c
59 mv trampoline.c linux_trampoline.c
60 rm linux_trampoline trampoline
62 .PHONY: install distclean help
63 install: all
64 mkdir -p $(DESTDIR)$(BINDIR)
65 $(INSTALL) cbfstool $(DESTDIR)$(BINDIR)
66 $(INSTALL) fmaptool $(DESTDIR)$(BINDIR)
67 $(INSTALL) rmodtool $(DESTDIR)$(BINDIR)
68 $(INSTALL) ifwitool $(DESTDIR)$(BINDIR)
69 $(INSTALL) ifittool $(DESTDIR)$(BINDIR)
70 $(INSTALL) cbfs-compression-tool $(DESTDIR)$(BINDIR)
71 $(INSTALL) elogtool $(DESTDIR)$(BINDIR)
72 $(INSTALL) cse_fpt $(DESTDIR)$(BINDIR)
73 $(INSTALL) cse_serger $(DESTDIR)$(BINDIR)
75 distclean: clean
77 help:
78 @echo "cbfstool & associated tools"
79 @echo "Targets: all, clean, distclean, help"
80 @echo " cbfstool - Manipulate CBFS images"
81 @echo " fmaptool - Compile Flashmap descriptor (fmd) files"
82 @echo " rmodtool - Create relocatable modules"
83 @echo " ifwitool - Manipulate Intel FW Image (IFWI)"
84 @echo " ifittool - Manipulate Intel FW Interface Table (FIT)"
85 @echo " cbfs-compression-tool - benchmark compression algorithms"
86 @echo " elogtool - Display ELOG events"
87 @echo " cse_fpt - Manage Intel CSE Flash Partition Table (FPT)"
88 @echo " cse_serger - Stitch Intel CSE components"
90 ifneq ($(V),1)
91 .SILENT:
92 endif
94 include Makefile.mk
96 $(objutil)/cbfstool/cbfstool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
97 $(objutil)/cbfstool/elogtool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
99 $(VBOOT_SOURCE)/firmware/include/vb2_sha.h:
100 cd $(VBOOT_SOURCE) && git submodule update --init .