ReverseFlux

ninja

Feb 8th, 2017
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. # This file is used to build ninja itself, but it also serves as a
  2. # documented example.
  3. # Note that it is an explicit non-goal of ninja to make it convenient
  4. # to write these build files by hand. For a real project, you'd generate
  5. # this build file. I was tempted to generate this file even for ninja
  6. # itself but I figured it'd be easier to bootstrap this way.
  7. # Most variables aren't magic at all; it's up to the rules to make use
  8. # of them.
  9. builddir = build
  10. cxx = g++
  11. #cxx = /home/evanm/projects/src/llvm/Release+Asserts/bin/clang++
  12. cflags = -g -Wall -Wno-deprecated -fno-exceptions -fvisibility=hidden -pipe
  13. # -rdynamic is needed for backtrace()
  14. ldflags = -g -rdynamic
  15. # bootstrap.sh generates a "config" file, which contains more build
  16. # flags.
  17. include config.ninja
  18. # Here we declare a "rule" named "cxx", which knows how to compile
  19. # C++ code. The variables indented below the rule are scoped to the
  20. # rule itself. The "command" and "depfile" variables in rule scope
  21. # are special; see the documentation.
  22. rule cxx
  23. depfile = $out.d
  24. command = $cxx -MMD -MF $out.d $conf_cflags $cflags -c $in -o $out
  25. description = CC $out
  26. rule ar
  27. command = ar crsT $out $in
  28. description = AR $out
  29. rule link
  30. command = $cxx $conf_ldflags $ldflags -o $out $in
  31. description = LINK $out
  32. # These build rules build the ".o" files from the ".cc" files,
  33. # build "ninja.a" by linking the builddir's "ninja.o",
  34. # and build that "ninja.o" by compiling "ninja.cc".
  35. build $builddir/build.o: cxx src/build.cc
  36. build $builddir/build_log.o: cxx src/build_log.cc
  37. build $builddir/eval_env.o: cxx src/eval_env.cc
  38. build $builddir/graph.o: cxx src/graph.cc
  39. build $builddir/parsers.o: cxx src/parsers.cc
  40. build $builddir/subprocess.o: cxx src/subprocess.cc
  41. build $builddir/util.o: cxx src/util.cc
  42. build $builddir/ninja_jumble.o: cxx src/ninja_jumble.cc
  43. build $builddir/ninja.a: ar $builddir/build.o $builddir/build_log.o \
  44. $builddir/eval_env.o $builddir/graph.o $builddir/parsers.o \
  45. $builddir/subprocess.o $builddir/util.o $builddir/ninja_jumble.o
  46. build $builddir/ninja.o: cxx src/ninja.cc
  47. build ninja: link $builddir/ninja.o $builddir/ninja.a
  48. build $builddir/build_test.o: cxx src/build_test.cc
  49. build $builddir/build_log_test.o: cxx src/build_log_test.cc
  50. build $builddir/ninja_test.o: cxx src/ninja_test.cc
  51. build $builddir/parsers_test.o: cxx src/parsers_test.cc
  52. build $builddir/subprocess_test.o: cxx src/subprocess_test.cc
  53. build ninja_test: link $builddir/build_test.o $builddir/build_log_test.o \
  54. $builddir/ninja_test.o $builddir/parsers_test.o \
  55. $builddir/subprocess_test.o $builddir/ninja.a
  56. ldflags = -g -rdynamic -lgtest -lgtest_main -lpthread
  57. # Generate a graph of the dependency tree (including the
  58. # graph generation itself in the resulting tree).
  59. rule gendot
  60. command = ./ninja -g all > $out
  61. rule gengraph
  62. command = dot -Tpng $in > $out
  63. build $builddir/graph.dot: gendot ninja build.ninja
  64. build graph.png: gengraph $builddir/graph.dot
  65. rule asciidoc
  66. command = asciidoc -a toc $in
  67. description = ASCIIDOC $in
  68. build manual.html: asciidoc manual.asciidoc
  69. build doc: phony | manual.html
  70. # Use the built-in phony rule and an order-only dependency
  71. # to make building "all" build all targets.
  72. build all: phony | ninja ninja_test graph.png doc
Advertisement
Add Comment
Please, Sign In to add comment