## directories dir_source := source dir_temp := temp dir_build := build dir_lib := lib ## commands cmd_concatenate := cat cmd_dir_make := mkdir --parents cmd_copy := cp --recursive --update --verbose cmd_tsc := tsc --lib es2017,dom --target es2020 cmd_remove := rm --force cmd_link := ln --symbolic cmd_log := echo "--" ## rules all: ${dir_build}/sql ${dir_build}/manage .PHONY: all ${dir_build}/sql: @ ${cmd_dir_make} ${dir_build}/sql @ ${cmd_copy} ${dir_source}/sql/* ${dir_build}/sql/ .PHONY: ${dir_build}/sql ${dir_temp}/plankton.d.ts: @ ${cmd_log} "fetching plankton declaration" @ ${cmd_dir_make} ${dir_temp} @ schwamm --include=${dir_lib}/plankton/plankton.swm.json --output=dump:logic-decl > ${dir_temp}/plankton.d.ts ${dir_temp}/plankton.js: @ ${cmd_log} "fetching plankton implementation" @ ${cmd_dir_make} ${dir_temp} @ schwamm --include=${dir_lib}/plankton/plankton.swm.json --output=dump:logic-impl > ${dir_temp}/plankton.js ${dir_temp}/manage-core.js: \ ${dir_temp}/plankton.d.ts \ ${dir_source}/types.ts \ ${dir_source}/helpers/string.ts \ ${dir_source}/helpers/object.ts \ ${dir_source}/helpers/json.ts \ ${dir_source}/helpers/file.ts \ ${dir_source}/helpers/database.ts \ ${dir_source}/helpers/misc.ts \ ${dir_source}/helpers/module.ts \ ${dir_source}/helpers/storage.ts \ ${dir_source}/helpers/repository.ts \ ${dir_source}/entities/concept.ts \ ${dir_source}/repositories/language.ts \ ${dir_source}/repositories/type.ts \ ${dir_source}/repositories/tag.ts \ ${dir_source}/repositories/expression.ts \ ${dir_source}/repositories/concept.ts \ ${dir_source}/services/language.ts \ ${dir_source}/services/type.ts \ ${dir_source}/services/tag.ts \ ${dir_source}/services/expression.ts \ ${dir_source}/services/concept.ts \ ${dir_source}/api/master.ts \ ${dir_source}/api/actions/concept_add.ts \ ${dir_source}/api/actions/translate.ts \ ${dir_source}/server.ts \ ${dir_source}/main.ts @ ${cmd_log} "compiling …" @ ${cmd_dir_make} ${dir_temp} @ ${cmd_tsc} $^ --outFile $@ ${dir_build}/manage: ${dir_temp}/plankton.js ${dir_temp}/manage-core.js @ ${cmd_log} "linking …" @ ${cmd_dir_make} ${dir_build} @ echo "#!/usr/bin/env node" > $@ @ ${cmd_concatenate} $^ >> $@ @ chmod +x ${dir_build}/manage