set O=obj\r
set ARCH=x64\r
set DEBUG=N\r
+set DIRENT=Y\r
\r
if exist maintMakefile (\r
set MAINT=Y\r
if "%1" == "--without-guile" goto NoGuile\r
if "%1" == "--x86" goto Set32Bit\r
if "%1" == "gcc" goto SetCC\r
+if "%1" == "tcc" goto SetTCC\r
if "%1" == "" goto DoneSW\r
goto Usage\r
\r
shift\r
goto ParseSW\r
\r
+:SetTCC\r
+set COMPILER=tcc\r
+set O=o\r
+echo - Building with TinyC\r
+shift\r
+goto ParseSW\r
+\r
:DoneSW\r
if "%MAINT%" == "Y" echo - Enabling maintainer mode\r
\r
if "%COMPILER%" == "gcc" goto FindGcc\r
+if "%COMPILER%" == "tcc" goto FindTcc\r
\r
:: Find a compiler. Visual Studio requires a lot of effort to locate :-/.\r
%COMPILER% >nul 2>&1\r
set OUTDIR=.\GccRel\r
set LNKOUT=./GccRel\r
set OPTS=-O2\r
+set DIRENT=N\r
if "%DEBUG%" == "Y" set OPTS=-O0\r
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug\r
if "%DEBUG%" == "Y" set LNKOUT=./GccDebug\r
echo No %COMPILER% found.\r
exit 1\r
\r
+:FindTcc\r
+set OUTDIR=.\TccRel\r
+set LNKOUT=./TccRel\r
+set OPTS=-O2\r
+if "%DEBUG%" == "Y" set OPTS=-O0\r
+if "%DEBUG%" == "Y" set OUTDIR=.\TccDebug\r
+if "%DEBUG%" == "Y" set LNKOUT=./TccDebug\r
+if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"\r
+:: Show the compiler version that we found\r
+echo.\r
+%COMPILER% -v\r
+if not ERRORLEVEL 1 goto Build\r
+echo No %COMPILER% found.\r
+exit 1\r
+\r
:Build\r
:: Clean the directory if it exists\r
if exist %OUTDIR%\nul rmdir /S /Q %OUTDIR%\r
call :Compile lib/glob\r
call :Compile lib/getloadavg\r
\r
-if not "%COMPILER%" == "gcc" call :Compile src\w32\compat\dirent\r
+:: Compile dirent unless it is supported by compiler library (like with gcc).\r
+if "%DIRENT%" == "Y" call :Compile src\w32\compat\dirent\r
\r
call :Link\r
\r
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"\r
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"\r
if "%COMPILER%" == "gcc" goto GccCompile\r
+if "%COMPILER%" == "tcc" goto TccCompile\r
\r
:: MSVC Compile\r
echo on\r
echo on\r
%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c\r
@echo off\r
+goto CompileDone\r
+\r
+:TccCompile\r
+:: TCC Compile\r
+echo on\r
+%COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c\r
+@echo off\r
+goto CompileDone\r
\r
:CompileDone\r
if not exist "%OUTDIR%\%1.%O%" exit 1\r
echo.\r
echo Linking %LNKOUT%/%MAKE%.exe\r
if "%COMPILER%" == "gcc" goto GccLink\r
+if "%COMPILER%" == "tcc" goto TccLink\r
\r
:: MSVC Link\r
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib >>%OUTDIR%\link.sc\r
@echo off\r
goto :EOF\r
\r
+:TccLink\r
+:: TCC Link\r
+echo on\r
+echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc\r
+%COMPILER% -mthreads %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc \r
+@echo off\r
+goto :EOF\r
+\r
:ConfigSCM\r
echo Generating config from SCM templates\r
sed -n "s/^AC_INIT(\[GNU make\],\[\([^]]\+\)\].*/s,%%VERSION%%,\1,g/p" configure.ac > %OUTDIR%\src\config.h.W32.sed\r
goto :EOF\r
\r
:Usage\r
-echo Usage: %0 [options] [gcc]\r
+echo Usage: %0 [options] [gcc] OR [tcc]\r
echo Options:\r
echo. --without-guile Do not compile Guile support even if found\r
echo. --debug Make a Debug build--default is Release\r
echo. --x86 Make a 32bit binary--default is 64bit\r
echo. --help Display these instructions and exit\r
+echo.\r
+echo. "gcc" means compile with GCC, "tcc" means compile with Tiny C's TCC\r
goto :EOF\r
\r
:Reset\r
/* Define to 1 if you have the <direct.h> header file, and it defines getcwd()
and chdir().
*/
-#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__INTERIX)
+#if (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__TINYC__)) && !defined(__INTERIX)
# define HAVE_DIRECT_H 1
#endif
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the 'strcasecmp' function. */
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(__TINYC__)
#define HAVE_STRCASECMP 1
#endif
#define HAVE_STRING_H 1
/* Define to 1 if you have the 'strncasecmp' function. */
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(__TINYC__)
#define HAVE_STRNCASECMP 1
#endif
char *ttyname (int);
/* Define to 1 if you have the `umask' function. */
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(__TINYC__)
# define HAVE_UMASK 1
#endif
/*
* If you have a shell that does not grok 'sh -c quoted-command-line'
- * correctly, you need this setting. Please see below for specific
- * shell support.
+ * correctly, you need this setting; it is the default for tcc.
+ * Please see below for specific shell support.
*/
+#if defined(__TINYC__)
+#define BATCH_MODE_ONLY_SHELL 1
+#else
/*#define BATCH_MODE_ONLY_SHELL 1 */
+#endif
/*
* Define if you have the Cygnus "Cygwin" GNU Windows32 tool set.