Makefile 912 B

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