public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
@ 2009-10-26 22:17 Scott Wood
  2009-10-26 23:57 ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2009-10-26 22:17 UTC (permalink / raw)
  To: u-boot

Currently, some of the tools instead set CC to be HOSTCC in order to re-use
some pattern rules -- but this fails when the user overrides CC on the make
command line.  Also, the HOSTCFLAGS in tools/Makefile are currently not
being used because config.mk overwrites them.

This patch adds static pattern rules for files that have been requested to
be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
converts the tools to use them.

It restores easylogo to using the host compiler, which was broken by commit
38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional change,
please let me know -- but it seems to be a build tool).

It restores -pedantic and the special flags for darwin and cygwin that were
requested in tools/makefile (but keeps the flags added by config.mk) --
hopefully someone can test this on those platforms.  It no longer
conditionalizes -pedantic on not being darwin; it wasn't clear that that was
intentional, and unless there's a real problem it's just inviting people to
contribute non-pedantic patches to those files (I'm not a fan of -pedantic
personally, but if it's on for one platform it should be on for all).

HOST_LDFLAGS is renamed HOSTLDFLAGS for consistency with the previous
HOST_CFLAGS to HOSTCFLAGS rename.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
This supersedes "tools: Use override when changing CC, CFLAGS, etc.".

 config.mk               |   33 ++++++++++++-
 rules.mk                |   13 ++++-
 tools/Makefile          |  119 +++++++++++++----------------------------------
 tools/easylogo/Makefile |    9 ++-
 tools/gdb/Makefile      |   15 ++----
 tools/imls/Makefile     |   29 ++++--------
 6 files changed, 96 insertions(+), 122 deletions(-)

diff --git a/config.mk b/config.mk
index 8cfd60c..6630826 100644
--- a/config.mk
+++ b/config.mk
@@ -46,13 +46,40 @@ PLATFORM_LDFLAGS =
 
 #########################################################################
 
+HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer \
+		  $(HOSTCPPFLAGS)
+HOSTSTRIP	= strip
+
+#
+# Mac OS X / Darwin's C preprocessor is Apple specific.  It
+# generates numerous errors and warnings.  We want to bypass it
+# and use GNU C's cpp.  To do this we pass the -traditional-cpp
+# option to the compiler.  Note that the -traditional-cpp flag
+# DOES NOT have the same semantics as GNU C's flag, all it does
+# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
+#
+# Apple's linker is similar, thanks to the new 2 stage linking
+# multiple symbol definitions are treated as errors, hence the
+# -multiply_defined suppress option to turn off this error.
+#
+
 ifeq ($(HOSTOS),darwin)
 HOSTCC		= cc
+HOSTCFLAGS	+= -traditional-cpp
+HOSTLDFLAGS	+= -multiply_defined suppress
 else
 HOSTCC		= gcc
 endif
-HOSTCFLAGS	= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTSTRIP	= strip
+
+ifeq ($(HOSTOS),cygwin)
+HOSTCFLAGS	+= -ansi
+endif
+
+# We build some files with extra pedantic flags to try to minimize things
+# that won't build on some weird host compiler -- though there are lots of
+# exceptions for files that aren't complaint.
+
+PEDCFLAGS = $(HOSTCFLAGS) -pedantic
 
 #########################################################################
 #
@@ -200,7 +227,7 @@ endif
 
 #########################################################################
 
-export	HOSTCC HOSTCFLAGS CROSS_COMPILE \
+export	HOSTCC HOSTCFLAGS HOSTLDFLAGS PEDCFLAGS CROSS_COMPILE \
 	AS LD CC CPP AR NM STRIP OBJCOPY OBJDUMP MAKE
 export	TEXT_BASE PLATFORM_CPPFLAGS PLATFORM_RELFLAGS CPPFLAGS CFLAGS AFLAGS
 
diff --git a/rules.mk b/rules.mk
index 6f999dd..e4a6726 100644
--- a/rules.mk
+++ b/rules.mk
@@ -25,11 +25,20 @@
 
 _depend:	$(obj).depend
 
-$(obj).depend:	$(src)Makefile $(TOPDIR)/config.mk $(SRCS)
+$(obj).depend:	$(src)Makefile $(TOPDIR)/config.mk $(SRCS) $(HOSTSRCS)
 		@rm -f $@
 		@for f in $(SRCS); do \
 			g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \
-			$(CC) -M $(HOSTCFLAGS) $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
+			$(CC) -M $(CPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
 		done
+		@for f in $(HOSTSRCS); do \
+			g=`basename $$f | sed -e 's/\(.*\)\.\w/\1.o/'`; \
+			$(HOSTCC) -M $(HOSTCPPFLAGS) -MQ $(obj)$$g $$f >> $@ ; \
+		done
+
+$(HOSTOBJS): $(obj)%.o: %.c
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c
+$(NOPEDOBJS): $(obj)%.o: %.c
+	$(HOSTCC) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) $(HOSTCFLAGS_$(BCURDIR)) -o $@ $< -c
 
 #########################################################################
diff --git a/tools/Makefile b/tools/Makefile
index 2a9a9fd..164113b 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -24,33 +24,6 @@
 TOOLSUBDIRS =
 
 #
-# Mac OS X / Darwin's C preprocessor is Apple specific.  It
-# generates numerous errors and warnings.  We want to bypass it
-# and use GNU C's cpp.  To do this we pass the -traditional-cpp
-# option to the compiler.  Note that the -traditional-cpp flag
-# DOES NOT have the same semantics as GNU C's flag, all it does
-# is invoke the GNU preprocessor in stock ANSI/ISO C fashion.
-#
-# Apple's linker is similar, thanks to the new 2 stage linking
-# multiple symbol definitions are treated as errors, hence the
-# -multiply_defined suppress option to turn off this error.
-#
-
-HOSTCFLAGS = -Wall
-HOST_LDFLAGS =
-
-ifeq ($(HOSTOS)-$(HOSTARCH),darwin-ppc)
-HOSTCFLAGS += -traditional-cpp
-HOST_LDFLAGS += -multiply_defined suppress
-else
-HOSTCFLAGS += -pedantic
-endif
-
-ifeq ($(HOSTOS),cygwin)
-HOSTCFLAGS += -ansi
-endif
-
-#
 # toolchains targeting win32 generate .exe files
 #
 ifneq (,$(findstring WIN32 ,$(shell $(HOSTCC) -E -dM -xc /dev/null)))
@@ -87,17 +60,17 @@ EXT_OBJ_FILES-y += lib_generic/sha1.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
-OBJ_FILES-y += default_image.o
+NOPED_OBJ_FILES-y += default_image.o
 OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
 OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
-OBJ_FILES-y += fit_image.o
+NOPED_OBJ_FILES-y += fit_image.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
-OBJ_FILES-y += kwbimage.o
-OBJ_FILES-y += mkimage.o
+NOPED_OBJ_FILES-y += kwbimage.o
+NOPED_OBJ_FILES-y += mkimage.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
-OBJ_FILES-y += os_support.o
+NOPED_OBJ_FILES-y += os_support.o
 OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o
 
 # Don't build by default
@@ -129,57 +102,52 @@ LOGO_BMP= logos/ronetix.bmp
 endif
 
 # now $(obj) is defined
-SRCS	+= $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
-SRCS	+= $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
-SRCS	+= $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
+HOSTSRCS += $(addprefix $(SRCTREE)/,$(EXT_OBJ_FILES-y:.o=.c))
+HOSTSRCS += $(addprefix $(SRCTREE)/tools/,$(OBJ_FILES-y:.o=.c))
+HOSTSRCS += $(addprefix $(SRCTREE)/libfdt/,$(LIBFDT_OBJ_FILES-y:.o=.c))
 BINS	:= $(addprefix $(obj),$(sort $(BIN_FILES-y)))
 LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 
+HOSTOBJS := $(addprefix $(obj),$(OBJ_FILES-y))
+NOPEDOBJS := $(addprefix $(obj),$(NOPED_OBJ_FILES-y))
+
 #
 # Use native tools and options
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-CPPFLAGS   = -idirafter $(SRCTREE)/include \
+HOSTCPPFLAGS =	-idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
 	        -I $(SRCTREE)/libfdt \
 		-I $(SRCTREE)/tools \
 		-DTEXT_BASE=$(TEXT_BASE) -DUSE_HOSTCC \
 		-D__KERNEL_STRICT_NAMES
-CFLAGS     = $(HOSTCFLAGS) $(CPPFLAGS) -O
-
-# No -pedantic switch to avoid libfdt compilation warnings
-FIT_CFLAGS = -Wall $(CPPFLAGS) -O
 
-AFLAGS	   = -D__ASSEMBLY__ $(CPPFLAGS)
-CC	   = $(HOSTCC)
-STRIP	   = $(HOSTSTRIP)
-MAKEDEPEND = makedepend
 
 all:	$(obj).depend $(BINS) $(LOGO-y) subdirs
 
 $(obj)bin2header$(SFX): $(obj)bin2header.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)bmp_logo$(SFX):	$(obj)bmp_logo.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)envcrc$(SFX):	$(obj)crc32.o $(obj)env_embedded.o $(obj)envcrc.o $(obj)sha1.o
-	$(CC) $(CFLAGS) -o $@ $^
+	$(HOSTCC) $(PEDCFLAGS) -o $@ $^
 
 $(obj)gen_eth_addr$(SFX):	$(obj)gen_eth_addr.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)img2srec$(SFX):	$(obj)img2srec.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)inca-swap-bytes$(SFX):	$(obj)inca-swap-bytes.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)mkimage$(SFX):	$(obj)crc32.o \
 			$(obj)default_image.o \
@@ -191,48 +159,29 @@ $(obj)mkimage$(SFX):	$(obj)crc32.o \
 			$(obj)os_support.o \
 			$(obj)sha1.o \
 			$(LIBFDT_OBJS)
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)mpc86x_clk$(SFX):	$(obj)mpc86x_clk.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)ncb$(SFX):	$(obj)ncb.o
-	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
-	$(STRIP) $@
+	$(HOSTCC) $(PEDCFLAGS) $(HOSTLDFLAGS) -o $@ $^
+	$(HOSTSTRIP) $@
 
 $(obj)ubsha1$(SFX):	$(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o
-	$(CC) $(CFLAGS) -o $@ $^
-
-# Some files complain if compiled with -pedantic, use FIT_CFLAGS
-$(obj)default_image.o: $(SRCTREE)/tools/default_image.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)fit_image.o: $(SRCTREE)/tools/fit_image.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)image.o: $(SRCTREE)/common/image.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)kwbimage.o: $(SRCTREE)/tools/kwbimage.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
-
-$(obj)os_support.o: $(SRCTREE)/tools/os_support.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(HOSTCC) $(PEDCFLAGS) -o $@ $^
 
 # Some of the tool objects need to be accessed from outside the tools directory
 $(obj)%.o: $(SRCTREE)/common/%.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 $(obj)%.o: $(SRCTREE)/lib_generic/%.c
-	$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(HOSTCC) -g $(PEDCFLAGS) -c -o $@ $<
 
 $(LIBFDT_OBJS):
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(HOSTCC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 subdirs:
 ifeq ($(TOOLSUBDIRS),)
@@ -242,8 +191,6 @@ else
 	    $(MAKE) \
 		HOSTOS=$(HOSTOS) \
 		HOSTARCH=$(HOSTARCH) \
-		HOSTCFLAGS="$(HOSTCFLAGS)" \
-		HOST_LDFLAGS="$(HOST_LDFLAGS)" \
 		-C $$dir || exit 1 ; \
 	done
 endif
diff --git a/tools/easylogo/Makefile b/tools/easylogo/Makefile
index 566b125..668ec3b 100644
--- a/tools/easylogo/Makefile
+++ b/tools/easylogo/Makefile
@@ -1,8 +1,11 @@
-CFLAGS += -Wall
+include $(TOPDIR)/config.mk
 
-all: easylogo
+all: $(obj)easylogo
+
+$(obj)easylogo: $(SRCTREE)/tools/easylogo/easylogo.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ $^
 
 clean:
-	rm -f easylogo *.o
+	rm -f $(obj)easylogo
 
 .PHONY: all clean
diff --git a/tools/gdb/Makefile b/tools/gdb/Makefile
index 0a5687d..90037c7 100644
--- a/tools/gdb/Makefile
+++ b/tools/gdb/Makefile
@@ -30,17 +30,14 @@ BINS	= gdbsend gdbcont
 
 COBJS	= gdbsend.o gdbcont.o error.o remote.o serial.o
 
-OBJS	:= $(addprefix $(obj),$(COBJS))
-SRCS	:= $(COBJS:.o=.c)
+HOSTOBJS := $(addprefix $(obj),$(COBJS))
+HOSTSRCS := $(COBJS:.o=.c)
 BINS	:= $(addprefix $(obj),$(BINS))
 
 #
 # Use native tools and options
 #
-CPPFLAGS   = -I$(BFD_ROOT_DIR)/include
-CFLAGS     = $(HOSTCFLAGS) -O $(CPPFLAGS)
-CC	   = $(HOSTCC)
-MAKEDEPEND = makedepend
+HOSTCPPFLAGS = -I$(BFD_ROOT_DIR)/include
 
 HOSTOS := $(shell uname -s | sed -e 's/\([Cc][Yy][Gg][Ww][Ii][Nn]\).*/cygwin/')
 
@@ -54,13 +51,13 @@ else	# ! CYGWIN
 all:	$(obj).depend $(BINS)
 
 $(obj)gdbsend:	$(obj)gdbsend.o $(obj)error.o $(obj)remote.o $(obj)serial.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+		$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
 
 $(obj)gdbcont:	$(obj)gdbcont.o $(obj)error.o $(obj)remote.o $(obj)serial.o
-		$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
+		$(HOSTCC) $(HOSTCFLAGS) $(HOSTLDFLAGS) -o $@ $^
 
 clean:
-	rm -f $(OBJS)
+	rm -f $(HOSTOBJS)
 
 distclean:	clean
 	rm -f $(BINS) $(obj)core $(obj)*.bak $(obj).depend
diff --git a/tools/imls/Makefile b/tools/imls/Makefile
index 59b928c..11b3437 100644
--- a/tools/imls/Makefile
+++ b/tools/imls/Makefile
@@ -19,8 +19,6 @@
 
 include $(TOPDIR)/config.mk
 
-HOSTCFLAGS = -Wall -pedantic
-
 # Generated executable files
 BIN_FILES-y += imls
 
@@ -48,50 +46,43 @@ BINS	:= $(addprefix $(obj),$(sort $(BIN_FILES-y)))
 LIBFDT_OBJS	:= $(addprefix $(obj),$(LIBFDT_OBJ_FILES-y))
 
 #
-# Use native tools and options
+# Compile for a hosted environment on the target
 # Define __KERNEL_STRICT_NAMES to prevent typedef overlaps
 #
-CPPFLAGS   = -idirafter $(SRCTREE)/include \
+HOSTCPPFLAGS  = -idirafter $(SRCTREE)/include \
 		-idirafter $(OBJTREE)/include2 \
 		-idirafter $(OBJTREE)/include \
 	        -I $(SRCTREE)/libfdt \
 		-I $(SRCTREE)/tools \
 		-DUSE_HOSTCC -D__KERNEL_STRICT_NAMES
-CFLAGS     = $(HOSTCFLAGS) $(CPPFLAGS) -O
-
-# No -pedantic switch to avoid libfdt compilation warnings
-FIT_CFLAGS = -Wall $(CPPFLAGS) -O
-
-CC	   = $(CROSS_COMPILER)gcc
-STRIP	   = $(CROSS_COMPILER)strip
 
 ifeq ($(MTD_VERSION),old)
-CPPFLAGS += -DMTD_OLD
+HOSTCPPFLAGS += -DMTD_OLD
 endif
 
 all:	$(BINS)
 
 $(obj)imls:	$(obj)imls.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \
 		$(obj)sha1.o $(LIBFDT_OBJS)
-	$(CC) $(CFLAGS) -o $@ $^
+	$(CC) $(PEDCFLAGS) -o $@ $^
 	$(STRIP) $@
 
 # Some files complain if compiled with -pedantic, use FIT_CFLAGS
 $(obj)image.o: $(SRCTREE)/common/image.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(HOSTCFLAGS) -c -o $@ $<
 
-$(obj)imls.o: imls.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+$(obj)imls.o: $(SRCTREE)/tools/imls/imls.c
+	$(CC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 # Some of the tool objects need to be accessed from outside the tools/imls directory
 $(obj)%.o: $(SRCTREE)/common/%.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 $(obj)%.o: $(SRCTREE)/lib_generic/%.c
-	$(CC) -g $(CFLAGS) -c -o $@ $<
+	$(CC) -g $(PEDCFLAGS) -c -o $@ $<
 
 $(obj)%.o: $(SRCTREE)/libfdt/%.c
-	$(CC) -g $(FIT_CFLAGS) -c -o $@ $<
+	$(CC) -g $(HOSTCFLAGS) -c -o $@ $<
 
 clean:
 	rm -rf *.o imls
-- 
1.6.4.4

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-26 22:17 [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools Scott Wood
@ 2009-10-26 23:57 ` Mike Frysinger
  2009-10-27 19:34   ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2009-10-26 23:57 UTC (permalink / raw)
  To: u-boot

On Monday 26 October 2009 18:17:03 Scott Wood wrote:
> Currently, some of the tools instead set CC to be HOSTCC in order to re-use
> some pattern rules -- but this fails when the user overrides CC on the make
> command line.  Also, the HOSTCFLAGS in tools/Makefile are currently not
> being used because config.mk overwrites them.
> 
> This patch adds static pattern rules for files that have been requested to
> be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
> converts the tools to use them.

your new easylogo rule lacks HOSTLDFLAGS ...

perhaps it would make more sense to create a HOSTCOMPILE/HOSTLINK (or 
whatever) variable so this kind of thing isnt missed ?
HOSTCOMPILE = $(HOSTCC) $(HOSTCFLAGS)
HOSTLINK = $(HOSTCOMPILE) $(HOSTLDFLAGS)

also, PEDCFLAGS seems at odds with the rest of your consistency changes.  how 
about naming it HOSTCFLAGS+PED ?  then you would have a new var:
HOSTCOMPILE+PED = $(HOSTCC) $(HOSTCFLAGS+PED)

> It restores easylogo to using the host compiler, which was broken by commit
> 38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional
>  change, please let me know -- but it seems to be a build tool).

it was intentional, but for different reasons.  easylogo isnt integrated into 
the u-boot build system, so in order to compile things in there, you had to go 
into the subdir and manually run `make`.  if it were integrated into the build 
system like all other tools, then converting to host tools is fine.  but 
unless i missed something, it doesnt appear to be ?  and now, going into the 
subdir and running `make` wont work either ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091026/c7ec0167/attachment.pgp 

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-26 23:57 ` Mike Frysinger
@ 2009-10-27 19:34   ` Scott Wood
  2009-10-28  7:27     ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2009-10-27 19:34 UTC (permalink / raw)
  To: u-boot

On Mon, Oct 26, 2009 at 07:57:50PM -0400, Mike Frysinger wrote:
> On Monday 26 October 2009 18:17:03 Scott Wood wrote:
> > Currently, some of the tools instead set CC to be HOSTCC in order to re-use
> > some pattern rules -- but this fails when the user overrides CC on the make
> > command line.  Also, the HOSTCFLAGS in tools/Makefile are currently not
> > being used because config.mk overwrites them.
> > 
> > This patch adds static pattern rules for files that have been requested to
> > be built with the native compiler using $(HOSTSRCS) and $(HOSTOBJS), and
> > converts the tools to use them.
> 
> your new easylogo rule lacks HOSTLDFLAGS ...

OK, will add.

> perhaps it would make more sense to create a HOSTCOMPILE/HOSTLINK (or 
> whatever) variable so this kind of thing isnt missed ?
> HOSTCOMPILE = $(HOSTCC) $(HOSTCFLAGS)
> HOSTLINK = $(HOSTCOMPILE) $(HOSTLDFLAGS)

Maybe.  What about PEDCFLAGS?  Should that be the default for HOSTCOMPILE,
and then have a HOSTCOMPILENOPED?

> also, PEDCFLAGS seems at odds with the rest of your consistency changes. 
> how about naming it HOSTCFLAGS+PED ?  then you would have a new var:
> HOSTCOMPILE+PED = $(HOSTCC) $(HOSTCFLAGS+PED)

I left off the HOST for conciseness because we only use -pedantic when
building hosted stuff (and that's unlikely to change, since main u-boot code
has lower portability requirements), but I can add it if desired.

> > It restores easylogo to using the host compiler, which was broken by commit
> > 38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an intentional
> >  change, please let me know -- but it seems to be a build tool).
> 
> it was intentional, but for different reasons.  easylogo isnt integrated
> into the u-boot build system, so in order to compile things in there, you
> had to go into the subdir and manually run `make`.  if it were integrated
> into the build system like all other tools, then converting to host tools
> is fine.  but unless i missed something, it doesnt appear to be ?  and
> now, going into the subdir and running `make` wont work either ...

I was expecting it to be built by adding easylogo to TOOLSUBDIRS (it would
be better if there were a distinct make target for it, but that's another
patch).  Other tools such as gdb already assume they're being run in this
manner.

-Scott

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-27 19:34   ` Scott Wood
@ 2009-10-28  7:27     ` Mike Frysinger
  2009-10-29 16:18       ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2009-10-28  7:27 UTC (permalink / raw)
  To: u-boot

On Tuesday 27 October 2009 15:34:10 Scott Wood wrote:
> On Mon, Oct 26, 2009 at 07:57:50PM -0400, Mike Frysinger wrote:
> > perhaps it would make more sense to create a HOSTCOMPILE/HOSTLINK (or
> > whatever) variable so this kind of thing isnt missed ?
> > HOSTCOMPILE = $(HOSTCC) $(HOSTCFLAGS)
> > HOSTLINK = $(HOSTCOMPILE) $(HOSTLDFLAGS)
> 
> Maybe.  What about PEDCFLAGS?  Should that be the default for HOSTCOMPILE,
> and then have a HOSTCOMPILENOPED?

i think the intention was to build everything with -pedantic.  so add it to 
the default flags and drop the distinction completely.  it'd make the 
resulting build code a lot simpler.

> > > It restores easylogo to using the host compiler, which was broken by
> > > commit 38d299c2db81bd889c601b5dfc12c4e83ef83333 (if this was an
> > > intentional change, please let me know -- but it seems to be a build
> > > tool).
> >
> > it was intentional, but for different reasons.  easylogo isnt integrated
> > into the u-boot build system, so in order to compile things in there, you
> > had to go into the subdir and manually run `make`.  if it were integrated
> > into the build system like all other tools, then converting to host tools
> > is fine.  but unless i missed something, it doesnt appear to be ?  and
> > now, going into the subdir and running `make` wont work either ...
> 
> I was expecting it to be built by adding easylogo to TOOLSUBDIRS (it would
> be better if there were a distinct make target for it, but that's another
> patch).  Other tools such as gdb already assume they're being run in this
> manner.

where does TOOLSUBDIRS get changed ?  i dont see any place in u-boot where it 
is set and your patch doesnt change that from what i can see.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091028/8e98a68d/attachment.pgp 

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-28  7:27     ` Mike Frysinger
@ 2009-10-29 16:18       ` Scott Wood
  2009-10-30  8:28         ` Wolfgang Denk
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2009-10-29 16:18 UTC (permalink / raw)
  To: u-boot

On Wed, Oct 28, 2009 at 03:27:26AM -0400, Mike Frysinger wrote:
> On Tuesday 27 October 2009 15:34:10 Scott Wood wrote:
> > On Mon, Oct 26, 2009 at 07:57:50PM -0400, Mike Frysinger wrote:
> > > perhaps it would make more sense to create a HOSTCOMPILE/HOSTLINK (or
> > > whatever) variable so this kind of thing isnt missed ?
> > > HOSTCOMPILE = $(HOSTCC) $(HOSTCFLAGS)
> > > HOSTLINK = $(HOSTCOMPILE) $(HOSTLDFLAGS)
> > 
> > Maybe.  What about PEDCFLAGS?  Should that be the default for HOSTCOMPILE,
> > and then have a HOSTCOMPILENOPED?
> 
> i think the intention was to build everything with -pedantic.  so add it to 
> the default flags and drop the distinction completely.  it'd make the 
> resulting build code a lot simpler.

We can't build everything with it, as we have a lot of code that is
incompatible.  There were already exceptions in the makefiles for these
files.  Fixing that code is beyond the scope of this change, especially for
code like libfdt that has an external upstream.

I'd be OK with removing -pedantic from everything, if Wolfgang agrees.

> > I was expecting it to be built by adding easylogo to TOOLSUBDIRS (it would
> > be better if there were a distinct make target for it, but that's another
> > patch).  Other tools such as gdb already assume they're being run in this
> > manner.
> 
> where does TOOLSUBDIRS get changed ?  i dont see any place in u-boot where it 
> is set and your patch doesnt change that from what i can see.

On the command line (or by editing the makefile), apparently.  It's not
great, but again, changing that is outside the scope of this change.

-Scott

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-29 16:18       ` Scott Wood
@ 2009-10-30  8:28         ` Wolfgang Denk
  2009-10-30 15:53           ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Denk @ 2009-10-30  8:28 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

In message <20091029161835.GA28414@loki.buserror.net> you wrote:
>
> We can't build everything with it, as we have a lot of code that is
> incompatible.  There were already exceptions in the makefiles for these
> files.  Fixing that code is beyond the scope of this change, especially for
> code like libfdt that has an external upstream.
> 
> I'd be OK with removing -pedantic from everything, if Wolfgang agrees.

I don't agree. Rather I'd like to see it added everywhere, or at least
to all code that is compiled using HOSTCC.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Love sometimes expresses itself in sacrifice.
	-- Kirk, "Metamorphosis", stardate 3220.3

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-30  8:28         ` Wolfgang Denk
@ 2009-10-30 15:53           ` Scott Wood
  2009-10-30 16:43             ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2009-10-30 15:53 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 30, 2009 at 09:28:04AM +0100, Wolfgang Denk wrote:
> Dear Scott Wood,
> 
> In message <20091029161835.GA28414@loki.buserror.net> you wrote:
> >
> > We can't build everything with it, as we have a lot of code that is
> > incompatible.  There were already exceptions in the makefiles for these
> > files.  Fixing that code is beyond the scope of this change, especially for
> > code like libfdt that has an external upstream.
> > 
> > I'd be OK with removing -pedantic from everything, if Wolfgang agrees.
> 
> I don't agree. Rather I'd like to see it added everywhere, or at least
> to all code that is compiled using HOSTCC.

Well, then someone has to fix the code that doesn't build with -pedantic --
including upstream code from libfdt.

That's beyond the scope of a makefile restructuring, though this patch does
make it a little simpler to move files from one set to another as they get
fixed.

-Scott

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-30 15:53           ` Scott Wood
@ 2009-10-30 16:43             ` Mike Frysinger
  2009-10-30 16:47               ` Scott Wood
  0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2009-10-30 16:43 UTC (permalink / raw)
  To: u-boot

On Friday 30 October 2009 11:53:43 Scott Wood wrote:
> On Fri, Oct 30, 2009 at 09:28:04AM +0100, Wolfgang Denk wrote:
> > Scott Wood wrote:
> > > We can't build everything with it, as we have a lot of code that is
> > > incompatible.  There were already exceptions in the makefiles for these
> > > files.  Fixing that code is beyond the scope of this change, especially
> > > for code like libfdt that has an external upstream.
> > >
> > > I'd be OK with removing -pedantic from everything, if Wolfgang agrees.
> >
> > I don't agree. Rather I'd like to see it added everywhere, or at least
> > to all code that is compiled using HOSTCC.
> 
> Well, then someone has to fix the code that doesn't build with -pedantic --
> including upstream code from libfdt.
> 
> That's beyond the scope of a makefile restructuring, though this patch does
> make it a little simpler to move files from one set to another as they get
> fixed.

then lets go the route you proposed -- invert the logic.  default includes the 
-pedantic flag while the HOSTCOMPILE_NOPED does not.  and we use that for the 
code that needs newer standards.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091030/6cc95e05/attachment.pgp 

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-30 16:43             ` Mike Frysinger
@ 2009-10-30 16:47               ` Scott Wood
  2009-10-30 17:28                 ` Mike Frysinger
  0 siblings, 1 reply; 10+ messages in thread
From: Scott Wood @ 2009-10-30 16:47 UTC (permalink / raw)
  To: u-boot

Mike Frysinger wrote:
> then lets go the route you proposed -- invert the logic.  default includes the 
> -pedantic flag while the HOSTCOMPILE_NOPED does not.  and we use that for the 
> code that needs newer standards.

OK.

Should I drop the easylogo change, if it's currently being built outside 
the toplevel makefile system?

-Scott

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

* [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools
  2009-10-30 16:47               ` Scott Wood
@ 2009-10-30 17:28                 ` Mike Frysinger
  0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2009-10-30 17:28 UTC (permalink / raw)
  To: u-boot

On Friday 30 October 2009 12:47:33 Scott Wood wrote:
> Mike Frysinger wrote:
> Should I drop the easylogo change, if it's currently being built outside
> the toplevel makefile system?

if you tested what you said (setting the var from the cmdline), then i'd leave 
it.  we can address poor tool integration later since it affects a lot of 
subdirs beyond easylogo.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20091030/2bf01945/attachment.pgp 

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

end of thread, other threads:[~2009-10-30 17:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26 22:17 [U-Boot] [PATCH] makefiles: fixes/cleanup for building build tools Scott Wood
2009-10-26 23:57 ` Mike Frysinger
2009-10-27 19:34   ` Scott Wood
2009-10-28  7:27     ` Mike Frysinger
2009-10-29 16:18       ` Scott Wood
2009-10-30  8:28         ` Wolfgang Denk
2009-10-30 15:53           ` Scott Wood
2009-10-30 16:43             ` Mike Frysinger
2009-10-30 16:47               ` Scott Wood
2009-10-30 17:28                 ` Mike Frysinger

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