#
# Build the exportable image of the ECSHOP
#
# Current version is ecshop_3.3.2
#

GBA_SOURCE=../../..

BWTREE=$(GBA_SOURCE)/sw/bw/build

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

WIISHOP_DIR=$(RVL_SDK_PREFIX)/wiishop

DEVKIT=ecshop

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

default headers exports runtests:

install_wshop:
	#
	# install ipl files and ecshop
	cat iplfiles | (cd $(WIISHOP_DIR); tar -cf - -T -) | (cd $(DEVKIT); tar xf -)
	#
	# install the modified html files
	cat resourcefiles | (cd $(WIISHOP_DIR); tar -cf - -T -) | (cd $(DEVKIT); tar xf -)

install_shopping_wad:
	@mkdir -p $(DEVKIT)/resources/viewer
	#
	# install built shopping wad files
	cat wshopfiles | (cd $(BWTREE)/tests/wiishop; tar cf - -T -) | (cd $(DEVKIT)/resources/viewer; tar xf -)

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

install: setup install_wshop #install_shopping_wad
	# let dependent targets get individual components
	#
	# zip 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)
