>From 85235aa251690b682c62c3166d7510e98ae0ff3c Mon Sep 17 00:00:00 2001 From: Jannick Date: Tue, 5 Nov 2019 16:52:16 +0100 Subject: [PATCH 03/13] Windows build: add optional cmd line flag --exe-name to build_w32.bat This commit helps the user choose a name for the GNUMake executable different from the default 'gnumake.exe' used at link time. More on dynamic objects: https://www.gnu.org/software/make/manual/make.html#Loading-Objects. Sample calls: - build_w32.bat --exe-name mingw32-make gcc - build_w32.bat --exe-name msvc-make * build_w32.bat: - add optional flag --exe-name requiring an argument specifying the executable name without extension '.exe'. Default is 'gnumake' still. - when linking with GCC, create import library named after exe name of the form 'lib-1.dll.a'. - add new flag to usage screen. --- build_w32.bat | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/build_w32.bat b/build_w32.bat index b166ec1..41a0b4e 100755 --- a/build_w32.bat +++ b/build_w32.bat @@ -47,6 +47,7 @@ if exist maintMakefile ( :ParseSW if "%~1" == "--debug" goto SetDebug +if "%~1" == "--exe-name" goto SetExeName if "%~1" == "--without-guile" goto NoGuile if "%~1" == "--x86" goto Set32Bit if "%~1" == "gcc" goto SetCC @@ -59,6 +60,17 @@ echo - Building without compiler optimizations shift goto ParseSW +:SetExeName +shift +set TMP=%~1 +if "%TMP%" == "" call :ErrorExit "Required command line argument after flag '--exe-name' missing." +if not "%TMP:.exe=%" == "%TMP%" if "%TMP:~-4%" == ".exe" call :ErrorExit "Executable name '%TMP%' should be WITHOUT extension '.exe'." +set MAKE=%TMP% +set "TMP=" +echo - Setting executable name to '%MAKE%' +shift +goto ParseSW + :NoGuile set GUILE=N echo - Building without Guile @@ -306,7 +318,7 @@ goto :EOF :: GCC Link echo on echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc -%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a +%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/lib%MAKE%-1.dll.a @echo off goto :EOF @@ -385,10 +397,11 @@ goto :EOF :Usage echo Usage: %0 [options] [gcc] echo Options: -echo. --without-guile Do not compile Guile support even if found -echo. --debug Make a Debug build--default is Release -echo. --x86 Make a 32bit binary--default is 64bit -echo. --help Display these instructions and exit +echo. --exe-name ^ Set executable name (without extension '.exe')--default is '%MAKE%' +echo. --without-guile Do not compile Guile support even if found +echo. --debug Make a Debug build--default is Release +echo. --x86 Make a 32bit binary--default is 64bit +echo. --help Display these instructions and exit goto :EOF :Reset -- 2.24.0.windows.1