History

win32: build-tcc.bat: figure out correct bitness of cl.exe

Vlad Vissoultchev committed 9 years ago

Commit 67fe3711 parent 5550e431 file · +21 −6Browse files

Unified · Split

win32/build-tcc.bat+21−6
@@ -3,12 +3,13 @@ · 2 unmodified lines
33 @rem ------------------------------------------------------
44
55 @echo off
6+setlocal
67
8+set VSCOMNTOOLS=%VS150COMNTOOLS%
9+if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS140COMNTOOLS%
10+if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS130COMNTOOLS%
11+if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS120COMNTOOLS%
712 set CC=gcc -Os -s
8−
9−set T=32
10−if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
11−if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
1213 set /p VERSION= < ..\VERSION
1314 set INST=
1415 set DOC=no
@@ -68,6 +69,17 @@ goto :a1 · 53 unmodified lines
6869 :a7
6970 if not (%1)==() goto :usage
7071
72+if not "%CC%"=="@call :cl" goto :p1
73+if %T%_==32_ set CLVARS="%VSCOMNTOOLS%..\..\VC\bin\vcvars32.bat"
74+if %T%_==64_ set CLVARS="%VSCOMNTOOLS%..\..\VC\bin\amd64\vcvars64.bat"
75+if %T%_==_ set T=32& if %Platform%_==X64_ set T=64
76+:p1
77+if not %T%_==_ goto :p2
78+set T=32
79+if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
80+if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
81+:p2
82+
7183 set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
7284 set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
7385 if %T%==64 goto :t64
@@ -85,6 +97,9 @@ set PX=i386-win32 · 11 unmodified lines
8597
8698 @echo on
8799
100+@if %CLVARS%_==_ goto :config.h
101+call %CLVARS%
102+
88103 :config.h
89104 echo>..\config.h #define TCC_VERSION "%VERSION%"
90105 echo>> ..\config.h #ifdef TCC_TARGET_X86_64
@@ -93,7 +108,7 @@ echo>> ..\config.h #else · 2 unmodified lines
93108 echo>> ..\config.h #define CONFIG_TCC_LIBPATHS "{B}/lib/32;{B}/lib"
94109 echo>> ..\config.h #endif
95110
96−for %%f in (*tcc.exe tiny_*.exe *tcc.dll) do @del %%f
111+@del /q *tcc.exe tiny_*.exe *tcc.dll
97112
98113 :compiler
99114 %CC% -o libtcc.dll -shared ..\libtcc.c %D% -DONE_SOURCE -DLIBTCC_AS_DLL
@@ -153,7 +168,7 @@ cmd /c makeinfo --html --no-split ../tcc-doc.texi -o doc/tcc-doc.html · 53 unmodified lines
153168 :doc-done
154169
155170 :files-done
156−for %%f in (*.o *.def *-m??.exe) do @del %%f
171+@del /q *.o *.def *-m??.exe
157172
158173 :copy-install
159174 @if (%INST%)==() goto :the_end

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t