coreboot-kgpe-d16/util/cbfstool/Makefile

63 lines
1.8 KiB
Makefile
Raw Permalink Normal View History

top ?= $(abspath ../..)
objutil ?= $(top)/util
CONFIG_FMD_GENPARSER ?= n
HOSTCC ?= $(CC)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
INSTALL ?= /usr/bin/env install
OBJCOPY ?= objcopy
VBOOT_SOURCE ?= $(top)/3rdparty/vboot
cbfstool: Clean up in preparation for adding new files This enables more warnings on the cbfstool codebase and fixes the issues that surface as a result. A memory leak that used to occur when compressing files with lzma is also found and fixed. Finally, there are several fixes for the Makefile: - Its autodependencies used to be broken because the target for the .dependencies file was misnamed; this meant that Make didn't know how to rebuild the file, and so would silently skip the step of updating it before including it. - The ability to build to a custom output directory by defining the obj variable had bitrotted. - The default value of the obj variable was causing implicit rules not to apply when specifying a file as a target without providing a custom value for obj. - Add a distclean target for removing the .dependencies file. BUG=chromium:461875 TEST=Build an image with cbfstool both before and after. BRANCH=None Change-Id: I951919d63443f2b053c2e67c1ac9872abc0a43ca Signed-off-by: Sol Boucher <solb@chromium.org> Original-Commit-Id: 49293443b4e565ca48d284e9a66f80c9c213975d Original-Change-Id: Ia7350c2c3306905984cfa711d5fc4631f0b43d5b Original-Signed-off-by: Sol Boucher <solb@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/257340 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Reviewed-on: http://review.coreboot.org/9937 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
2015-03-06 00:38:03 +01:00
.PHONY: all
all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool
cbfstool: $(objutil)/cbfstool/cbfstool
fmaptool: $(objutil)/cbfstool/fmaptool
rmodtool: $(objutil)/cbfstool/rmodtool
ifwitool: $(objutil)/cbfstool/ifwitool
ifittool: $(objutil)/cbfstool/ifittool
cbfs-compression-tool: $(objutil)/cbfstool/cbfs-compression-tool
.PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool
clean:
$(RM) fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
$(RM) $(objutil)/cbfstool/cbfstool $(cbfsobj)
$(RM) $(objutil)/cbfstool/fmaptool $(fmapobj)
$(RM) $(objutil)/cbfstool/rmodtool $(rmodobj)
$(RM) $(objutil)/cbfstool/ifwitool $(ifwiobj)
$(RM) $(objutil)/cbfstool/ifittool $(ifitobj)
$(RM) $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
linux_trampoline.c: linux_trampoline.S
rm -f linux_trampoline.c
$(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
$(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
xxd -c 16 -i trampoline >> trampoline.c
mv trampoline.c linux_trampoline.c
rm linux_trampoline trampoline
.PHONY: install
install: all
mkdir -p $(DESTDIR)$(BINDIR)
$(INSTALL) cbfstool $(DESTDIR)$(BINDIR)
$(INSTALL) fmaptool $(DESTDIR)$(BINDIR)
$(INSTALL) rmodtool $(DESTDIR)$(BINDIR)
$(INSTALL) ifwitool $(DESTDIR)$(BINDIR)
$(INSTALL) ifittool $(DESTDIR)$(BINDIR)
$(INSTALL) cbfs-compression-tool $(DESTDIR)$(BINDIR)
ifneq ($(V),1)
.SILENT:
endif
include Makefile.inc