# Makefile for Embedded C++ 4.0.

NSIS=G:/Program Files/NSIS
EVC=G:/Program Files/Microsoft eMbedded C++ 4.0
WCETOOLS=G:/Program Files/Windows CE Tools
WCE=wce420
PPC=POCKET PC 2003

MAKENSIS="$(NSIS)/makensis.exe"

all: bin

version.h: version.bat
	version.bat

bin: Build\Zroft.exe

Build\Zroft.exe: version.h
	cd "EVC_Build" && "$(EVC)/Common/EVC/Bin/EVC.COM" ZroftEVC.vcp /make "ZroftEVC - Win32 (WCE ARMV4) Release"

binupx: bin
	upx -q --best Build\Zroft.exe

dist: cab installer

WCETOOLS_TOOLS=$(WCETOOLS)/$(WCE)/$(PPC)/Tools

# set CABWIZEXE="G:\Program Files\Windows CE Tools\wce420\POCKET PC 2003\Tools\Cabwiz.exe"
# %CABWIZEXE% Zroft.inf /err Zroft.log %*
cab: bin
	cd "Device CAB"
	copy "$(WCETOOLS_TOOLS)\*.exe" . >nul
	copy "$(WCETOOLS_TOOLS)\*.ddf" . >nul
	$(COMSPEC) /c "$(WCETOOLS_TOOLS)/Cabwiz.exe" Zroft.inf /err Zroft.log
	del *.exe
	del *.ddf
	cd ..

installer: cab
	cd Installer
	$(MAKENSIS) Installer.nsi
	cd ..

sdist:
	Make-Source-Dist.bat
