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