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