sindri/tools/makefile
2023-08-08 14:39:21 +02:00

44 lines
1.1 KiB
Makefile

## commands
cmd_create_directory := mkdir --parents
cmd_typescript_compile := tsc
cmd_concatenate := cat
cmd_chmod := chmod
cmd_echo := echo -e
cmd_echox := echo
cmd_log := echo -e "--"
cmd_copy := cp -r -u -v
## rules
.PHONY: all
all: build/sindri templates
temp/sindri-unlinked.js: \
lib/plankton/plankton.d.ts \
source/base.ts \
source/outputs/other/jsonschema/logic.ts \
source/outputs/database/sqlite/logic.ts \
source/outputs/database/mysql/logic.ts \
source/outputs/backend/typescript/logic.ts \
source/outputs/frontend/typescript/logic.ts \
source/conf.ts \
source/main.ts
@ ${cmd_log} "compiling …"
@ ${cmd_create_directory} temp
@ ${cmd_typescript_compile} $^ --lib es2020 --target es6 --outFile $@
build/sindri: lib/plankton/plankton.js temp/sindri-unlinked.js
@ ${cmd_log} "linking …"
@ ${cmd_create_directory} build
@ ${cmd_echox} "#!/usr/bin/env node" > temp/head.js
@ ${cmd_concatenate} temp/head.js $^ > $@
@ ${cmd_chmod} +x $@
.PHONY: templates
templates: \
source/outputs/frontend/typescript/templates/core.ts.tpl
@ ${cmd_log} "placing templates …"
@ tools/place-templates