public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [WIP] tools/env: cleanup host build flags
@ 2010-10-11 16:06 Daniel Hobi
  2010-10-11 19:16 ` Scott Wood
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Daniel Hobi @ 2010-10-11 16:06 UTC (permalink / raw)
  To: u-boot

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).
- use the cross compiler again (fw_printenv is intended for a
  hosted environment on the target).

Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Wolfgang Denk <wd@denx.de>

---
 tools/env/Makefile |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)


Hi Scott,

In commit d984fed0 (makefiles: fixes for building build tools),
you suggest that using $(CC) with host flags (HOSTCFLAGS, etc)
is the correct way to use the cross compiler to generate binaries
for a hosted environment on the target.

On the other hand, you use $(HOSTCC) to generate the .depend file
in rules.mk which leads to wrong dependencies.

I think we need to differentiate three cases:
 - (free-standing) U-Boot: use CC and CFLAGS
 - native tools (mkimage, etc): use HOSTCC and HOSTCFLAGS
 - Linux environment on the target (imls, fw_printenv):

   Can we use CC and HOSTCFLAGS, or do we need a third set of
   variables for flags?

   If reusing HOSTCFLAGS: how do we fix dependency generation?

Best regards,
Daniel

diff --git a/tools/env/Makefile b/tools/env/Makefile
index f893040..a7bed87 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)
+	$(CC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
 
 clean:
 	rm -f $(obj)fw_printenv $(obj)crc32.c
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-11-10 22:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-11 16:06 [U-Boot] [WIP] tools/env: cleanup host build flags Daniel Hobi
2010-10-11 19:16 ` Scott Wood
2010-11-09 15:03 ` Detlev Zundel
2010-11-09 15:58   ` Steve Sakoman
2010-11-10  9:23 ` Mike Frysinger
2010-11-10 11:58   ` Daniel Hobi
2010-11-10 22:09     ` Mike Frysinger
2010-11-10 13:11   ` [U-Boot] [PATCH] " Daniel Hobi
2010-11-10 20:00   ` [U-Boot] [WIP] " Wolfgang Denk
2010-11-10 22:06     ` Mike Frysinger
2010-11-10 22:25       ` Wolfgang Denk
2010-11-10 22:51         ` Mike Frysinger
2010-11-10 22:12     ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox