@echo off
if not x%1 == xs goto errM
: MS's COMMAND does not accepts '=' signs in the string
..\..\bin\_xset __CFLAGS  -flop _MICROC_=1 NDEBUG=1
set __ASMFLAGS= /ML /DNDEBUG

if exist errlist ..\..\bin\_xset __CFLAGS %__CFLAGS% e=errlist

..\..\bin\rm -sf *.obj errlist compile.tmp

call mkdynsrc.bat

cc foreach.xc -fop _MICROC_=1 NDEBUG=1
if errorlevel 1 goto ende
if not exist foreach.com goto err1

type compile.ccc >compile.tmp
type dyn_src >>compile.tmp
.\foreach /e:c compile.tmp cc %%name: %__CFLAGS%
.\foreach /e:asm compile.tmp asm %__ASMFLAGS% %%name:;
if exist errlist copy errlist errlist._s >nul

if exist suppl_s.lib del suppl_s.lib >nul
..\..\bin\LIB suppl_s.lib /SCW +- .\*.obj , suppl_s.lst
if not errorlevel 1 copy suppl_s.* suppl_t.* >nul

..\..\bin\rm -sf *.obj compile.tmp
goto ende

:err1
echo Failed to make FOREACH.COM (from FOREACH.XC)
goto ende

:errM
echo Script to compile the supplemental library with Micro C v3.14
echo Useage: %0 s

:ende
set __CFLAGS=
set __ASMFLAGS=
