treewide: Move device_tree to commonlib
[coreboot2.git] / util / cbfstool / Makefile
blob5a33598c84913f4fa29e7399c6462fd577b88069
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)
16 SPDX_ID_STRING := SPDX-License-Identifier
18 .PHONY: all
19 all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
21 cbfstool: $(objutil)/cbfstool/cbfstool
23 fmaptool: $(objutil)/cbfstool/fmaptool
25 rmodtool: $(objutil)/cbfstool/rmodtool
27 ifwitool: $(objutil)/cbfstool/ifwitool
29 ifittool: $(objutil)/cbfstool/ifittool
31 cbfs-compression-tool: $(objutil)/cbfstool/cbfs-compression-tool
33 elogtool: $(objutil)/cbfstool/elogtool
35 cse_fpt: $(objutil)/cbfstool/cse_fpt
37 cse_serger: $(objutil)/cbfstool/cse_serger
39 .PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
40 clean:
41 $(RM) -f fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
42 $(RM) -f $(objutil)/cbfstool/cbfstool $(cbfsobj)
43 $(RM) -f $(objutil)/cbfstool/fmaptool $(fmapobj)
44 $(RM) -f $(objutil)/cbfstool/rmodtool $(rmodobj)
45 $(RM) -f $(objutil)/cbfstool/ifwitool $(ifwiobj)
46 $(RM) -f $(objutil)/cbfstool/ifittool $(ifitobj)
47 $(RM) -f $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
48 $(RM) -f $(objutil)/cbfstool/elogtool $(elogobj)
49 $(RM) -f $(objutil)/cbfstool/cse_fpt $(cse_fpt_obj)
50 $(RM) -f $(objutil)/cbfstool/cse_serger $(cse_serger_obj)
51 $(RM) -rf $(VBOOT_HOST_BUILD)
53 linux_trampoline.c: linux_trampoline.S
54 rm -f linux_trampoline.c
55 $(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
56 $(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
57 echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
58 echo "/* $(SPDX_ID_STRING): GPL-2.0-only */" >> trampoline.c
59 xxd -c 16 -i trampoline >> trampoline.c
60 mv trampoline.c linux_trampoline.c
61 rm linux_trampoline trampoline
63 .PHONY: install distclean help
64 install: all
65 mkdir -p $(DESTDIR)$(BINDIR)
66 $(INSTALL) cbfstool $(DESTDIR)$(BINDIR)
67 $(INSTALL) fmaptool $(DESTDIR)$(BINDIR)
68 $(INSTALL) rmodtool $(DESTDIR)$(BINDIR)
69 $(INSTALL) ifwitool $(DESTDIR)$(BINDIR)
70 $(INSTALL) ifittool $(DESTDIR)$(BINDIR)
71 $(INSTALL) cbfs-compression-tool $(DESTDIR)$(BINDIR)
72 $(INSTALL) elogtool $(DESTDIR)$(BINDIR)
73 $(INSTALL) cse_fpt $(DESTDIR)$(BINDIR)
74 $(INSTALL) cse_serger $(DESTDIR)$(BINDIR)
76 distclean: clean
78 help:
79 @echo "cbfstool & associated tools"
80 @echo "Targets: all, clean, distclean, help"
81 @echo " cbfstool - Manipulate CBFS images"
82 @echo " fmaptool - Compile Flashmap descriptor (fmd) files"
83 @echo " rmodtool - Create relocatable modules"
84 @echo " ifwitool - Manipulate Intel FW Image (IFWI)"
85 @echo " ifittool - Manipulate Intel FW Interface Table (FIT)"
86 @echo " cbfs-compression-tool - benchmark compression algorithms"
87 @echo " elogtool - Display ELOG events"
88 @echo " cse_fpt - Manage Intel CSE Flash Partition Table (FPT)"
89 @echo " cse_serger - Stitch Intel CSE components"
91 ifneq ($(V),1)
92 .SILENT:
93 endif
95 include Makefile.mk
97 $(objutil)/cbfstool/cbfstool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
98 $(objutil)/cbfstool/elogtool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
100 $(VBOOT_SOURCE)/firmware/include/vb2_sha.h:
101 cd $(VBOOT_SOURCE) && git submodule update --init .