1# makefile for Lua etc 2 3TOP= .. 4LIB= $(TOP)/src 5INC= $(TOP)/src 6BIN= $(TOP)/src 7SRC= $(TOP)/src 8TST= $(TOP)/test 9 10CC= gcc 11CFLAGS= -O2 -Wall -I$(INC) $(MYCFLAGS) 12MYCFLAGS= 13MYLDFLAGS= -Wl,-E 14MYLIBS= -lm 15#MYLIBS= -lm -Wl,-E -ldl -lreadline -lhistory -lncurses 16RM= rm -f 17 18default: 19 @echo 'Please choose a target: min noparser one strict clean' 20 21min: min.c 22 $(CC) $(CFLAGS) $@.c -L$(LIB) -llua5.1 $(MYLIBS) 23 echo 'print"Hello there!"' | ./a.out 24 25noparser: 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 31one: 32 $(CC) $(CFLAGS) all.c $(MYLIBS) 33 ./a.out $(TST)/hello.lua 34 35strict: 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 41clean: 42 $(RM) a.out core core.* *.o luac.out 43 44.PHONY: default min noparser one strict clean 45