Skip to content

Commit

Permalink
Add OPM dependancies into Makefile
Browse files Browse the repository at this point in the history
Until OPM provides support for compiling C/FFI modules, we'll need
to stick to the Makefile as the official installation method. Since
we're not including pure Lua resty libs anymore, we can use OPM to
install our dependencies.
  • Loading branch information
p0pr0ck5 committed Oct 18, 2016
1 parent baac24b commit 53fdfbb
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
OPENRESTY_PREFIX ?= /usr/local/openresty
LUA_LIB_DIR ?= $(OPENRESTY_PREFIX)/lualib
LUA_LIB_DIR ?= $(OPENRESTY_PREFIX)/site/lualib
INSTALL_SOFT ?= ln -s
INSTALL ?= install
RESTY_BINDIR = $(OPENRESTY_PREFIX)/bin
OPM = $(RESTY_BINDIR)/opm
PWD = `pwd`

LIBS = waf waf.lua
C_LIBS = lua-aho-corasick libinjection
OPM_LIBS = hamishforbes/lua-resty-iputils p0pr0ck5/lua-resty-cookie p0pr0ck5/lua-ffi-libinjection p0pr0ck5/lua-resty-logger-socket
MAKE_LIBS = $(C_LIBS)
SO_LIBS = libac.so libinjection.so
RULES = rules
Expand All @@ -14,33 +17,27 @@ LOCAL_LIB_DIR = lib/resty

.PHONY: all test install clean test-unit test-acceptance test-regression \
test-translate lua-aho-corasick libinjection clean-libinjection \
clean-lua-aho-corasick
clean-lua-aho-corasick install-opm-libs clean-opm-libs

all: $(MAKE_LIBS)

clean: clean-libinjection clean-lua-aho-corasick clean-libs clean-test

clean-install:
clean-install: clean-opm-libs
cd $(LUA_LIB_DIR) && rm -rf $(RULES) && rm -f $(SO_LIBS) && cd resty/ && rm -rf $(LIBS)

clean-lua-aho-corasick:
cd lua-aho-corasick && make clean

clean-lua-ffi-libinjection:
rm -f $(LOCAL_LIB_DIR)/libinjection.lua

clean-lua-resty-cookie:
rm -f $(LOCAL_LIB_DIR)/cookie.lua

clean-lua-resty-iputils:
rm -f $(LOCAL_LIB_DIR)/iputils.lua

clean-libinjection:
cd libinjection && make clean && git checkout -- .

clean-libs:
cd lib && rm -f $(SO_LIBS)

clean-opm-libs:
$(OPM) remove $(OPM_LIBS)

clean-test:
rm -rf t/servroot

Expand Down Expand Up @@ -71,7 +68,10 @@ test-libs: clean all test-lua-aho-corasick test-libinjection

test-recursive: test test-libs

install:
install-opm-libs:
$(OPM) install $(OPM_LIBS)

install: install-opm-libs
$(INSTALL) -d $(LUA_LIB_DIR)/resty/waf/storage
$(INSTALL) -d $(LUA_LIB_DIR)/rules
$(INSTALL) lib/resty/*.lua $(LUA_LIB_DIR)/resty/
Expand All @@ -80,7 +80,7 @@ install:
$(INSTALL) lib/*.so $(LUA_LIB_DIR)
$(INSTALL) rules/*.json $(LUA_LIB_DIR)/rules/

install-soft:
install-soft: install-opm-libs
$(INSTALL_SOFT) $(PWD)/lib/resty/* $(LUA_LIB_DIR)/resty/
$(INSTALL_SOFT) $(PWD)/lib/*.so $(LUA_LIB_DIR)
$(INSTALL_SOFT) $(PWD)/rules/ $(LUA_LIB_DIR)

0 comments on commit 53fdfbb

Please sign in to comment.