summaryrefslogtreecommitdiff
path: root/build.ninja
blob: c97c215d99202eeaff6c95b798883d2eac2806fa (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
cc       = clang++
cxxflags = -Isrc -O3 -std=c++20 -Weverything -Wno-c++98-compat
out_dir  = out
name     = cait
src_dir  = src
out_ext  = .exe
obj_ext  = .o
cc_ext   = .cc

rule cc
  command = $cc $cxxflags -c $in -o $out
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