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 <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/45286
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
This commit is contained in:
Zheng Bao 2020-09-29 17:32:36 +08:00 committed by Felix Held
parent 8725c0af09
commit 7698a55202
3 changed files with 24 additions and 14 deletions

View File

@ -81,7 +81,7 @@ subdirs-y += $(wildcard src/soc/*/*) $(wildcard src/northbridge/*/*)
subdirs-y += src/superio
subdirs-y += $(wildcard src/drivers/*) $(wildcard src/drivers/*/*)
subdirs-y += src/cpu src/vendorcode
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/pgtblgen
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/pgtblgen util/amdfwtool
subdirs-y += util/futility util/marvell util/bincfg util/supermicro
subdirs-y += $(wildcard src/arch/*)
subdirs-y += src/mainboard/$(MAINBOARDDIR)
@ -576,9 +576,6 @@ $(IFDTOOL):
cp -a $(top)/util/ifdtool/ifdtool $@
AMDFWTOOL:=$(objutil)/amdfwtool/amdfwtool
$(AMDFWTOOL): $(top)/util/amdfwtool/amdfwtool.c
@printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(HOSTCFLAGS) -DCONFIG_ROM_SIZE=$(CONFIG_ROM_SIZE) -o $@ $<
APCB_EDIT_TOOL:=$(top)/util/apcb/apcb_edit.py
@ -1108,7 +1105,6 @@ RAMSTAGE=
endif
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(RAMSTAGE) $(CBFSTOOL) $$(INTERMEDIATE)
@printf " CBFS $(subst $(obj)/,,$(@))\n"
# The full ROM may be larger than the CBFS part, so create an empty
# file (filled with \377 = 0xff) and copy the CBFS image over it.

View File

@ -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)

View File

@ -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 $@