-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile
46 lines (30 loc) · 970 Bytes
/
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
OPENRESTY_PREFIX=/usr/local/openresty
PREFIX ?= /usr/local
LUA_INCLUDE_DIR ?= $(PREFIX)/include
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION)
INSTALL ?= install
.PHONY: all test install
SRC := resty_signal.c
OBJ := $(SRC:.c=.o)
C_SO_NAME := librestysignal.so
CFLAGS := -O3 -g -Wall -fpic
LDFLAGS := -shared
# on Mac OS X, one should set instead:
# LDFLAGS := -bundle -undefined dynamic_lookup
MY_CFLAGS := $(CFLAGS)
MY_LDFLAGS := $(LDFLAGS) -fvisibility=hidden
test := t
.PHONY = all test clean install
all : $(C_SO_NAME)
${OBJ} : %.o : %.c
$(CC) $(MY_CFLAGS) -c $<
${C_SO_NAME} : ${OBJ}
$(CC) $(MY_LDFLAGS) $^ -o $@
#export TEST_NGINX_NO_CLEAN=1
clean:; rm -f *.o *.so a.out *.d
install:
$(INSTALL) -d $(DESTDIR)$(LUA_LIB_DIR)/resty
$(INSTALL) lib/resty/*.lua $(DESTDIR)$(LUA_LIB_DIR)/resty
$(INSTALL) $(C_SO_NAME) $(DESTDIR)$(LUA_LIB_DIR)/
test : all
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH prove -I../test-nginx/lib -r $(test)