Metropoli BBS
VIEWER: qlink.bat MODE: TEXT (ASCII)
@echo off
if "%1"=="" goto usage
if exist *.tmp del *.tmp

rem System
set Qx=pmodew
rem Math LIBs
set Qm=math_bc.lib
rem Compress?
set Qc=n
rem EXE Filename
set Qf=
rem Generate MAP file?
set Qp=n

REM if there are repeated options then the last one is used
:loop1
if "%1"=="/d" goto shift1
if "%1"=="/wx" goto shift1
if "%1"=="/p" goto shift1
if "%1"=="/w" goto shift1
if "%1"=="/b" goto shift1
if "%1"=="/c" goto shift1
if "%1"=="/m" goto shift1
goto cont

:shift1
if "%1"=="/d" set Qx=dos4g
if "%1"=="/wx" set Qx=wdosx
if "%1"=="/p" set Qx=pmodew
if "%1"=="/w" set Qm=math_wc.lib
if "%1"=="/b" set Qm=math_bc.lib
if "%1"=="/c" set Qc=y
if "%1"=="/m" set Qp=y
shift
goto loop1

:cont

set Qf=%1
if exist %Qf%.exe del %Qf%.exe
shift
if "%1"=="" goto usage
rem Must overcome 128 byte command line limit
type %qlib%\bin\qlib.lnk >tmp.tmp
echo system %Qx% >>tmp.tmp
echo libpath .;%qlib%\lib >>tmp.tmp
echo path .;%qlib%\lib >>tmp.tmp
echo name %Qf%.exe >>tmp.tmp
echo file %qlib%\lib\c0.obj >>tmp.tmp
echo file %qlib%\lib\qlib.lib >>tmp.tmp
echo file %qlib%\lib\%Qm% >>tmp.tmp
if "%Qp%" == "y" echo option map=%Qf%.map>>tmp.tmp

:loop2
echo file %1 >>tmp.tmp
shift
if "%1"=="" goto done
goto loop2

:done
wlink @tmp.tmp

if not exist %Qf%.exe goto error
echo.
echo Complete!
del *.tmp

rem This will execute %1.set as a BAT file
rem Place PMWSETUP and QSETUP in %1.set to setup custom settings
rem This is the PRE stage
if not exist %Qf%.set goto compress
copy %Qf%.set qlib_tmp.bat
call qlib_tmp PRE
del qlib_tmp.bat

:compress
rem This will compress EXE if Qc==y and system==pmodew
if not "%Qx%"=="pmodew" goto cont2
if not "%Qc%"=="y" goto cont2
call QLITE %Qf%

:cont2
rem This is the POST stage
if not exist %Qf%.set goto setup
copy %Qf%.set qlib_tmp.bat
call qlib_tmp POST
del qlib_tmp.bat
goto end

:setup
rem If .SET file does not exist just do standard setup
rem Remove logo display
if not "%Qx%"=="pmodew" goto end
pmwsetup /B0 %Qf%.exe
goto end

:usage
echo Usage : QLINK [options] name file(s)...
echo   name = filename for EXE to be created (do not give .EXE extension)
echo   file(s) = files to linked together (full filenames)  [OBJs and LIBs]
echo   DOS Extender options:
echo    /p = use PMODE/W DOS extender (default)
echo    /d = use DOS/4GW DOS extender
echo    /wx = use WDOSX DOS extender
echo   Math LIBs options:
echo    /b = use Borland/VisC Math LIBs (default)
echo    /w = use Watcom Math LIBs
echo   Other options:
echo    /c = use PMWLITE to compress EXE
echo    /m = generate map file (*.map)
echo.
goto end

:error
echo.
echo Error occured!

:end
set Qx=
set Qf=
set Qm=
set Qc=

[ RETURN TO DIRECTORY ]