-
Notifications
You must be signed in to change notification settings - Fork 40
/
makefile
55 lines (42 loc) · 852 Bytes
/
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
.PHONY: all clean test
LUMEN_LUA ?= lua
LUMEN_NODE ?= node
LUMEN_HOST ?= $(LUMEN_LUA)
LUMEN := LUMEN_HOST="$(LUMEN_HOST)" bin/lumen
OBJS := obj/runtime.o \
obj/macros.o \
obj/main.o
MODS := bin/lumen.x \
bin/reader.x \
bin/compiler.x \
bin/system.x
all: $(MODS:.x=.js) $(MODS:.x=.lua)
clean:
@git checkout bin/*.js
@git checkout bin/*.lua
@rm -f obj/*
bin/lumen.js: $(OBJS:.o=.js)
@echo $@
@cat $^ > $@.tmp
@mv $@.tmp $@
bin/lumen.lua: $(OBJS:.o=.lua)
@echo $@
@cat $^ > $@.tmp
@mv $@.tmp $@
obj/%.js : %.l
@echo " $@"
@$(LUMEN) -c $< -o $@ -t js
obj/%.lua : %.l
@echo " $@"
@$(LUMEN) -c $< -o $@ -t lua
bin/%.js : %.l
@echo $@
@$(LUMEN) -c $< -o $@ -t js
bin/%.lua : %.l
@echo $@
@$(LUMEN) -c $< -o $@ -t lua
test: all
@echo js:
@LUMEN_HOST=$(LUMEN_NODE) ./test.l
@echo lua:
@LUMEN_HOST=$(LUMEN_LUA) ./test.l