aboutsummaryrefslogtreecommitdiff
path: root/win32/build-tcc.bat
diff options
context:
space:
mode:
authorgrischka <grischka>2017-10-11 18:13:43 +0200
committergrischka <grischka>2017-10-11 18:13:43 +0200
commitda8c62f75d893449e232944fc62566c020b4d010 (patch)
tree977fec8d53d90ceb8c718f07f47c2bc9cbd6edfc /win32/build-tcc.bat
parentfaa9744f5d13c94c7298bf08e8d1eedca5db88a9 (diff)
downloadtinycc-da8c62f75d893449e232944fc62566c020b4d010.tar.gz
tinycc-da8c62f75d893449e232944fc62566c020b4d010.tar.bz2
various stuff
win32/Makefile ("for cygwin") removed - On cygwin, the normal ./configure && make can be used with either cygwin's "GCC for Win32 Toolchain" ./configure --cross-prefix=i686-w64-mingw32- or with an existing tcc: ./configure --cc=<old-tccdir>/tcc.exe tcctest.c: - exclude test_high_clobbers() on _WIN64 (does not work) tests2/95_bitfield.c: - use 'signed char' for ARM (where default 'char' is unsigned) tests: - remove -I "expr" diff option to allow tests with busybox-diff. libtcc.c, tcc.c: - removed -iwithprefix option. It is supposed to be combined with -iprefix which we don't have either. tccgen.c: - fix assignments and return of 'void', as in void f() { void *p, *q; *p = *q: return *p; } This appears to be allowed but should do nothing. tcc.h, libtcc.c, tccpp.c: - Revert "Introduce VIP sysinclude paths which are always searched first" This reverts commit 1d5e386b0a78393ac6b670c209a185849ec798a1. The patch was giving tcc's system includes priority over -I which is not how it should be. tccelf.c: - add DT_TEXTREL tag only if text relocations are actually used (which is likely not the case on x86_64) - prepare_dynamic_rel(): avoid relocation of unresolved (weak) symbols tccrun.c: - for HAVE_SELINUX, use two mappings to the same (real) file. (it was so once except the RX mapping wasn't used at all). tccpe.c: - fix relocation constant used for x86_64 (by Andrei E. Warentin) - #ifndef _WIN32 do "chmod 755 ..." to get runnable exes on cygwin. tccasm.c: - keep forward asm labels static, otherwise they will endup in dynsym eventually. configure, Makefile: - mingw32: respect ./configure options --bindir --docdir --libdir - allow overriding tcc when building libtcc1.a and libtcc.def with make XTCC=<tcc program to use> - use $(wildcard ...) for install to allow installing just a cross compiler for example make cross-arm make install - use name <target>-libtcc1.a build-tcc.bat: - add options: -clean, -b bindir
Diffstat (limited to 'win32/build-tcc.bat')
-rw-r--r--win32/build-tcc.bat105
1 files changed, 58 insertions, 47 deletions
diff --git a/win32/build-tcc.bat b/win32/build-tcc.bat
index 3c3a726..ceb4411 100644
--- a/win32/build-tcc.bat
+++ b/win32/build-tcc.bat
@@ -4,13 +4,31 @@
@echo off
setlocal
-
-set CC=gcc -Os -s -static
+if (%1)==(-clean) goto :cleanup
+set CC=gcc
set /p VERSION= < ..\VERSION
set INST=
+set BIN=
set DOC=no
+set EXES_ONLY=no
goto :a0
-
+:a2
+shift
+:a3
+shift
+:a0
+if not (%1)==(-c) goto :a1
+set CC=%~2
+if (%2)==(cl) set CC=@call :cl
+goto :a2
+:a1
+if (%1)==(-t) set T=%2&& goto :a2
+if (%1)==(-v) set VERSION=%~2&& goto :a2
+if (%1)==(-i) set INST=%2&& goto :a2
+if (%1)==(-b) set BIN=%2&& goto :a2
+if (%1)==(-d) set DOC=yes&& goto :a3
+if (%1)==(-x) set EXES_ONLY=yes&& goto :a3
+if (%1)==() goto :p1
:usage
echo usage: build-tcc.bat [ options ... ]
echo options:
@@ -18,10 +36,35 @@ echo -c prog use prog (gcc/tcc/cl) to compile tcc
echo -c "prog options" use prog with options to compile tcc
echo -t 32/64 force 32/64 bit default target
echo -v "version" set tcc version
-echo -i dir install tcc into dir
+echo -i tccdir install tcc into tccdir
+echo -b bindir optionally install binaries into bindir elsewhere
echo -d create tcc-doc.html too (needs makeinfo)
+echo -x just create the executables
+echo -clean delete all previously produced files and directories
exit /B 1
+@rem ------------------------------------------------------
+@rem sub-routines
+
+:cleanup
+set LOG=echo
+%LOG% removing files:
+for %%f in (*tcc.exe libtcc.dll lib\*.a) do call :del_file %%f
+for %%f in (..\config.h ..\config.texi) do call :del_file %%f
+for %%f in (include\*.h) do @if exist ..\%%f call :del_file %%f
+for %%f in (include\tcclib.h examples\libtcc_test.c) do call :del_file %%f
+for %%f in (*.o *.obj *.def *.pdb *.lib *.exp *.ilk) do call :del_file %%f
+%LOG% removing directories:
+for %%f in (doc libtcc) do call :del_dir %%f
+%LOG% done.
+exit /B 0
+:del_file
+if exist %1 del %1 && %LOG% %1
+exit /B 0
+:del_dir
+if exist %1 rmdir /Q/S %1 && %LOG% %1
+exit /B 0
+
:cl
@echo off
set CMD=cl
@@ -37,52 +80,16 @@ echo on
%CMD% -O1 -W2 -Zi -MT -GS- -nologo -link -opt:ref,icf
@exit /B %ERRORLEVEL%
-:a2
-shift
-:a1
-shift
-:a0
-if not (%1)==(-c) goto :a3
-set CC=%~2
-if (%2)==(cl) set CC=@call :cl
-goto :a2
-:a3
-if not (%1)==(-t) goto :a4
-set T=%2
-goto :a2
-:a4
-if not (%1)==(-v) goto :a5
-set VERSION=%~2
-goto :a2
-:a5
-if not (%1)==(-i) goto :a6
-set INST=%2
-goto :a2
-:a6
-if not (%1)==(-d) goto :a7
-set DOC=yes
-goto :a1
-:a7
-if not (%1)==() goto :usage
+@rem ------------------------------------------------------
+@rem main program
-if not "%CC%"=="@call :cl" goto :p1
-set VSCOMNTOOLS=%VS150COMNTOOLS%
-if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS140COMNTOOLS%
-if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS130COMNTOOLS%
-if "%VSCOMNTOOLS%"=="" set VSCOMNTOOLS=%VS120COMNTOOLS%
-if %T%_==32_ set CLVARS="%VSCOMNTOOLS%..\..\VC\bin\vcvars32.bat"
-if %T%_==64_ set CLVARS="%VSCOMNTOOLS%..\..\VC\bin\amd64\vcvars64.bat"
-if %T%_==_ set T=32& if %Platform%_==X64_ set T=64
-if %CLVARS%_==_ goto :p1
-if exist %CLVARS% call %CLVARS%
:p1
-
if not %T%_==_ goto :p2
set T=32
if %PROCESSOR_ARCHITECTURE%_==AMD64_ set T=64
if %PROCESSOR_ARCHITEW6432%_==AMD64_ set T=64
:p2
-
+if "%CC:~-3%"=="gcc" set CC=%CC% -Os -s -static
set D32=-DTCC_TARGET_PE -DTCC_TARGET_I386
set D64=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
set P32=i386-win32
@@ -91,13 +98,14 @@ if %T%==64 goto :t64
set D=%D32%
set DX=%D64%
set PX=%P64%
-goto :t96
+goto :p3
:t64
set D=%D64%
set DX=%D32%
set PX=%P32%
-:t96
+goto :p3
+:p3
@echo on
:config.h
@@ -116,7 +124,7 @@ for %%f in (*tcc.exe *tcc.dll) do @del %%f
%CC% -o tcc.exe ..\tcc.c libtcc.dll %D% -DONE_SOURCE"=0"
%CC% -o %PX%-tcc.exe ..\tcc.c %DX%
-@if (%TCC_FILES%)==(no) goto :files-done
+@if (%EXES_ONLY%)==(yes) goto :files-done
if not exist libtcc mkdir libtcc
if not exist doc mkdir doc
@@ -170,8 +178,11 @@ for %%f in (*.o *.def) do @del %%f
:copy-install
@if (%INST%)==() goto :the_end
if not exist %INST% mkdir %INST%
+@if (%BIN%)==() set BIN=%INST%
+if not exist %BIN% mkdir %BIN%
+for %%f in (*tcc.exe *tcc.dll) do @copy>nul %%f %BIN%\%%f
@if not exist %INST%\lib mkdir %INST%\lib
-for %%f in (*tcc.exe *tcc.dll lib\*.a lib\*.def) do @copy>nul %%f %INST%\%%f
+for %%f in (lib\*.a lib\*.def) do @copy>nul %%f %INST%\%%f
for %%f in (include examples libtcc doc) do @xcopy>nul /s/i/q/y %%f %INST%\%%f
:the_end