Martin L Roth has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/80715?usp=email )
Change subject: amdfwtool: Use Makefile.mk for Makefile settings ......................................................................
amdfwtool: Use Makefile.mk for Makefile settings
When updating the Makefiles, to keep from having to update two files at the same time, import Makefile.mk into the external Makefile. This allows the bulk of the settings to be in a single location.
Change-Id: Id5b869f49b34b22e6a02fc086e7b42975141a87e Signed-off-by: Martin Roth gaumless@gmail.com --- M util/amdfwtool/Makefile M util/amdfwtool/Makefile.mk 2 files changed, 17 insertions(+), 29 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/80715/1
diff --git a/util/amdfwtool/Makefile b/util/amdfwtool/Makefile index 9392f02..7ca3543 100644 --- a/util/amdfwtool/Makefile +++ b/util/amdfwtool/Makefile @@ -7,41 +7,24 @@ HOSTCC ?= cc endif
-READ_SRC = amdfwread.c -READ_OBJ = $(READ_SRC:%.c=%.o) -TOOL_SRC = amdfwtool.c data_parse.c signed_psp.c handle_file.c -TOOL_OBJ = $(TOOL_SRC:%.c=%.o) -HEADER=amdfwtool.h TARGETS = amdfwread amdfwtool -WERROR=-Werror -CFLAGS :=-O2 -Wall -Wextra -Wshadow ${WERROR} -CFLAGS += -I $(top)/src/commonlib/bsd/include -CFLAGS += -D_GNU_SOURCE # memmem() from string.h - -ifneq ($(PKG_CONFIG),) -HOSTPKGCONFIG ?= $(PKG_CONFIG) -else -HOSTPKGCONFIG ?= pkg-config -endif -CFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) -ifneq ($(.SHELLSTATUS),0) -$(error "Ensure that pkg-config is installed.") -endif -LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
all: $(TARGETS)
-amdfwread: $(READ_OBJ) - $(HOSTCC) $(READ_OBJ) $(LDFLAGS) -o $@ +BUILD_ALL_TOOLS = 1 +include ./Makefile.mk
-amdfwtool: $(TOOL_OBJ) - $(HOSTCC) $(TOOL_OBJ) $(LDFLAGS) -o $@ +amdfwread: $(amdfwreadobj) + $(HOSTCC) $(amdfwreadobj) $(LDFLAGS) -o $@ + +amdfwtool: $(amdfwtoolobj) + $(HOSTCC) $(amdfwtoolobj) $(LDFLAGS) -o $@
%.o: %.c $(HEADER) - $(HOSTCC) $(CFLAGS) -c -o $@ $< + $(HOSTCC) $(AMDFWTOOLCFLAGS) -c -o $@ $<
clean: - @rm -f $(TARGETS) $(READ_OBJ) $(TOOL_OBJ) + @rm -f $(TARGETS) $(amdfwreadobj) $(amdfwtoolobj)
distclean: clean
diff --git a/util/amdfwtool/Makefile.mk b/util/amdfwtool/Makefile.mk index d0b01ac..3462467 100644 --- a/util/amdfwtool/Makefile.mk +++ b/util/amdfwtool/Makefile.mk @@ -4,12 +4,17 @@
amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o amdfwreadobj = amdfwread.o +amdfwheader = amdfwtool.h
AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow -Werror AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h
+ifneq ($(PKG_CONFIG),) +HOSTPKGCONFIG ?= $(PKG_CONFIG) +else HOSTPKGCONFIG ?= pkg-config +endif
AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) ifneq ($(.SHELLSTATUS),0) @@ -17,14 +22,14 @@ endif LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
-$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER) +$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c $(amdfwheader) $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
-$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) +$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(amdfwheader) printf " AMDFWTOOL\n" $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@
-$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) +$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(amdfwheader) printf " AMDFWREAD\n" $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@