This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
107 lines (83 loc) · 2.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
bin := $(shell npm bin)
ometa := $(bin)/ometajs2js
sjs := $(bin)/sjs
doctoc := $(bin)/doctoc
# -- CONFIGURATION -----------------------------------------------------
LANG_TGT_DIR := lib
LANG_SRC_DIR := src
LANG_SRC_SJS := $(shell find $(LANG_SRC_DIR)/ -name '*.sjs')
LANG_SRC_OMETA := $(shell find $(LANG_SRC_DIR)/ -name '*.ometajs')
LANG_TGT := ${LANG_SRC_SJS:$(LANG_SRC_DIR)/%.sjs=$(LANG_TGT_DIR)/%.js} \
${LANG_SRC_OMETA:$(LANG_SRC_DIR)/%.ometajs=$(LANG_TGT_DIR)/%.js}
VM_TGT_DIR := vm
VM_SRC_DIR := vm
VM_SRC := $(shell find $(VM_SRC_DIR)/ -name '*.sjs')
VM_TGT := ${VM_SRC:$(VM_SRC_DIR)/%.sjs=$(VM_TGT_DIR)/%.js}
REPL_TGT_DIR := repl
REPL_SRC_DIR := repl
REPL_SRC := $(shell find $(REPL_SRC_DIR)/ -name '*.sjs')
REPL_TGT := ${REPL_SRC:$(REPL_SRC_DIR)/%.sjs=$(REPL_TGT_DIR)/%.js}
RT_TGT_DIR := runtime
RT_SRC_DIR := runtime/src
RT_SRC := $(shell find $(RT_SRC_DIR)/ -name '*.siren')
RT_TGT := ${RT_SRC:$(RT_SRC_DIR)/%.siren=$(RT_TGT_DIR)/%.js}
DOC_DIR := documentation
# -- COMPILATION -------------------------------------------------------
$(LANG_TGT_DIR)/%.js: $(LANG_SRC_DIR)/%.ometajs
mkdir -p $(dir $@)
$(ometa) --beautify < $< > $@
$(LANG_TGT_DIR)/%.js: $(LANG_SRC_DIR)/%.sjs
mkdir -p $(dir $@)
$(sjs) --readable-names \
--module lambda-chop/macros \
--module adt-simple/macros \
--module sparkler/macros \
--module es6-macros/macros/destructure \
--module macros.operators \
--output $@ \
$<
$(VM_TGT_DIR)/%.js: $(VM_SRC_DIR)/%.sjs
$(sjs) --readable-names \
--module lambda-chop/macros \
--module adt-simple/macros \
--module sparkler/macros \
--module es6-macros/macros/destructure \
--module macros.operators \
--output $@ \
$<
$(REPL_TGT_DIR)/%.js: $(REPL_SRC_DIR)/%.sjs
$(sjs) --readable-names \
--module lambda-chop/macros \
--module adt-simple/macros \
--module sparkler/macros \
--module es6-macros/macros/destructure \
--module macros.operators \
--output $@ \
$<
$(RT_TGT_DIR)/%.js: $(RT_SRC_DIR)/%.siren
mkdir -p $(dir $@)
bin/siren -c $< > $@
# -- TASKS -------------------------------------------------------------
node_modules: package.json
npm install
language: $(LANG_TGT)
vm: $(VM_TGT)
repl: $(REPL_TGT)
runtime: $(RT_TGT)
all: node_modules vm repl language runtime
clean-vm:
rm -f $(VM_TGT)
clean-repl:
rm -f $(REPL_TGT)
clean-language:
rm -f $(LANG_TGT)
clean-runtime:
rm -f $(RT_TGT)
clean:
rm -rf node_modules
rm -f $(VM_TGT) $(LANG_TGT) $(RT_TGT) $(REPL_TGT)
docs-toc: $(DOC_DIR)/*.md
$(doctoc) $(DOC_DIR)
test:
bin/siren tests/runtime.siren
.PHONY: clean clean-vm clean-repl clean-language clean-runtime docs-toc test