vboot_reference/Makefile: Fix building with USE_FLASHROM:=0

Unfortunately the USE_FLASHROM build flag broke during a refactor
in commit f0af257a9b333b. This flag is needed for coreboot builds.
Resolve by putting relevant files under guards.

BUG=b:221234560,b:220833585
BRANCH=none
TEST=`USE_FLASHROM={0,1} make`

Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Change-Id: Ic10a3909bf070897cef7f1556deef57eba6c57f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3493527
Tested-by: Edward O'Callaghan <quasisec@chromium.org>
Auto-Submit: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Martin Roth <martinroth@google.com>
Commit-Queue: Martin Roth <martinroth@google.com>
diff --git a/Makefile b/Makefile
index e6c3bca..6340fb2 100644
--- a/Makefile
+++ b/Makefile
@@ -433,11 +433,18 @@
 TLCL_OBJS = ${TLCL_SRCS:%.c=${BUILD}/%.o}
 ALL_OBJS += ${FWLIB_OBJS} ${TLCL_OBJS}
 
+# Maintain behaviour of default on.
+USE_FLASHROM ?= 1
+
+ifneq ($(filter-out 0,${USE_FLASHROM}),)
+$(info building with libflashrom support)
+FLASHROM_LIBS := $(shell ${PKG_CONFIG} --libs flashrom)
 COMMONLIB_SRCS = \
-	host/lib/fmap.c \
 	host/lib/flashrom.c \
 	host/lib/flashrom_drv.c \
 	host/lib/subprocess.c
+CFLAGS += -DUSE_FLASHROM
+endif
 
 # Intermediate library for the vboot_reference utilities to link against.
 UTILLIB = ${BUILD}/libvboot_util.a
@@ -458,6 +465,7 @@
 	host/lib/crypto.c \
 	host/lib/file_keys.c \
 	$(COMMONLIB_SRCS) \
+	host/lib/fmap.c \
 	host/lib/host_common.c \
 	host/lib/host_key2.c \
 	host/lib/host_keyblock.c \
@@ -516,6 +524,7 @@
 	host/lib/crypto.c \
 	host/lib/extract_vmlinuz.c \
 	$(COMMONLIB_SRCS) \
+	host/lib/fmap.c \
 	host/lib/host_misc.c \
 	host/lib21/host_misc.c \
 	${TLCL_SRCS}
@@ -659,19 +668,13 @@
 	futility/vb1_helper.c \
 	futility/vb2_helper.c
 
-# Maintain behaviour of default on.
-USE_FLASHROM ?= 1
-
 ifneq ($(filter-out 0,${USE_FLASHROM}),)
-$(info building with libflashrom support)
-FLASHROM_LIBS := $(shell ${PKG_CONFIG} --libs flashrom)
 FUTIL_SRCS += host/lib/flashrom_drv.c \
 	futility/flashrom_wp_drv.c \
 	futility/updater_archive.c \
 	futility/updater_quirks.c \
 	futility/updater_utils.c \
 	futility/updater.c
-CFLAGS += -DUSE_FLASHROM
 endif
 
 # List of commands built in futility.