sindri/tools/makefile
2023-07-13 21:57:56 +02:00

36 lines
812 B
Makefile

## commands
cmd_create_directory := mkdir --parents
cmd_typescript_compile := tsc
cmd_concatenate := cat
cmd_chmod := chmod
cmd_echo := echo -e
cmd_log := echo -e "--"
## rules
.PHONY: all
all: build/sindri
temp/sindri-unlinked.js: \
lib/plankton/plankton.d.ts \
source/types.ts \
source/outputs/sqlite.ts \
source/outputs/mysql.ts \
source/outputs/jsonschema.ts \
source/outputs/typescript.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_echo} "#!/usr/bin/env node\n" > temp/head.js
@ ${cmd_concatenate} temp/head.js $^ > $@
@ ${cmd_chmod} +x $@