@echo %DEBUG% off 
::  NeXtMidas 'Clean' script to remove all executables so
::  that they can be re-compiled from scratch.
::
::  @version $Id: nmclean.bat,v 1.4 2011/06/01 16:59:38 ntn Exp $
::
::  Usage:  
::        nmclean         - removes all generated files (not pre-compiled DLLs)
::        nmclean alldlls - removes all generated files, including the
::                          pre-compiled DLLs (for debugging native builds)
::
::  Notes:  Options passed to the Windows 'delete' command:
::           /Q don't prompt user for confirmation on wildcard deletes
::           /S traverse all subdirectories
:: -------------------------------------------------------------

echo Cleaning all executables...

::	By default, pre-compiled DLLs remain in the source tree. But
::	if the user is compiling native files (he specified a C compiler), 
::	a flag to this script will remove the pre-compiled DLLs so they won't
::      be used accidentally.
::
if not defined NM_CC     goto cleanGeneratedDLLs
if [%NM_CC%] == [none]   goto cleanGeneratedDLLs
if not [%1] == [alldlls] goto cleanGeneratedDLLs 
echo ...DEVELOPER: deleting all pre-compiled DLLs and exe files
del/Q   "%NMROOT%\os\dos\dlls\*.dll"
del/Q/S "%NMROOT%\os\dos\*.exe"

:cleanGeneratedDLLs
::	Delete any DLLs that were built within the nxm source directory
::	(does not delete the pre-compiled DLLs)
::
echo ...deleting DLLs built within the nxm source directory (if any exist)
del/Q/S "%NMROOT%\nxm\*.dll"

: cleanJavaFiles
::	Delete all java class files
::	
echo ...cleaning all Java class files (if any exist)
del/Q/S "%NMROOT%\nxm\*.class"


::	Delete generated SYS Webstart jar files
::
echo ...deleting generated system jar files (if any exist)
del/Q "%NMROOT%\jars\nxm*.jar"

echo ...end nmclean
