aboutsummaryrefslogtreecommitdiff
path: root/util/amdfwtool/Makefile.mk
diff options
context:
space:
mode:
Diffstat (limited to 'util/amdfwtool/Makefile.mk')
-rw-r--r--util/amdfwtool/Makefile.mk19
1 files changed, 13 insertions, 6 deletions
diff --git a/util/amdfwtool/Makefile.mk b/util/amdfwtool/Makefile.mk
index d0b01ac6dc..8198fe3b6e 100644
--- a/util/amdfwtool/Makefile.mk
+++ b/util/amdfwtool/Makefile.mk
@@ -4,12 +4,18 @@ ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)
amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o
amdfwreadobj = amdfwread.o
+amdfwheader = amdfwtool.h
-AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow -Werror
+WERROR ?= -Werror
+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,15 +23,16 @@ $(error "Ensure that pkg-config is installed.")
endif
LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto)
-$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER)
+$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c $(dir)/$(amdfwheader)
+ printf " AMDFW $@\n"
$(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
-$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj))
- printf " AMDFWTOOL\n"
+$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(dir)/$(amdfwheader)
+ printf " AMDFWTOOL $@\n"
$(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@
-$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj))
- printf " AMDFWREAD\n"
+$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(dir)/$(amdfwheader)
+ printf " AMDFWREAD $@\n"
$(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@
endif # ifneq ($(BUILD_ALL_TOOLS)$(CONFIG_USE_AMDFWTOOL),)