#
# Build the exportable image of the ECDK
#
# grab current version from ecdk_current
#

GBA_SOURCE=../../..

include $(GBA_SOURCE)/sw/devroot/include/make/SDKdefs

DEVKIT=RevoEX
BWTREE=$(GBA_SOURCE)/sw/bw

SDK_PATH = $(HOME)/bw/exports/ecdk
CURRDATE = $(shell date +%Y%m%d%H)
SDK_IMAGE = $(SDK_PATH)/ecdk_$(CURRDATE).zip

default headers exports runtests:

install_ecdk: SDK_NAME=ecdk_current
install_ecdk:
	#
	# install exported EC lib files
	cat ecfiles | (cd $(REVOLUTION_EXT_ROOT); tar cf - -T -) | (cd $(DEVKIT); tar xf -)
	#
	# install ecdemo app
	cat ecdemofiles | (cd $(BWTREE); tar cf - -T -) | (cd $(DEVKIT); tar xf -)

install_rmown: SDK_NAME=ecshop_3.3.1
install_rmown:
	#
	# install exported rmown files
	cat rmownfiles | (cd $(REVOLUTION_EXT_ROOT); tar cf - -T -) | (cd $(DEVKIT); tar xf -)

setup:
	rm -rf $(DEVKIT)
	mkdir -p $(DEVKIT)

install: setup install_ecdk install_rmown
    # let dependent targets get individual components
	#
	# filter out CVS directories
	find $(DEVKIT) -type d -name CVS -prune -exec rm -rf "{}" ";"
	#
	# tar up the resulting tree
	rm -rf $(SDK_IMAGE) $(SDK_PATH)/latest
	mkdir -p $(SDK_PATH)/latest
	zip -rq $(SDK_IMAGE) $(DEVKIT)
	(cd $(SDK_PATH)/latest; unzip -q $(SDK_IMAGE))
    
clean:
	rm -rf $(DEVKIT)

clobber: clean
	rm -f $(SDK_IMAGE)
