Skip to content

Commit

Permalink
tools/env: cleanup host build flags
Browse files Browse the repository at this point in the history
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 <[email protected]>
Tested-by: Detlev Zundel <[email protected]>
Tested-by: Steve Sakoman <[email protected]>
  • Loading branch information
Daniel Hobi authored and wdenx committed Nov 14, 2010
1 parent 34bbf61 commit 02bd475
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tools/env/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 02bd475

Please sign in to comment.