My solutions for the Advent of Code 2022 - spoilers ahead
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
aoc2022/wren/Build.moon

24 lines
678 B

var CC: 'gcc'
var CFLAGS: '-Wall', '-Wextra', '-Werror'
var LDFLAGS: '-lm'
with public default target 'all'
\depends 'wren_aoc'
with public target 'wren_aoc'
\depends 'main.o', 'aoc.o', 'libwren.a'
\produces '%'
\fn => _.cmd CC, CFLAGS, @infiles, '-o', @outfile, LDFLAGS
with target {'main.o', 'aoc.o'}, pattern: '%.o'
\depends '%.c'
\produces '%.o'
\fn => _.cmd CC, CFLAGS, @infile, '-o', @outfile, '-c'
with target 'aoc.c'
\depends 'aoc.wren'
\produces '%'
\fn =>
code = _.readfile @infile
c_code = "extern const char* aoc_mod = \"#{code\gsub('"', '\\"')\gsub('\n', '\\n')}\";\n"
_.writefile @outfile, c_code