From: Daniel Hobi Date: Wed, 10 Nov 2010 14:11:21 +0100 Subject: [U-Boot] [PATCH] tools/env: cleanup host build flags In-Reply-To: <201011100423.13449.vapier@gentoo.org> References: <201011100423.13449.vapier@gentoo.org> Message-ID: <1289394681-7270-1-git-send-email-daniel.hobi@schmid-telecom.ch> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de This patch makes tools/env/Makefile more similar to tools/imls: - define HOSTSRCS and HOSTCPPFLAGS, so that .depend generation works. - include U-Boot headers using -idirafter to prevent picking up u-boot/include/errno.h. - use HOSTCFLAGS_NOPED (fw_env.c does not conform to -pedantic). In order to cross-compile tools/env, override the HOSTCC variable as in this example: make tools env HOSTCC=bfin-uclinux-gcc Signed-off-by: Daniel Hobi --- tools/env/Makefile | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Let's fix these issues now and cleanup the CC vs HOSTCC discrepancy later. diff --git a/tools/env/Makefile b/tools/env/Makefile index f893040..04dfe9c 100644 --- a/tools/env/Makefile +++ b/tools/env/Makefile @@ -23,19 +23,24 @@ include $(TOPDIR)/config.mk -SRCS := $(obj)crc32.c fw_env.c fw_env_main.c +HOSTSRCS := $(obj)crc32.c fw_env.c fw_env_main.c HEADERS := fw_env.h -HOSTCFLAGS += -Wall -DUSE_HOSTCC -I$(SRCTREE)/include +# Compile for a hosted environment on the target +HOSTCPPFLAGS = -idirafter $(SRCTREE)/include \ + -idirafter $(OBJTREE)/include2 \ + -idirafter $(OBJTREE)/include \ + -DUSE_HOSTCC ifeq ($(MTD_VERSION),old) -HOSTCFLAGS += -DMTD_OLD +HOSTCPPFLAGS += -DMTD_OLD endif all: $(obj)fw_printenv -$(obj)fw_printenv: $(SRCS) $(HEADERS) - $(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $(SRCS) +# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED +$(obj)fw_printenv: $(HOSTSRCS) $(HEADERS) + $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS) clean: rm -f $(obj)fw_printenv $(obj)crc32.c -- 1.7.3.2