]> git.lizzy.rs Git - metalua.git/blob - src/compiler/Makefile
moved all 3rd party C libraries in a single dir
[metalua.git] / src / compiler / Makefile
1 include ../common.mk
2
3 all: $(LIBRARIES) $(M_LIBRARIES) install metalua
4
5 $(PLATFORM): all
6
7 LUA_RUN     = ../lua/lua
8 LUA_COMPILE = ../lua/luac
9
10 LIBRARIES =       \
11         bytecode.luac \
12         mlp.luac      \
13         mlc.luac      
14
15
16 # Library which compiles an AST into a bytecode string.
17 BYTECODE_LUA =      \
18       lopcodes.lua  \
19       lcode.lua     \
20       ldump.lua     \
21       compile.lua   
22
23 # Library which compiles source strings into AST
24 MLP_LUA =           \
25       lexer.lua     \
26       gg.lua        \
27       mlp_lexer.lua \
28       mlp_misc.lua  \
29       mlp_table.lua \
30       mlp_meta.lua  \
31       mlp_expr.lua  \
32       mlp_stat.lua  \
33       mlp_ext.lua 
34
35 bytecode.luac: $(BYTECODE_LUA)
36         $(LUA_COMPILE) -o $@ $^
37
38 mlp.luac: $(MLP_LUA)
39         $(LUA_COMPILE) -o $@ $^
40
41 # Plain lua files compilation
42 %.luac: %.mlua bootstrap.lua mlp.luac bytecode.luac
43         $(LUA_RUN) bootstrap.lua $<
44
45 # Metalua files compilation through the bootstrap compiler
46 %.luac: %.lua
47         $(LUA_COMPILE) -o $@ bootstrap $<
48
49 # Compiler/interpreter
50 metalua: metalua.luac $(LIBRARIES)
51         $(LUA_RUN) metalua.luac --verbose --sharpbang '#!/usr/bin/env lua' --output metalua --file metalua.mlua
52
53 install: metalua $(LIBRARIES)
54         cp metalua $(TARGET_BIN_PATH)
55         cp $(LIBRARIES) $(TARGET_LUA_PATH)/
56
57 .PHONY: all lib install
58
59 clean:
60         -rm *.luac metalua