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
+call %COMPILER% >nul 2>&1\r
if not ERRORLEVEL 1 goto FoundMSVC\r
\r
:: Visual Studio 17 and above provides the "vswhere" tool\r
:: Show the compiler version that we found\r
:: Unfortunately this also shows a "usage" note; I can't find anything better.\r
echo.\r
-%COMPILER%\r
+call %COMPILER%\r
goto Build\r
\r
:FindGcc\r
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"\r
:: Show the compiler version that we found\r
echo.\r
-%COMPILER% --version\r
+call %COMPILER% --version\r
if not ERRORLEVEL 1 goto Build\r
echo No %COMPILER% found.\r
exit 1\r
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"\r
:: Show the compiler version that we found\r
echo.\r
-%COMPILER% -v\r
+call %COMPILER% -v\r
if not ERRORLEVEL 1 goto Build\r
echo No %COMPILER% found.\r
exit 1\r
\r
:: MSVC Compile\r
echo on\r
-%COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c\r
+call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c\r
@echo off\r
goto CompileDone\r
\r
:GccCompile\r
:: GCC Compile\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
+call %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
+call %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
:: 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 on\r
-link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc\r
+call link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc\r
@echo off\r
goto :EOF\r
\r
:: GCC Link\r
echo on\r
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc\r
-%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a\r
+call %COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a\r
@echo off\r
goto :EOF\r
\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
+call %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
+call sed -n "s/^AC_INIT(\[GNU make\],\[\([^]]\+\)\].*/s,%%VERSION%%,\1,g/p" configure.ac > %OUTDIR%\src\config.h.W32.sed\r
echo s,%%PACKAGE%%,make,g >> %OUTDIR%\src\config.h.W32.sed\r
-sed -f %OUTDIR%\src\config.h.W32.sed src\config.h.W32.template > src\config.h.W32\r
+call sed -f %OUTDIR%\src\config.h.W32.sed src\config.h.W32.template > src\config.h.W32\r
echo static const char *const GUILE_module_defn = ^" \ > src\gmk-default.h\r
-sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\\/" src\gmk-default.scm >> src\gmk-default.h\r
+call sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\\/" src\gmk-default.scm >> src\gmk-default.h\r
echo ^";>> src\gmk-default.h\r
goto :EOF\r
\r
:ChkGuile\r
:: Build with Guile is supported only on NT and later versions\r
if not "%OS%" == "Windows_NT" goto NoGuile\r
-pkg-config --help > %OUTDIR%\guile.tmp 2> NUL\r
+call pkg-config --help > %OUTDIR%\guile.tmp 2> NUL\r
if ERRORLEVEL 1 goto NoPkgCfg\r
\r
-echo Checking for Guile 2.0\r
+set PKGMSC=\r
if not "%COMPILER%" == "gcc" set PKGMSC=--msvc-syntax\r
-pkg-config --cflags --short-errors "guile-2.0" > %OUTDIR%\guile.tmp\r
-if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\guile.tmp\r
\r
-pkg-config --libs --static --short-errors %PKGMSC% "guile-2.0" > %OUTDIR%\guile.tmp\r
-if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\guile.tmp\r
+echo Checking for Guile 2.0\r
+call pkg-config --cflags --short-errors "guile-2.0" > %OUTDIR%\gl-c2.tmp 2> NUL\r
+if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\gl-c2.tmp\r
+\r
+call pkg-config --libs --static --short-errors %PKGMSC% "guile-2.0" > %OUTDIR%\gl-l2.tmp 2> NUL\r
+if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\gl-l2.tmp\r
\r
if not "%GUILECFLAGS%" == "" goto GuileDone\r
\r
echo Checking for Guile 1.8\r
-pkg-config --cflags --short-errors "guile-1.8" > %OUTDIR%\guile.tmp\r
-if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\guile.tmp\r
+call pkg-config --cflags --short-errors "guile-1.8" > %OUTDIR%\gl-c18.tmp 2> NUL\r
+if not ERRORLEVEL 1 set /P GUILECFLAGS= < %OUTDIR%\gl-c18.tmp\r
\r
-pkg-config --libs --static --short-errors %PKGMSC% "guile-1.8" > %OUTDIR%\guile.tmp\r
-if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\guile.tmp\r
+call pkg-config --libs --static --short-errors %PKGMSC% "guile-1.8" > %OUTDIR%\gl-l18.tmp 2> NUL\r
+if not ERRORLEVEL 1 set /P GUILELIBS= < %OUTDIR%\gl-l18.tmp\r
\r
if not "%GUILECFLAGS%" == "" goto GuileDone\r
\r
\r
:FindVswhere\r
set VSWHERE=vswhere\r
-"%VSWHERE%" -help >nul 2>&1\r
+call "%VSWHERE%" -help >nul 2>&1\r
if not ERRORLEVEL 1 exit /b 0\r
set "VSWHERE=C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere"\r
-"%VSWHERE%" -help >nul 2>&1\r
+call "%VSWHERE%" -help >nul 2>&1\r
if ERRORLEVEL 1 exit /b 1\r
goto :EOF\r
\r
if not exist "%VSVARS%" exit /b 1\r
call "%VSVARS%" %ARCH%\r
if ERRORLEVEL 1 exit /b 1\r
-%COMPILER% >nul 2>&1\r
+call %COMPILER% >nul 2>&1\r
if ERRORLEVEL 1 exit /b 1\r
goto :EOF\r
\r