@echo off
if exist stage1\gcc.exe goto stage2

echo ----------------------------------------Building first stage compiler
make CFLAGS=-O LDFLAGS=-s
call mkstage1.bat
call mkclean.bat

:stage2
echo ---------------------------------------Building second stage compiler
make CC="stage1/gcc.exe -Bstage1/" CFLAGS=-O2 LDFLAGS=-s
if not exist gcc.exe copy xgcc.exe gcc.exe
if not exist cpp.exe copy cccp.exe cpp.exe

