[U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h
Loïc Minier
loic.minier at linaro.org
Tue Feb 8 00:23:01 CET 2011
mtd/mtd-user.h is missing on FreeBSD hosts; add a macro to test whether
a specific host header is present and use it to decide to build
fw_printenv if mtd/mtd-user.h is present.
---
How about this approach?
If it's ok, then I could extend it to handle the MTD_VERSION=old case as well,
perhaps replacing this MTD_VERSION with a test for linux/mtd/mtd.h.
I would have preferred putting this in /Makefile to disable the
make -C tools/env altogether, but config.mk isn't included by default so
HOSTCC isn't available for the test.
tools/env/Makefile | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/tools/env/Makefile b/tools/env/Makefile
index 2f7a59c..294bb95 100644
--- a/tools/env/Makefile
+++ b/tools/env/Makefile
@@ -36,7 +36,18 @@ ifeq ($(MTD_VERSION),old)
HOSTCPPFLAGS += -DMTD_OLD
endif
+# macro to check whether a host header is present; outputs 1 if present, 0 if
+# not
+check_include = $(shell echo | $(HOSTCC) $(HOSTCFLAGS_NOPED) -E -include $(1) -o /dev/null - 2>/dev/null && echo 1 || echo 0)
+
+# whether to build tools/env or not
+has_mtd_user := $(call check_include, mtd/mtd-user.h)
+
+ifeq ($(has_mtd_user),1)
all: $(obj)fw_printenv
+else
+all:
+endif
# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
$(obj)fw_printenv: $(HOSTSRCS) $(HEADERS)
--
1.7.2.3
More information about the U-Boot
mailing list