
@echo off

set PROJECT=PLL
set INCLUDE_DIR=PLL\I;..\xharbour\include;..\bcc5\include
set WORK_OBJ_DIR=PLL\o\h
set DEBUG_OBJ_DIR=PLL\o\hb
set WORK_LIB=LIB\pll32.lib
set DEBUG_LIB=LIB\pll32b.lib
set HFLAGS=-n -a -w  -dCDX 
set HFLAGS1=-n -w -dCDX 


set CFLAGS=-c -O2 -tW -tWM -d -a8 -OS -5 -6

if A%1==A goto WORK
if %1==r goto  REBUILD
if %1==R goto  REBUILD
if %1==b goto  DEBUG
if %1==B goto  DEBUG
if %1==RB goto REBUILDDEBUG
if %1==BR goto REBUILDDEBUG
if %1==rb goto REBUILDDEBUG
if %1==br goto REBUILDDEBUG
if %1==d goto DEMO
if %1==D goto DEMO

@echo Параметры командной строки:
@echo r - пересборка без отладки LIB\PLL32.LIB
@echo b - сборка с отладкой LIB\PLL32B.LIB
@echo rb - пересборка с отладкой LIB\PLL32B.LIB
@echo без параметра - сборка без отладки LIB\PLL32.LIB


goto EXIT
:DEMO
set CFLAGS=-c -O2 -tW -tWM -d -a8 -OS -5 -6 -DHB_NO_TRACE -DHB_NO_PROFILE
set OBJ_DIR=%WORK_OBJ_DIR%D
set LIB_NAME=LIB\pll32D.lib
set HFLAGS=%HFLAGS% -l -dDEMO -p
set HFLAGS1=%HFLAGS1% -l -dDEMO -p
..\bcc5\bin\make -fh%PROJECT%.bc > h%PROJECT%.log
if ERRORLEVEL 1 goto ERR
goto M

:WORK
set CFLAGS=-c -O2 -tW -tWM -d -a8 -OS -5 -6 -DHB_NO_TRACE -DHB_NO_PROFILE
set OBJ_DIR=%WORK_OBJ_DIR%
set LIB_NAME=%WORK_LIB%
..\bcc5\bin\make -fh%PROJECT%.bc > h%PROJECT%.log
if ERRORLEVEL 1 goto ERR
goto M


:REBUILD
set CFLAGS=-c -O2 -tW -tWM -d -a8 -OS -5 -6 -DHB_NO_TRACE -DHB_NO_PROFILE
set OBJ_DIR=%WORK_OBJ_DIR%
set LIB_NAME=%WORK_LIB%
del %LIB_NAME%
..\bcc5\bin\make -fh%PROJECT%.bc -B > h%PROJECT%.log
if ERRORLEVEL 1 goto ERR
goto M

:DEBUG
set OBJ_DIR=%DEBUG_OBJ_DIR%
set LIB_NAME=%DEBUG_LIB%
set HFLAGS=%HFLAGS% -b -d_DEBUG -p 
set HFLAGS1=%HFLAGS1% -b -d_DEBUG -p
..\bcc5\bin\make -fh%PROJECT%.bc > h%PROJECT%.log
if ERRORLEVEL 1 goto ERR
goto M

:REBUILDDEBUG
set OBJ_DIR=%DEBUG_OBJ_DIR%
set LIB_NAME=%DEBUG_LIB%
set HFLAGS=%HFLAGS% -b -d_DEBUG -p 
set HFLAGS1=%HFLAGS1% -b -d_DEBUG -p
del %LIB_NAME%
..\bcc5\bin\make -fh%PROJECT%.bc -B > h%PROJECT%.log
if ERRORLEVEL 1 goto ERR
goto M

:ERR
echo *** Ошибки см. в h%PROJECT%.log ***
if (%2)==() goto  EXIT
START NOTEPAD.exe h%PROJECT%.log
goto EXIT
:M
if exist h%PROJECT%.log del h%PROJECT%.log

:EXIT
