| 1 |
OPENRESTY_PREFIX=/usr/local/openresty |
| 2 |
|
| 3 |
PREFIX ?= /usr/local |
| 4 |
LUA_INCLUDE_DIR ?= $(PREFIX)/include |
| 5 |
LUA_LIB_DIR ?= $(PREFIX)/lib/lua/$(LUA_VERSION) |
| 6 |
INSTALL ?= install |
| 7 |
|
| 8 |
.PHONY: all test install lint |
| 9 |
|
| 10 |
all: ; |
| 11 |
|
| 12 |
install: all |
| 13 |
$(INSTALL) -d $(DESTDIR)/$(LUA_LIB_DIR)/resty/lrucache |
| 14 |
$(INSTALL) lib/resty/*.lua $(DESTDIR)/$(LUA_LIB_DIR)/resty/ |
| 15 |
$(INSTALL) lib/resty/lrucache/*.lua $(DESTDIR)/$(LUA_LIB_DIR)/resty/lrucache/ |
| 16 |
ifeq ($(LUA_LIB_DIR),/usr/local/lib/lua/) |
| 17 |
@echo |
| 18 |
@printf "\033[33mPLEASE NOTE: \033[0m\n" |
| 19 |
@printf "\033[33mThe necessary lua_package_path directive needs to be added to nginx.conf\033[0m\n" |
| 20 |
@printf "\033[33min the http context, because \"/usr/local/lib/lua/\" is not in LuaJIT’s default search path.\033[0m\n" |
| 21 |
@printf "\033[33mRefer to the Installation section of README.markdown.\033[0m\n" |
| 22 |
endif |
| 23 |
|
| 24 |
test: all lint |
| 25 |
PATH=$(OPENRESTY_PREFIX)/nginx/sbin:$$PATH prove -I../test-nginx/lib -r t |
| 26 |
|
| 27 |
lint: |
| 28 |
@! grep -P -n --color -- 'require.*?resty\.lrucache[^.]' t/*pureffi*/*.t || (echo "ERROR: Found pureffi tests requiring 'resty.lrucache'." > /dev/stderr; exit 1) |
| 29 |
@! grep -R -P -n --color --exclude-dir=pureffi --exclude=*mixed.t -- 'require.*?resty\.lrucache\.pureffi' t/*.t || (echo "ERROR: Found pure Lua tests requiring 'resty.lrucache.pureffi'." > /dev/stderr; exit 1) |
| 30 |
|