adventofcode-2021/prepare
2021-12-02 10:25:13 +01:00

19 lines
442 B
Bash
Executable File

#!/bin/sh
day="$1"
part="$2"
day="$(printf '%02d' "$day")"
name="Day${day}/Part${part}"
if zig -h > /dev/null && test -f "${name}.zig"; then
zig build-exe --name run "${name}.zig"
elif luac -v > /dev/null && test -f "${name}.lua"; then
luac -o luac.out "${name}.lua"
printf '#!/bin/sh\nlua luac.out "$@"\n' > run
chmod u+x run
elif stack > /dev/null && test -f "${name}.hs"; then
#stack build
stack ghc -- -O3 "${name}.hs" -o run
fi