anchor.diff:  	REM Default env vars
   	IF NOT DEFINED debug			set debug=0
   	IF NOT DEFINED debug_coverage	set debug_coverage=0
  -	IF NOT DEFINED force_build		set no_build=0
  -	
   	IF NOT DEFINED GCC				set GCC=gcc
   	IF NOT DEFINED AR				set AR=ar
   	IF NOT DEFINED MAKE				set MAKE=make
  -	
   	IF NOT DEFINED GCC_VER			set GCC_VER=gnu99
   	
   	
  -	REM Basic switches
  +	REM Basic help switches
   	if [] == [%1] (
   		echo No arguments specified.
   		echo.
  
positive.code: 	
  	
  	IF [%1] == [package] (
  		IF [%2] == [luajit] (
  			echo Building luajit...
  			
  			pushd luajit-2.0\src
  				IF NOT EXIST "lua51.dll" (
  					%MAKE% -j%NUMBER_OF_PROCESSORS%
  				) ELSE (
  					IF [%force_build%] == [1] (
  						%MAKE% -j%NUMBER_OF_PROCESSORS%
  					)
  				)
  				echo Installing...
  				xcopy /Y lua.h		..\..\include
  				xcopy /Y luaconf.h	..\..\include
  				xcopy /Y lualib.h	..\..\include
  				xcopy /Y lauxlib.h	..\..\include
  				xcopy /Y luajit.h	..\..\include
  				xcopy /Y lua51.dll	..\..\dll
  			popd
  			
  			echo Finished building and linking luajit.
  		) ELSE (
  			echo Building %2...
  			
  			pushd lua-all\%2
  				IF NOT EXIST "*.dll" (
  					echo Compiling...
  					%GCC% -std=%GCC_VER% -g0 -O2 -Wall -Wextra %lua_cflags% -DLUA_BUILD_AS_DLL -c *.c
  					
  					del lua.o
  					del luac.o
  					
  					echo Linking...
  					%GCC% -std=%GCC_VER% -g0 -O2 -Wall -Wextra -shared -o %2.dll *.o
  					
  					echo Archiving...
  					%AR% rcu lib%2.a *.o
  				) ELSE (
  					IF [%force_build%] == [1] (
  						echo Compiling...
  						%GCC% -std=%GCC_VER% -g0 -O2 -Wall -Wextra %lua_cflags% -DLUA_BUILD_AS_DLL -c *.c
  						
  						del lua.o
  						del luac.o
  						
  						echo Linking...
  						%GCC% -std=%GCC_VER% -g0 -O2 -Wall -Wextra -shared -o %2.dll *.o
  						
  						echo Archiving...
  						%AR% rcu lib%2.a *.o
  					)
  				)
  				
  				echo Installing...
  				xcopy /Y lua.h			..\..\include
  				xcopy /Y luaconf.h		..\..\include
  				xcopy /Y lualib.h		..\..\include
  				xcopy /Y lauxlib.h		..\..\include
  				xcopy /Y %2.dll			..\..\dll
  				xcopy /Y lib%2.a		..\..\lib
  			popd
  			
  			echo Finished building and linking %2.
  		)
  		
  		echo Creating local luaw package as %2...
  		
  		if [%2] == [luajit] (
  			echo Compiling luaw package %2...
  			%GCC% %attrib% %dirs% %luaverdef% -D__USE_MINGW_ANSI_STDIO=1 -DLC_LD_DLL -DLUA_JIT_51 -c %srcdir%\ldata.c %srcdir%\jitsupport.c %srcdir%\darr.c
  			
  			echo Linking luaw package %2...
  			%GCC% %attrib% %dirs% -shared -o lc%2.dll ldata.o jitsupport.o darr.o %dlldir%\lua51.dll
  		) ELSE (
  			echo Compiling luaw package %2...
  			%GCC% %attrib% %dirs% %luaverdef% -D__USE_MINGW_ANSI_STDIO=1 -DLC_LD_DLL -c %srcdir%\ldata.c %srcdir%\jitsupport.c %srcdir%\darr.c
  			
  			echo Linking luaw package %2...
  			%GCC% %attrib% %dirs% -shared -o lc%2.dll ldata.o jitsupport.o darr.o %dlldir%\%2.dll
  		)
  		
  		echo Finished building and linking %2.
  		
  		REM Migrate binaries
  		echo Migrating binaries...
  		move /Y *.dll		%root%
  		move /Y *.o			%objdir%
  		move /Y *.a			%libdir%
  		copy /Y %resdir%\*	%root%\res
  		copy /Y %dlldir%\*	%root%
  		copy /Y %rootdir%\*	%root%
  		
  		echo Finished.
  		exit /b 0
  	)
  	
  	
  endlocal
  
  
negative.code: 	
  	REM --------------------------------------------------------------------
  	
  	IF [%1] == [driver] (
  		echo Cleaning workspace...
  		REM Resets bin
  		IF EXIST %root% rmdir /S /Q %root%
  		
  		REM Resets dll
  		del %dlldir%\*.dll
  		
  		REM Output build structure
  		mkdir %root%\res
  		
  		REM Build dependencies
  		IF [%2] == [luajit] (
  			call :build_luajit
  		) ELSE (
  			IF NOT EXIST "lua-all/%2" (
  				echo Not a valid lua version!
  				goto failure
  			)
  			call :build_lua %2
  		)
  		
  		REM Build driver
  		call :build_driver %2
  		
  		REM Build install
  		move /Y luaw.exe %root%\luaw.exe
  		copy /Y %resdir%\*	%root%\res
  		echo wrap 1
  		copy /Y %rootdir%\*	%root%
  		echo wrap 1 eof
  		call :build_install %2
  		
  		echo Finished.
  		exit /b 0
  