-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMakefile
70 lines (49 loc) · 1.37 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
version=0.09
name=lua-rds-parser
dist=$(name)-$(version)
LUA_VERSION = 5.1
# See http://lua-users.org/wiki/BuildingModules for platform specific
# details.
## Linux/BSD
PREFIX ?= /usr/local
LDFLAGS += -shared
## OSX (Macports)
#PREFIX ?= /opt/local
#LDFLAGS += -bundle -undefined dynamic_lookup
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
#CFLAGS ?= -g -Wall -pedantic -fno-inline
CFLAGS ?= -g -O -Wall
override CFLAGS += -fpic -I$(LUA_INCLUDE_DIR)
INSTALL ?= install
.PHONY: all clean dist test t
#CC = gcc
RM = rm -f
all: parser.so
src/rds_parser.o: src/ddebug.h src/rds_parser.h src/resty_dbd_stream.h
.c.o:
$(CC) -c $(CFLAGS) $(CPPFLAGS) $(BUILD_CFLAGS) -o $@ $<
parser.so: src/rds_parser.o
$(CC) $(LDFLAGS) -o $@ $^
install:
$(INSTALL) -d $(DESTDIR)$(LUA_LIB_DIR)/rds
$(INSTALL) parser.so $(DESTDIR)$(LUA_LIB_DIR)/rds
clean:
$(RM) *.so *.o rds/*.so
test: all
$(INSTALL) -d rds
$(INSTALL) parser.so rds/
prove -I. -r t
valtest: parser.so
$(INSTALL) -d rds
$(INSTALL) parser.so rds/
TEST_LUA_USE_VALGRIND=1 prove -I. -r t
t: parser.so
$(INSTALL) -d rds
$(INSTALL) parser.so rds/
TEST_LUA_USE_VALGRIND=1 prove -I. t/sanity.t
dist:
git archive --prefix="$(dist)/" master | \
gzip -9 > "$(dist).tar.gz"
git archive --prefix="$(dist)/" \
-o "$(dist).zip" master