From 7698a552027831a25c4c7c8d543d779ecd63e391 Mon Sep 17 00:00:00 2001 From: Zheng Bao Date: Tue, 29 Sep 2020 17:32:36 +0800 Subject: amdfwtool: Clean up the Makefile of amdfwtool Add Makefile.inc to compliant with other tools. Makefile is kept for building amdfwtool by typing make in the folder. Change-Id: I3688d93de4459f5f838955892086b4b9bf30a9b8 Signed-off-by: Zheng Bao Reviewed-on: https://review.coreboot.org/c/coreboot/+/45286 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth Reviewed-by: Felix Held --- util/amdfwtool/Makefile | 20 +++++++++++--------- util/amdfwtool/Makefile.inc | 12 ++++++++++++ 2 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 util/amdfwtool/Makefile.inc (limited to 'util') diff --git a/util/amdfwtool/Makefile b/util/amdfwtool/Makefile index e9fd91bb40..8f4208c354 100644 --- a/util/amdfwtool/Makefile +++ b/util/amdfwtool/Makefile @@ -1,16 +1,18 @@ -#***************************************************************************** -# -# All rights reserved. -# # SPDX-License-Identifier: BSD-3-Clause -#***************************************************************************** HOSTCC ?= cc -amdfwtool_exe : amdfwtool.c - $(HOSTCC) amdfwtool.c -o amdfwtool +SRC = amdfwtool.c +OBJ = $(SRC:%.c=%.o) +TARGET = amdfwtool +CFLAGS=-O2 -Wall -Wextra -Wshadow -amdfwtool : amdfwtool_exe + +$(TARGET): $(OBJ) + $(CC) $(OBJ) $(LDFLAGS) -o $@ + +%.o: %.c $(HEADER) + $(CC) $(CFLAGS) -c -o $@ $< clean: - @rm -f amdfwtool.o amdfwtool amdfwtool.exe + @rm -f $(TARGET) $(OBJ) diff --git a/util/amdfwtool/Makefile.inc b/util/amdfwtool/Makefile.inc new file mode 100644 index 0000000000..2180fac361 --- /dev/null +++ b/util/amdfwtool/Makefile.inc @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: BSD-3-Clause + +amdfwtoolobj = amdfwtool.o + +AMDFWTOOLCFLAGS=-O2 -Wall -Wextra -Wshadow + +$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER) + $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -DCONFIG_ROM_SIZE=$(CONFIG_ROM_SIZE) -c -o $@ $< + +$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) + printf " AMDFWTOOL\n" + $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) -o $@ -- cgit v1.2.3