# uboot/Makefile
#
-TOPDIR = $(shell pwd)
+PWD = $(shell pwd)
WORK = $(PWD)/work
-.PHONY: all mkimage clean dist-clean
+UBOOT_VERSION = 2011.12
-all: mkimage
+.PHONY: all help mkimage clean distclean cubox cubox-clean cubox-distclean efikamx efikamx-clean efikamx-distclean
-clean: mkimage-clean
+all: help
-dist-clean: mkimage-distclean
+help:
+ @echo "Usage: make <target>"
+ @echo "Where targets available are:"
+ @echo " mkimage Build mkimage binary for your host"
+ @echo " <device> Where device specified should appear under"
+ @echo " devices's dir as for example: cubox, efikamx, ..."
+ @echo " clean Remove generated files"
+ @echo " distclean Remove generated files and temporary sources"
-$(WORK)/mkimage:
- $(CC) -Wall -o $(WORK)/mkimage -c $(WORK)/mkimage.c
- install -m 0755 $(WORK)/mkimage mkimage
+clean: mkimage-clean cubox-clean efikamx-clean
+
+distclean: mkimage-distclean cubox-distclean efikamx-distclean
+
+
+$(WORK)/u-boot-$(UBOOT_VERSION).tar.bz2:
+ wget -P $(WORK) ftp://ftp.denx.de/pub/u-boot/u-boot-$(UBOOT_VERSION).tar.bz2
+
+$(WORK)/u-boot-$(UBOOT_VERSION): $(WORK)/u-boot-$(UBOOT_VERSION).tar.bz2
+ tar -C $(WORK) -xjf $(WORK)/u-boot-$(UBOOT_VERSION).tar.bz2
+ touch $(WORK)/u-boot-$(UBOOT_VERSION)
+
+$(WORK)/mkimage: $(WORK)/u-boot-$(UBOOT_VERSION)
+ cd $(WORK)/u-boot-$(UBOOT_VERSION) && \
+ make tools && \
+ install -m 0755 $(WORK)/u-boot-$(UBOOT_VERSION)/tools/mkimage $(WORK)/mkimage
mkimage: $(WORK)/mkimage
rm -f $(WORK)/mkimage mkimage
mkimage-distclean: mkimage-clean
+ rm -rf $(WORK)/u-boot-$(UBOOT_VERSION) $(WORK)/u-boot-$(UBOOT_VERSION).tar.bz2
+
+cubox: mkimage
+ make -C devices/cubox
+
+cubox-clean:
+ make -C devices/cubox clean
+
+cubox-distclean:
+ make -C devices/cubox distclean
+
+efikamx: mkimage
+ make -C devices/efikamx
+
+efikamx-clean:
+ make -C devices/efikamx clean
+
+efikamx-distclean:
+ make -C devices/efikamx distclean
+
+# End of file