github.com/zyedidia/knit@v1.1.2-0.20230901152954-f7d4e39a0e24/examples/c/Knitfile (about) 1 local knit = require("knit") 2 3 local conf = { 4 cc = cli.cc or "gcc", 5 debug = tobool(cli.debug) or false, 6 } 7 8 local cflags := -Wall 9 10 if conf.debug then 11 cflags := $cflags -Og -g 12 else 13 cflags := $cflags -O2 14 end 15 16 local src = knit.glob("*.c") 17 local obj = knit.extrepl(src, ".c", ".o") 18 local prog := hello 19 20 return b{ 21 $ $prog: $obj 22 $(conf.cc) $cflags $input -o $output 23 $ %.o: %.c 24 $(conf.cc) $cflags -c $input -o $output 25 $ clean:VBQ: 26 knit :all -t clean 27 }