-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ninja.sample
66 lines (50 loc) · 1.58 KB
/
build.ninja.sample
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# This sample build.ninja file is released into the public domain,
# WITHOUT WARRANTY OF ANY KIND
builddir = build
# tools
CC = gcc
CXX = g++
AR = ar
ASCIIDOC = asciidoc
# flags for C and C++
CCFLAGS_WARN = -pedantic -Wall -Wextra
CCFLAGS_CODEGEN = -O0 -g
CCFLAGS_DEF = -pthread -D_XOPEN_SOURCE=500
CCFLAGS_INC =
CCFLAGS_LINK = -pthread
# flags for C
CFLAGS_LANG = -std=c99
CFLAGS_ALL = $CFLAGS_LANG $CCFLAGS_WARN $CCFLAGS_CODEGEN $CCFLAGS_DEF $CCFLAGS_INC $CPPFLAGS $CFLAGS
CFLAGS_LINK = $CCFLAGS_CODEGEN $CCFLAGS_LINK $CFLAGS
# flags for C++
CXXFLAGS_LANG = -std=c++98
CXXFLAGS_ALL = $CXXFLAGS_LANG $CCFLAGS_WARN $CCFLAGS_CODEGEN $CCFLAGS_DEF $CCFLAGS_INC $CPPFLAGS $CXXFLAGS
CXXFLAGS_LINK = $CCFLAGS_CODEGEN $CCFLAGS_LINK $CXXFLAGS
# flags for asciidoc
ASCIIDOC_FLAGS = -a numbered -a toc -b xhtml11 -d article
rule cc
description = CC $in
depfile = $out.d
command = $CC $CFLAGS_ALL $EXTRAFLAGS -MMD -MF $out.d -o $out -c $in
rule cxx
description = CXX $in
depfile = $out.d
command = $CXX $CXXFLAGS_ALL $EXTRAFLAGS -MMD -MF $out.d -o $out -c $in
rule cclink
description = LINK(CC) $out
command = $CC $CFLAGS_LINK $EXTRAFLAGS -o $out $in $LIBS
rule cxxlink
description = LINK(CXX) $out
command = $CXX $CXXFLAGS_LINK $EXTRAFLAGS -o $out $in $LIBS
rule ar
description = AR $out
command = $AR rcs $out $in
rule asciidoc
description = ASCIIDOC $in
command = $ASCIIDOC $ASCIIDOC_FLAGS -o $out $in
# fill in build rules below
build $builddir/src/???.c.o: cc src/???.c
build ???: cclink $builddir/src/???.c.o
LIBS = -lm
build doc/???.html: asciidoc doc/???.asciidoc
default ???