]> git.lizzy.rs Git - metalua.git/blob - src/compiler/Makefile
Comiler now accept `Local{ {lhs} } nodes without a rhs part.
[metalua.git] / src / compiler / Makefile
1 include ../config
2
3 all: $(LIBRARIES) install metalua
4
5 $(PLATFORM): all
6
7 LUA_RUN     = ../$(LUA_VM_DIR)/$(RUN)
8 LUA_COMPILE = ../$(LUA_VM_DIR)/$(COMPILE)
9
10 LIBRARIES =       \
11         bytecode.luac \
12         mlp.luac      \
13         mlc.luac      
14
15 # Library which compiles an AST into a bytecode string.
16 BYTECODE_LUA =      \
17       lopcodes.lua  \
18       lcode.lua     \
19       ldump.lua     \
20       compile.lua   
21
22 # Library which compiles source strings into AST
23 MLP_LUA =           \
24       lexer.lua     \
25       gg.lua        \
26       mlp_lexer.lua \
27       mlp_misc.lua  \
28       mlp_table.lua \
29       mlp_meta.lua  \
30       mlp_expr.lua  \
31       mlp_stat.lua  \
32       mlp_ext.lua 
33
34 bytecode.luac: $(BYTECODE_LUA)
35         $(LUA_COMPILE) -o $@ $^
36
37 mlp.luac: $(MLP_LUA)
38         $(LUA_COMPILE) -o $@ $^
39
40 # Plain lua files compilation
41 %.luac: %.mlua bootstrap.lua mlp.luac bytecode.luac
42         $(LUA_RUN) bootstrap.lua $<
43
44 # FIXME what's this?! some old stuff from when metalua files hadn't their own
45 # extensions?
46 # Metalua files compilation through the bootstrap compiler
47 %.luac: %.lua
48         $(LUA_COMPILE) -o $@ bootstrap $<
49
50 # Compiler/interpreter
51 metalua: metalua.luac $(LIBRARIES)
52         $(LUA_RUN) metalua.luac --verbose --sharpbang '#!/usr/bin/env lua' --output metalua --file metalua.mlua
53
54 install: metalua $(LIBRARIES)
55         mkdir -p $(TARGET_BIN_PATH)
56         cp metalua $(TARGET_BIN_PATH)/
57         mkdir -p $(TARGET_LUA_PATH)
58         cp $(LIBRARIES) $(TARGET_LUA_PATH)/
59
60 .PHONY: all install
61
62 clean:
63         -rm *.luac metalua