2
2
:: Compiles Lua
3
3
::
4
4
5
- @ REM Move down into src
5
+ ::
6
+ :: Set up environment
7
+ ::
8
+
9
+ :: Start local variable scope
10
+ @ SETLOCAL
11
+
12
+ :: Locate 'vcvarsall.bat'
13
+ @ IF NOT " %VS120COMNTOOLS% " == " " @ SET VSVARSALL = %VS120COMNTOOLS% ..\..\VC\vcvarsall.bat
14
+ @ IF NOT " %VS140COMNTOOLS% " == " " @ SET VSVARSALL = %VS140COMNTOOLS% ..\..\VC\vcvarsall.bat
15
+ @ IF " %VSVARSALL% " == " " @ GOTO ENDSETUP
16
+
17
+ :: Identify the target architecture
18
+ @ IF NOT " %PROCESSOR_ARCHITECTURE% " == " " (
19
+ @ IF " %PROCESSOR_ARCHITECTURE% " == " x86" @ SET ARCH = x86
20
+ @ IF " %PROCESSOR_ARCHITECTURE% " == " AMD64" @ SET ARCH = amd64
21
+ )
22
+ @ IF " %ARCH% " == " " @ GOTO ENDSCRIPT
23
+
24
+ :: Call the setup script
25
+ @ CALL " %VSVARSALL% " %ARCH%
26
+ @ ECHO ON
27
+
28
+ :ENDSETUP
29
+
30
+ ::
31
+ :: Process files
32
+ ::
33
+
34
+ :: Move down into 'src'
6
35
@ PUSHD src
7
36
8
- @ REM Clean up files from previous builds
9
- @ DEL *.obj *.o *.dll *.exe
37
+ :: Clean up files from previous builds
38
+ @ IF EXIST *.o @ DEL *.o
39
+ @ IF EXIST *.obj @ DEL *.obj
40
+ @ IF EXIST *.dll @ DEL *.dll
41
+ @ IF EXIST *.exe @ DEL *.exe
10
42
11
- @ REM Compile all .c files into .obj
43
+ :: Compile all .c files into .obj
12
44
@ CL /MD /O2 /c /DLUA_BUILD_AS_DLL *.c
13
45
14
- @ REM Rename two special files
46
+ :: Rename two special files
15
47
@ REN lua.obj lua.o
16
48
@ REN luac.obj luac.o
17
49
18
- @ REM Link up all the other .objs into a .lib and .dll file
50
+ :: Link up all the other .objs into a .lib and .dll file
19
51
@ LINK /DLL /IMPLIB:lua.lib /OUT:lua.dll *.obj
20
52
21
- @ REM Link lua into an .exe
53
+ :: Link lua into an .exe
22
54
@ LINK /OUT:lua.exe lua.o lua.lib
23
55
24
- @ REM Create a static .lib
56
+ :: Create a static .lib
25
57
@ LIB /OUT:lua-static.lib *.obj
26
58
27
- @ REM Link luac into an .exe
59
+ :: Link luac into an .exe
28
60
@ LINK /OUT:luac.exe luac.o lua-static.lib
29
61
62
+ :: Move back up out of 'src'
30
63
@ POPD
31
64
32
- @ REM Copy the library and executable files out from 'src'
65
+ :: Copy the library and executable files out from 'src'
33
66
@ COPY /Y src\lua.exe lua.exe
34
67
@ COPY /Y src\luac.exe luac.exe
35
- @ COPY /Y src\lua.dll lua.dll
68
+ @ COPY /Y src\lua.dll lua.dll
69
+
70
+ :ENDSCRIPT
71
+
72
+ :: End local variable scope
73
+ @ ENDLOCAL
0 commit comments