]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - tools/env/Makefile
Merge branch 'master' of git://git.denx.de/u-boot-samsung
[karo-tx-uboot.git] / tools / env / Makefile
index 7da1d2b7b0f46d4a6adbf258decc3c921a2d475f..2f7a59c00b959a04a8f28d64b1d5b662b26dd849 100644 (file)
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2002
+# (C) Copyright 2002-2006
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 #
 # See file CREDITS for list of people who contributed to this
@@ -12,7 +12,7 @@
 #
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
 # MA 02111-1307 USA
 #
 
-SOURCES := crc32.c  fw_env.c  fw_env_main.c
-HEADERS := fw_env.h
+include $(TOPDIR)/config.mk
 
-all:   fw_printenv
+HOSTSRCS := $(obj)crc32.c  fw_env.c  fw_env_main.c
+HEADERS        := fw_env.h
 
-fw_printenv:   $(SOURCES) $(HEADERS)
-       $(CROSS_COMPILE)gcc -Wall -DUSE_HOSTCC $(SOURCES) -o fw_printenv
+# Compile for a hosted environment on the target
+HOSTCPPFLAGS  = -idirafter $(SRCTREE)/include \
+               -idirafter $(OBJTREE)/include2 \
+               -idirafter $(OBJTREE)/include \
+               -DUSE_HOSTCC
+
+ifeq ($(MTD_VERSION),old)
+HOSTCPPFLAGS += -DMTD_OLD
+endif
+
+all:   $(obj)fw_printenv
+
+# Some files complain if compiled with -pedantic, use HOSTCFLAGS_NOPED
+$(obj)fw_printenv:     $(HOSTSRCS) $(HEADERS)
+       $(HOSTCC) $(HOSTCFLAGS_NOPED) $(HOSTLDFLAGS) -o $@ $(HOSTSRCS)
 
 clean:
-       rm -f fw_printenv crc32.c
+       rm -f $(obj)fw_printenv $(obj)crc32.c
 
-crc32.c:
-       ln -s ../../lib_generic/crc32.c crc32.c
+$(obj)crc32.c:
+       ln -s $(src)../../lib/crc32.c $(obj)crc32.c
 
 #########################################################################
 
-.depend:       Makefile $(SOURCES)
-               $(CC) -M $(HOST_CFLAGS) $(CPPFLAGS) -DUSE_HOSTCC $(SOURCES) > $@
+include $(TOPDIR)/rules.mk
 
-sinclude .depend
+sinclude $(obj).depend
 
 #########################################################################
-