From patchwork Mon Feb 7 23:23:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Lo=C3=AFc_Minier?= X-Patchwork-Id: 82228 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 357B5B6F07 for ; Tue, 8 Feb 2011 10:23:15 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CC36328169; Tue, 8 Feb 2011 00:23:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id L3OS+9BfWYgD; Tue, 8 Feb 2011 00:23:11 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6BE9328189; Tue, 8 Feb 2011 00:23:10 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B0B428189 for ; Tue, 8 Feb 2011 00:23:08 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qVbCWS7Th5hP for ; Tue, 8 Feb 2011 00:23:06 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from duck.dooz.org (duck.dooz.org [194.146.227.125]) by theia.denx.de (Postfix) with ESMTP id 2AC5228169 for ; Tue, 8 Feb 2011 00:23:03 +0100 (CET) Received: from bee.dooz.org (serris.dooz.org [88.166.229.232]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by duck.dooz.org (Postfix) with ESMTP id 34833C809C; Tue, 8 Feb 2011 00:23:03 +0100 (CET) Received: by bee.dooz.org (Postfix, from userid 1000) id 946B1246B; Tue, 8 Feb 2011 00:23:02 +0100 (CET) From: =?UTF-8?q?Lo=C3=AFc=20Minier?= To: u-boot@lists.denx.de Date: Tue, 8 Feb 2011 00:23:01 +0100 Message-Id: <1297120981-29885-1-git-send-email-loic.minier@linaro.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <20110207220605.AD62F14B4BD5@gemini.denx.de> References: <20110207220605.AD62F14B4BD5@gemini.denx.de> Cc: =?UTF-8?q?Lo=C3=AFc=20Minier?= Subject: [U-Boot] [PATCH] Only build fw_printenv if we have mtd/mtd-user.h X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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)