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: 	
  	REM --------------------------------------------------------------------
  	
  	
  	IF [%1] == [driver] (
  		
  		echo Cleaning bin...
  		REM Resets bin\res
  		IF EXIST %root% ( rmdir /S /Q %root% )
  		mkdir %root%\res
  		
  		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.
  		)
  		
  		if [%2] == [luajit] (
  			echo Compiling luaw driver...
  			%GCC% %attrib% %dirs% -D__USE_MINGW_ANSI_STDIO=1 -DDEFAULT_LUA=\"lc%2.dll\" -c %srcdir%\darr.c %srcdir%\luadriver.c
  			
  			echo Compiling default luaw driver 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 driver...
  			%GCC% %attrib% %dirs% -o luaw.exe luadriver.o darr.o
  		
  			echo Linking default luaw driver package %2...
  			%GCC% %attrib% %dirs% -shared -o lc%2.dll ldata.o jitsupport.o darr.o %dlldir%\lua51.dll
  		) ELSE (
  			echo Compiling luaw driver...
  			%GCC% %attrib% %dirs% -D__USE_MINGW_ANSI_STDIO=1 -DDEFAULT_LUA=\"lc%2.dll\" -c %srcdir%\darr.c %srcdir%\luadriver.c
  			
  			echo Compiling default luaw driver 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 driver...
  			%GCC% %attrib% %dirs% -o luaw.exe luadriver.o darr.o
  		
  			echo Linking default luaw driver package %2...
  			%GCC% %attrib% %dirs% -shared -o lc%2.dll ldata.o jitsupport.o darr.o %dlldir%\%2.dll
  		)
  		
  		
  		REM Strip luaw driver if not debug
  		echo Stripping...
  		IF %debug% EQU 0 (
  			strip --strip-all luaw.exe
  		)
  		
  		REM Migrate binaries
  		echo Migrating binaries...
  		move /Y *.dll		%root%
  		move /Y *.o			%objdir%
  		move /Y *.a			%libdir%
  		move /Y *.exe		%root%
  		copy /Y %resdir%\*	%root%\res
  		copy /Y %dlldir%\*	%root%
  		copy /Y %rootdir%\*	%root%
  		
  		echo Finished.
  		exit /b 0
  
negative.code: 	echo An error has occured!
  	pause
  	exit /b 1
  
  :end
  