[U-Boot] [PATCH] Fix building tools alone with host compiler

François Revol revol at free.fr
Fri Mar 18 22:03:03 CET 2011


- don't include config.h when building with host cc,
- HOSTCFLAGS was defined with the wrong name, so wasn't used,
- make sure make finds sources outside of tools/.

Signed-off-by: François Revol <revol at free.fr>
---
 tools/Makefile   |    6 +++---
 tools/imximage.h |    2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/Makefile b/tools/Makefile
index 623f908..1ca497e 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -140,7 +140,7 @@ NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y))
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-HOSTCPPFLAGS =	-idirafter $(SRCTREE)/include \
+HOSTCFLAGS =	-idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
 	        -I $(SRCTREE)/lib/libfdt \
@@ -201,10 +201,10 @@ $(obj)ubsha1$(SFX):	$(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o
 	$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
 
 # Some of the tool objects need to be accessed from outside the tools directory
-$(obj)%.o: $(SRCTREE)/common/%.c
+$(subst common/,,$(filter common/%,$(EXT_OBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/common/%.c
 	$(HOSTCC) -g $(HOSTCFLAGS_NOPED) -c -o $@ $<
 
-$(obj)%.o: $(SRCTREE)/lib/%.c
+$(subst lib/,,$(filter lib/%,$(EXT_OBJ_FILES-y))): $(obj)%.o: $(SRCTREE)/lib/%.c
 	$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 $(obj)%.o: $(SRCTREE)/lib/libfdt/%.c
diff --git a/tools/imximage.h b/tools/imximage.h
index 38ca6be..38d8742 100644
--- a/tools/imximage.h
+++ b/tools/imximage.h
@@ -24,7 +24,9 @@
 #ifndef _IMXIMAGE_H_
 #define _IMXIMAGE_H_
 
+#ifndef USE_HOSTCC
 #include <config.h>
+#endif
 
 #define MAX_HW_CFG_SIZE_V2 121 /* Max number of registers imx can set for v2 */
 #define MAX_HW_CFG_SIZE_V1 60  /* Max number of registers imx can set for v1 */
-- 
1.7.2.2



More information about the U-Boot mailing list