# Copied from the Ninja repo

ninja_required_version = 1.3

builddir = build
cxx = g++
ar = ar
cflags = -g -Wall -Wextra -Wno-deprecated -Wno-unused-parameter -fno-rtti $
    -fno-exceptions -pipe -Wno-missing-field-initializers $
    -DNINJA_PYTHON="python.exe" -O2 -DNDEBUG -D_WIN32_WINNT=0x0501
ldflags = -L$builddir -static

rule cxx
  command = $cxx -MMD -MT $out -MF $out.d $cflags -c $in -o $out
  description = CXX $out
  depfile = $out.d
  deps = gcc

rule ar
  command = cmd /c $ar cqs $out.tmp $in && move /Y $out.tmp $out
  description = AR $out

rule link
  command = $cxx $ldflags -o $out $in $libs
  description = LINK $out

# the depfile parser and ninja lexers are generated using re2c.

# Core source files all build into ninja library.
build $builddir\build.o: cxx src\build.cc
build $builddir\build_log.o: cxx src\build_log.cc
build $builddir\clean.o: cxx src\clean.cc

rule doxygen
  command = doxygen $in
  description = DOXYGEN $in
doxygen_mainpage_generator = src\gen_doxygen_mainpage.sh
rule doxygen_mainpage
  command = $doxygen_mainpage_generator $in > $out
  description = DOXYGEN_MAINPAGE $out
build $builddir\doxygen_mainpage: doxygen_mainpage README COPYING | $
    $doxygen_mainpage_generator
build doxygen: doxygen doc\doxygen.config | $builddir\doxygen_mainpage

default ninja.exe
