[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Tinycc-devel] I want to port make on Windows using tcc compiler
From: |
Christian Jullien |
Subject: |
RE: [Tinycc-devel] I want to port make on Windows using tcc compiler |
Date: |
Wed, 22 Jan 2020 20:57:37 +0100 |
Ok here are the patches:
F:\wintcc\make>diff -u config.h.W32.template config.h.W32.new
--- config.h.W32.template 2020-01-22 20:16:49.000000000 +0100
+++ config.h.W32.new 2020-01-22 20:21:05.707350000 +0100
@@ -102,7 +102,7 @@
/* 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
@@ -247,7 +247,7 @@
#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
@@ -273,7 +273,7 @@
#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
@@ -305,7 +305,7 @@
char *ttyname (int);
/* Define to 1 if you have the `umask' function. */
-#ifdef __MINGW32__
+#if defined(__MINGW32__) || defined(__TINYC__)
# define HAVE_UMASK 1
#endif
And
F:\tinycc\win32>diff -u build_w32.bat build_w32.bat.new
--- build_w32.bat 2020-01-22 20:51:47.673891500 +0100
+++ build_w32.bat.new 2020-01-22 16:48:24.087993800 +0100
@@ -37,6 +37,7 @@
set O=obj
set ARCH=x64
set DEBUG=N
+set DIRENT=Y
if exist maintMakefile (
set MAINT=Y
@@ -49,6 +50,7 @@
if "%1" == "--without-guile" goto NoGuile
if "%1" == "--x86" goto Set32Bit
if "%1" == "gcc" goto SetCC
+if "%1" == "tcc" goto SetTCC
if "%1" == "" goto DoneSW
goto Usage
@@ -77,10 +79,18 @@
shift
goto ParseSW
+:SetTCC
+set COMPILER=tcc
+set O=o
+echo - Building with TinyC
+shift
+goto ParseSW
+
:DoneSW
if "%MAINT%" == "Y" echo - Enabling maintainer mode
if "%COMPILER%" == "gcc" goto FindGcc
+if "%COMPILER%" == "tcc" goto FindTcc
:: Find a compiler. Visual Studio requires a lot of effort to locate :-/.
%COMPILER% >nul 2>&1
@@ -172,6 +182,7 @@
set OUTDIR=.\GccRel
set LNKOUT=./GccRel
set OPTS=-O2
+set DIRENT=N
if "%DEBUG%" == "Y" set OPTS=-O0
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug
if "%DEBUG%" == "Y" set LNKOUT=./GccDebug
@@ -183,6 +194,21 @@
echo No %COMPILER% found.
exit 1
+:FindTcc
+set OUTDIR=.\TccRel
+set LNKOUT=./TccRel
+set OPTS=-O2
+if "%DEBUG%" == "Y" set OPTS=-O0
+if "%DEBUG%" == "Y" set OUTDIR=.\TccDebug
+if "%DEBUG%" == "Y" set LNKOUT=./TccDebug
+if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
+:: Show the compiler version that we found
+echo.
+%COMPILER% -v
+if not ERRORLEVEL 1 goto Build
+echo No %COMPILER% found.
+exit 1
+
:Build
:: Clean the directory if it exists
if exist %OUTDIR%\nul rmdir /S /Q %OUTDIR%
@@ -272,6 +298,7 @@
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
if "%COMPILER%" == "gcc" goto GccCompile
+if "%COMPILER%" == "tcc" goto TccCompile
:: MSVC Compile
echo on
@@ -284,6 +311,14 @@
echo on
%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
@echo off
+goto CompileDone
+
+:TccCompile
+:: TCC Compile
+echo on
+%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
+@echo off
+goto CompileDone
:CompileDone
if not exist "%OUTDIR%\%1.%O%" exit 1
@@ -293,6 +328,7 @@
echo.
echo Linking %LNKOUT%/%MAKE%.exe
if "%COMPILER%" == "gcc" goto GccLink
+if "%COMPILER%" == "tcc" goto TccLink
:: MSVC Link
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
@@ -309,6 +345,14 @@
@echo off
goto :EOF
+:TccLink
+:: TCC Link
+echo on
+echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lcomdlg32 -ladvapi32
-lshell32 -lole32 -loleaut32 -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
+%COMPILER% -mthreads %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc
+@echo off
+goto :EOF
+
:ConfigSCM
echo Generating config from SCM templates
sed -n "s/^AC_INIT(\[GNU make\],\[\([^]]\+\)\].*/s,%%VERSION%%,\1,g/p"
configure.ac > %OUTDIR%\src\config.h.W32.sed
@@ -375,7 +419,7 @@
goto :EOF
:Usage
-echo Usage: %0 [options] [gcc]
+echo Usage: %0 [options] [gcc|tcc]
echo Options:
echo. --without-guile Do not compile Guile support even if found
echo. --debug Make a Debug build--default is Release
-----Original Message-----
From: Eli Zaretskii [mailto:address@hidden]
Sent: Wednesday, January 22, 2020 20:34
To: address@hidden
Cc: address@hidden
Subject: Re: [Tinycc-devel] I want to port make on Windows using tcc
compiler
[Please keep the make-w32 list on the CC.]
> From: "Christian Jullien" <address@hidden>
> Date: Wed, 22 Jan 2020 20:23:33 +0100
>
> I see. In this case I need an advice.
>
> As you probably understand now, I want a simple mechanism which allows a
> non-technical user to rebuild gnumake.exe from an official distrib (like
> 4.3) and tcc.exe + cmd.exe (that's all).
> For example, with Visual C++ installed, build_w32.bat works perfectly and
> produces a fully working gnumake.exe (without the need to get mentioned
> template file).
> I want to do exactly the same replacing default cl by tcc.
OK, but what kind of advice do you need? The changes to the template
file, if accepted, will eventually be propagated into config.h.W32 in
the release tarball, and so if you can build the tarball by editing
the config.h.W32 file, you will be able to do the same after the patch
for the template is accepted and installed.
> So, here is the patch to apply to template file:
>
> F:\wintcc\make>diff config.h.W32.new config.h.W32.template
Please use "diff -u" or "diff -c".
> Can you please add it as well as my modified build_w32.bat ?
Please also show the diffs for the batch file.
- RE: [Tinycc-devel] I want to port make on Windows using tcc compiler, Christian Jullien, 2020/01/22
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/22
- Message not available
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/22
- RE: [Tinycc-devel] I want to port make on Windows using tcc compiler,
Christian Jullien <=
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/24
- RE: [Tinycc-devel] I want to port make on Windows using tcc compiler, Christian Jullien, 2020/01/24
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/24
- RE: [Tinycc-devel] I want to port make on Windows using tcc compiler, Christian Jullien, 2020/01/24
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/24
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Paul Smith, 2020/01/24
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/24
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/25
- RE: [Tinycc-devel] I want to port make on Windows using tcc compiler, Christian Jullien, 2020/01/26
- Re: [Tinycc-devel] I want to port make on Windows using tcc compiler, Eli Zaretskii, 2020/01/26