Werkfile (784B) - raw


      1 default target = "build"
      2 default jobs = 1
      3 
      4 config profile = "debug"
      5 
      6 # Pick cflags based on the build profile
      7 let cflags = profile | match {
      8     "debug" => ["-O0"]
      9     "release" => ["-O3"]
     10     "asan-address" => ["-O0", "--sanitize=address"]
     11     "%" => ""
     12 }
     13 
     14 build "bin/%" {
     15     from "%.c3"
     16     from [
     17         "util-frequency.c3",
     18         "test.c3",
     19     ]
     20     run "c3c compile <in*:workspace> -o <out:out-dir>"
     21 }
     22 
     23 task build {
     24     let bins = [
     25         glob "ba*.c3" | map "bin{:s/.c3//}",
     26         ["bin/approximate_pattern_count"]
     27     ] | flatten
     28     #info "{bins*}"
     29     build bins
     30 }
     31 
     32 build "testrun" {
     33     from glob "*.c3"
     34     run "c3c compile-test --suppress-run {cflags*} <in*> -o <out:out-dir>"
     35 }
     36 
     37 task test {
     38     let test_exe = "testrun"
     39     build test_exe
     40     run "<test_exe>"
     41 }