makefile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. LIBNAME = lpeg
  2. LUADIR = ../lua/
  3. COPT = -O2 -DNDEBUG
  4. # COPT = -O0 -DLPEG_DEBUG -g
  5. CWARNS = -Wall -Wextra -pedantic \
  6. -Waggregate-return \
  7. -Wcast-align \
  8. -Wcast-qual \
  9. -Wdisabled-optimization \
  10. -Wpointer-arith \
  11. -Wshadow \
  12. -Wredundant-decls \
  13. -Wsign-compare \
  14. -Wundef \
  15. -Wwrite-strings \
  16. -Wbad-function-cast \
  17. -Wdeclaration-after-statement \
  18. -Wmissing-prototypes \
  19. -Wmissing-declarations \
  20. -Wnested-externs \
  21. -Wstrict-prototypes \
  22. -Wc++-compat \
  23. # -Wunreachable-code \
  24. CFLAGS = $(CWARNS) $(COPT) -std=c99 -I$(LUADIR) -fPIC
  25. CC = gcc
  26. FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o lpcset.o
  27. # For Linux
  28. linux:
  29. $(MAKE) lpeg.so "DLLFLAGS = -shared -fPIC"
  30. # For Mac OS
  31. macosx:
  32. $(MAKE) lpeg.so "DLLFLAGS = -bundle -undefined dynamic_lookup"
  33. lpeg.so: $(FILES)
  34. env $(CC) $(DLLFLAGS) $(FILES) -o lpeg.so
  35. $(FILES): makefile
  36. test: test.lua re.lua lpeg.so
  37. ./test.lua
  38. clean:
  39. rm -f $(FILES) lpeg.so
  40. lpcap.o: lpcap.c lpcap.h lptypes.h
  41. lpcode.o: lpcode.c lptypes.h lpcode.h lptree.h lpvm.h lpcap.h lpcset.h
  42. lpcset.o: lpcset.c lptypes.h lpcset.h lpcode.h lptree.h lpvm.h lpcap.h
  43. lpprint.o: lpprint.c lptypes.h lpprint.h lptree.h lpvm.h lpcap.h lpcode.h
  44. lptree.o: lptree.c lptypes.h lpcap.h lpcode.h lptree.h lpvm.h lpprint.h \
  45. lpcset.h
  46. lpvm.o: lpvm.c lpcap.h lptypes.h lpvm.h lpprint.h lptree.h