diff options
author | Sol Boucher <solb@chromium.org> | 2015-03-05 15:38:03 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-25 12:14:25 +0200 |
commit | 0e53931fee0178c4f4ac4e2e6b355b103b5e8c42 (patch) | |
tree | f38674ea0f24986093c5852115966fa27db2130a /util/cbfstool/Makefile.inc | |
parent | c13ad6c6df709fda1d70743a860a406643620b9e (diff) | |
download | coreboot-0e53931fee0178c4f4ac4e2e6b355b103b5e8c42.tar.xz |
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>
Diffstat (limited to 'util/cbfstool/Makefile.inc')
-rw-r--r-- | util/cbfstool/Makefile.inc | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc index 410d96c702..a846e9959c 100644 --- a/util/cbfstool/Makefile.inc +++ b/util/cbfstool/Makefile.inc @@ -17,32 +17,42 @@ cbfsobj += LzmaEnc.o cbfsobj += linux_trampoline.o cbfsobj += cbfs-payload-linux.o +rmodobj := rmodobj += rmodtool.o rmodobj += rmodule.o rmodobj += common.o rmodobj += elfheaders.o rmodobj += xdr.o +TOOLCFLAGS ?= -std=c99 -Werror -Wall -Wextra +TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow +TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings +TOOLCPPFLAGS ?= -D_POSIX_C_SOURCE=200809L # strdup() from string.h +TOOLLINKFLAGS ?= + ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32) TOOLFLAGS+=-mno-ms-bitfields endif $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< $(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< $(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) + $(HOSTCC) $(TOOLLINKFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) $(objutil)/cbfstool/rmodtool: $(addprefix $(objutil)/cbfstool/,$(rmodobj)) printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) + $(HOSTCC) $(TOOLLINKFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) + +# Tolerate lzma sdk warnings +$(objutil)/cbfstool/LzmaEnc.o: TOOLCFLAGS += -Wno-sign-compare -Wno-cast-qual |