[add] lib:plankton
Christian Fraß

Christian Fraß commited on 2021-03-08 23:03:11
Zeige 1 geänderte Dateien mit 27 Einfügungen und 2 Löschungen.

... ...
@@ -1,14 +1,17 @@
1 1
 ## directories
2 2
 dir_source := source
3
+dir_temp := temp
3 4
 dir_build := build
4 5
 dir_lib := lib
5 6
 
6 7
 ## commands
8
+cmd_concatenate := cat
7 9
 cmd_dir_make := mkdir --parents
8 10
 cmd_copy := cp --recursive --update --verbose
9 11
 cmd_tsc := tsc --lib es2015,dom --target es6
10 12
 cmd_remove := rm --force
11 13
 cmd_link := ln --symbolic
14
+cmd_log := echo "--"
12 15
 
13 16
 ## rules
14 17
 all: ${dir_build}/sql ${dir_build}/manage
... ...
@@ -19,9 +22,21 @@ ${dir_build}/sql:
19 22
 	@ ${cmd_copy} ${dir_source}/sql/* ${dir_build}/sql/
20 23
 .PHONY: ${dir_build}/sql
21 24
 
22
-${dir_build}/manage: \
25
+${dir_temp}/plankton.d.ts:
26
+	@ ${cmd_log} "fetching plankton declaration"
27
+	@ ${cmd_dir_make} ${dir_temp}
28
+	@ schwamm --include=${dir_lib}/plankton/plankton.swm.json --output=dump:logic-decl > ${dir_temp}/plankton.d.ts
29
+
30
+${dir_temp}/plankton.js:
31
+	@ ${cmd_log} "fetching plankton implementation"
32
+	@ ${cmd_dir_make} ${dir_temp}
33
+	@ schwamm --include=${dir_lib}/plankton/plankton.swm.json --output=dump:logic-impl > ${dir_temp}/plankton.js
34
+
35
+${dir_temp}/manage-core.js: \
36
+	${dir_temp}/plankton.d.ts \
23 37
 	${dir_source}/types.ts \
24 38
 	${dir_source}/helpers/string.ts \
39
+	${dir_source}/helpers/object.ts \
25 40
 	${dir_source}/helpers/json.ts \
26 41
 	${dir_source}/helpers/file.ts \
27 42
 	${dir_source}/helpers/database.ts \
... ...
@@ -40,8 +55,18 @@ ${dir_build}/manage: \
40 55
 	${dir_source}/services/tag.ts \
41 56
 	${dir_source}/services/expression.ts \
42 57
 	${dir_source}/services/concept.ts \
58
+	${dir_source}/api/master.ts \
59
+	${dir_source}/api/actions/concept_add.ts \
60
+	${dir_source}/api/actions/translate.ts \
43 61
 	${dir_source}/main.ts
44
-	@ ${cmd_dir_make} ${dir_build}
62
+	@ ${cmd_log} "compiling …"
63
+	@ ${cmd_dir_make} ${dir_temp}
45 64
 	@ ${cmd_tsc} $^ --outFile $@
65
+
66
+${dir_build}/manage: ${dir_temp}/plankton.js ${dir_temp}/manage-core.js
67
+	@ ${cmd_log} "linking …"
68
+	@ ${cmd_dir_make} ${dir_build}
69
+	@ echo "#!/usr/bin/env node" > $@
70
+	@ ${cmd_concatenate} $^ >> $@
46 71
 	@ chmod +x ${dir_build}/manage
47 72
 
48 73