summaryrefslogtreecommitdiffstats
path: root/build.ninja
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2010-11-07 04:38:53 (GMT)
committerEvan Martin <martine@danga.com>2010-11-07 04:38:53 (GMT)
commit9de8152ac76ec73ee47851a5b2041b02a5f7b03f (patch)
tree78c034bc89228de5efae0d1e11415fbd8ad58e5a /build.ninja
parent3fc91bb2d50990d0646da03fdb27136730543306 (diff)
downloadNinja-9de8152ac76ec73ee47851a5b2041b02a5f7b03f.zip
Ninja-9de8152ac76ec73ee47851a5b2041b02a5f7b03f.tar.gz
Ninja-9de8152ac76ec73ee47851a5b2041b02a5f7b03f.tar.bz2
check in build.ninja, since we're using it
Diffstat (limited to 'build.ninja')
-rw-r--r--build.ninja41
1 files changed, 41 insertions, 0 deletions
diff --git a/build.ninja b/build.ninja
new file mode 100644
index 0000000..1499d21
--- /dev/null
+++ b/build.ninja
@@ -0,0 +1,41 @@
+# This file is used to build ninja itself, but it also serves as a
+# documented example.
+
+# The special variable "builddir" can be referenced later via the short
+# name "@". The mnemonic comes from executables having an "@" prefix
+# in ls -F output.
+builddir = build
+
+# Most other variables, like cflags, aren't magic at all; it's up to
+# the rules to make use of them.
+cflags = -g -Wall
+
+# Here we declare a "rule" named "cxx", which knows how to compile
+# C++ code. The variables indented below the rule are scoped to the
+# rule itself. The "command" and "depfile" variables in rule scope
+# are special; see the documentation.
+rule cxx
+ depfile = $out.d
+ command = g++ -MMD -MF $out.d $cflags -c $in -o $out
+
+rule ar
+ command = ar crsT $out $in
+
+rule link
+ command = g++ $ldflags -o $out $in
+
+# These build rules build the ".o" files from the ".cc" files,
+# build "ninja.a" by linking the builddir's "ninja.o",
+# and build that "ninja.o" by compiling "ninja.cc".
+build @parsers.o: cxx parsers.cc
+build @ninja_jumble.o: cxx ninja_jumble.cc
+build @ninja.a: ar @parsers.o @ninja_jumble.o
+
+build @ninja.o: cxx ninja.cc
+build ninja: link @ninja.o @ninja.a
+
+build @ninja_test.o: cxx ninja_test.cc
+build @parsers_test.o: cxx parsers_test.cc
+build ninja_test: link @ninja_test.o @parsers_test.o @ninja.a
+ldflags = -lgtest -lgtest_main -lpthread
+