summaryrefslogtreecommitdiff
path: root/build.ninja
blob: 01b3be54cc4f5abbe1aa74617f2e704c1884b52e (plain) (blame)
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
cc                    = clang++
name                   = cait
src_dir                = $name
cxx_warnings           = -Weverything -Wno-c++98-compat
cxx_flags              = -I$src_dir -O3 -std=c++20 $cxx_warnings -MD
out_dir                = out
out_ext                = .exe
obj_ext                = .o
cc_ext                 = .cc
ninja_required_version = 1.10.2

rule cc
  command = $cc $cxx_flags -MF $out.d -c $in -o $out
  depfile = $out.d
  deps    = gcc
rule clang_format
  command = clang-format -i -style=LLVM $src_dir/*$cc_ext $src_dir/*.hh
rule clang_tidy
  command = run-clang-tidy -checks="*" -j 8 files $src_dir -p=out -fix -format
rule link
  command = $cc $in -o $out

build $out_dir/$name$obj_ext:   cc    $src_dir/$name$cc_ext
build $out_dir/cli$obj_ext:     cc    $src_dir/cli$cc_ext
build $out_dir/context$obj_ext: cc    $src_dir/context$cc_ext
build $out_dir/help$obj_ext:    cc    $src_dir/help$cc_ext
build $out_dir/lexer$obj_ext:   cc    $src_dir/lexer$cc_ext
build $out_dir/node$obj_ext:    cc    $src_dir/node$cc_ext
build $out_dir/parser$obj_ext:  cc    $src_dir/parser$cc_ext
build $out_dir/token$obj_ext:   cc    $src_dir/token$cc_ext
build $out_dir/$name$out_ext:   link  $out_dir/$name$obj_ext   $
                                      $out_dir/cli$obj_ext     $
                                      $out_dir/context$obj_ext $
                                      $out_dir/help$obj_ext    $
                                      $out_dir/lexer$obj_ext   $
                                      $out_dir/node$obj_ext    $
                                      $out_dir/parser$obj_ext  $
                                      $out_dir/token$obj_ext
build _format:                  clang_format
build format:                   phony _format
build _tidy:                    clang_tidy
build tidy:                     phony _tidy

default format $out_dir/$name$out_ext