echo off
setlocal

set SetName=4
set Cname=etpuc_set%SetName%.c
set Ename=etpuc_set%SetName%.err
set Hname=etpu_set%SetName%.h

echo .
echo ************ Delete all generated files *************
echo del *.bak *.lst *.err *.cod *.obj *.map *.hex *.asc *.elf *.xrf
del *.bak *.lst *.err *.cod *.obj *.map *.hex *.asc *.elf *.xrf
echo del %Hname%
del %Hname%
echo .\cpu\ del *_auto.h
cd cpu
del *_auto.h
cd ..
echo ********************** Done *************************
echo .

rem ###########################################################  
rem # Byte Craft eTPU V1.0 : Compiler and Command Line Options  
rem ###########################################################  
rem #  
rem #  ?        Manual Pages  
rem #  +da      ASCII format jex dump called source_file.asc  
rem #  +dELF    Generate an ELF File  
rem #  +ds      Generate a standard S16 format hex dump  
rem #  +e       Generate an error file called source_file.err  
rem #  -e       Do not Generate the error file <default>  
rem #  +l       Generate a list file called source_file.lst  
rem #  -l       Do not Generate a list file <default>  
rem #  +o       Generate an obj file rather than a binary code file.  
rem #  -o       Do not Generate an object file <default>  
rem #  +q       Quite mode  
rem #  +x       Generate a cross-reference file called source_file.xrf  
rem #  -x       Do not generate a cross-reference file <default>  
rem #  
rem #  -dident  Define an Identifier prior to compile time.  
rem #  
rem #  c=       Define object file name .cod  
rem #  n=       Include Path, separate with semi-colons  
rem #  t=       Library Path, separate with semi-colons  
rem #  
rem ###########################################################

echo Building %Cname% ...
"c:\Program Files\Byte Craft\ETPUC\ETPU_C.EXE" %Cname%  +l +e +dELF +q n="."
if  %ERRORLEVEL% NEQ 0 ( goto errors )

:no_errors
echo .
echo **************** COMPILATION PASSES *****************
echo .
goto end

:errors
type %Ename%
echo .
echo *****************************************************
echo                  YIKES, WE GOT ERRORS!!
echo *****************************************************
echo .
:end

pause
