Line | |
---|
1 | # makefile for Lua etc |
---|
2 | |
---|
3 | TOP= .. |
---|
4 | LIB= $(TOP)/src |
---|
5 | INC= $(TOP)/src |
---|
6 | BIN= $(TOP)/src |
---|
7 | SRC= $(TOP)/src |
---|
8 | TST= $(TOP)/test |
---|
9 | |
---|
10 | CC= gcc |
---|
11 | CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) |
---|
12 | MYCFLAGS= |
---|
13 | MYLDFLAGS= -Wl,-E |
---|
14 | MYLIBS= -lm |
---|
15 | #MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses |
---|
16 | RM= rm -f |
---|
17 | |
---|
18 | default: |
---|
19 | @echo 'Please choose a target: min noparser one strict clean' |
---|
20 | |
---|
21 | min: min.c |
---|
22 | $(CC) $(CFLAGS) $@.c -L$(LIB) -llua5.1 $(MYLIBS) |
---|
23 | echo 'print"Hello there!"' | ./a.out |
---|
24 | |
---|
25 | noparser: noparser.o |
---|
26 | $(CC) noparser.o $(SRC)/lua.o -L$(LIB) -llua5.1 $(MYLIBS) |
---|
27 | $(BIN)/luac $(TST)/hello.lua |
---|
28 | -./a.out luac.out |
---|
29 | -./a.out -e'a=1' |
---|
30 | |
---|
31 | one: |
---|
32 | $(CC) $(CFLAGS) all.c $(MYLIBS) |
---|
33 | ./a.out $(TST)/hello.lua |
---|
34 | |
---|
35 | strict: |
---|
36 | -$(BIN)/lua -e 'print(a);b=2' |
---|
37 | -$(BIN)/lua -lstrict -e 'print(a)' |
---|
38 | -$(BIN)/lua -e 'function f() b=2 end f()' |
---|
39 | -$(BIN)/lua -lstrict -e 'function f() b=2 end f()' |
---|
40 | |
---|
41 | clean: |
---|
42 | $(RM) a.out core core.* *.o luac.out |
---|
43 | |
---|
44 | .PHONY: default min noparser one strict clean |
---|
Note: See
TracBrowser
for help on using the repository browser.