## directories

dir_tools := tools
dir_lib := lib
dir_source := source
dir_temp := /tmp/arc-temp
dir_build := build


## commands

cmd_log := echo "--"
cmd_mkdir := mkdir -p
cmd_cat := cat
cmd_chmod := chmod
cmd_tsc := ${dir_tools}/typescript/node_modules/.bin/tsc


## rules

.PHONY: _default
_default: ${dir_build}/arc

${dir_temp}/arc-unlinked.js: \
		${dir_lib}/plankton/plankton.d.ts \
		${dir_source}/main.ts
	@ ${cmd_log} "compiling …"
	@ ${cmd_tsc} --lib es2020 --strict $^ --outFile $@

${dir_build}/arc: \
		${dir_source}/head.js \
		${dir_lib}/plankton/plankton.js \
		${dir_temp}/arc-unlinked.js
	@ ${cmd_log} "linking …"
	@ ${cmd_mkdir} $(dir $@)
	@ ${cmd_cat} $^ > $@
	@ ${cmd_chmod} +x $@

