apisix/Makefile

105 lines
2.6 KiB
Makefile
Raw Normal View History

2019-05-31 21:06:55 +08:00
INST_PREFIX ?= /usr
INST_LIBDIR ?= $(INST_PREFIX)/lib64/lua/5.1
INST_LUADIR ?= $(INST_PREFIX)/share/lua/5.1
INST_BINDIR ?= /usr/bin
2019-05-31 21:06:55 +08:00
INSTALL ?= install
UNAME ?= $(shell uname)
2019-06-11 12:21:49 +08:00
.PHONY: default
default:
### help: Show Makefile rules.
.PHONY: help
help:
@echo Makefile rules:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
### dev: Create a development ENV
.PHONY: dev
dev:
./utils/update_nginx_conf_dev.sh
ifeq ($(UNAME),Darwin)
luarocks install --lua-dir=/usr/local/openresty/luajit apisix-*.rockspec --tree=deps --only-deps
else
sudo luarocks install --lua-dir=/usr/local/openresty/luajit apisix-*.rockspec --tree=deps --only-deps
endif
### check: Check Lua srouce code
.PHONY: check
check:
luacheck -q lua
./utils/lj-releng lua/*.lua lua/apisix/*.lua \
lua/apisix/admin/*.lua \
lua/apisix/core/*.lua \
lua/apisix/plugins/*.lua > \
/tmp/check.log 2>&1 || (cat /tmp/check.log && exit 1)
### init: Initialize the runtime environment
.PHONY: init
init:
./bin/apisix init
./bin/apisix init_etcd
### run: Start the apisix server
.PHONY: run
run:
mkdir -p logs
mkdir -p /tmp/cores/
$$(which openresty) -p $$PWD/
### stop: Stop the apisix server
.PHONY: stop
stop:
$$(which openresty) -p $$PWD/ -s stop
### clean: Remove generated files
.PHONY: clean
clean:
rm -rf logs/
### reload: Reload the apisix server
.PHONY: reload
reload:
$$(which openresty) -p $$PWD/ -s reload
2019-05-31 21:06:55 +08:00
### install: Install the apisix
2019-05-31 21:06:55 +08:00
.PHONY: install
install:
2019-06-05 15:06:28 +08:00
$(INSTALL) -d /usr/local/apisix/logs/
$(INSTALL) -d /usr/local/apisix/conf/cert
2019-06-05 15:06:28 +08:00
$(INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
$(INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml
$(INSTALL) conf/cert/apisix.* /usr/local/apisix/conf/cert/
2019-06-05 15:06:28 +08:00
$(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/core
$(INSTALL) lua/*.lua $(INST_LUADIR)/apisix/lua/
$(INSTALL) lua/apisix/core/*.lua $(INST_LUADIR)/apisix/lua/apisix/core/
$(INSTALL) lua/apisix/*.lua $(INST_LUADIR)/apisix/lua/apisix/
$(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins/prometheus/
$(INSTALL) lua/apisix/plugins/prometheus/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/prometheus/
$(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/plugins
$(INSTALL) lua/apisix/plugins/*.lua $(INST_LUADIR)/apisix/lua/apisix/plugins/
$(INSTALL) -d $(INST_LUADIR)/apisix/lua/apisix/admin
$(INSTALL) lua/apisix/admin/*.lua $(INST_LUADIR)/apisix/lua/apisix/admin/
$(INSTALL) COPYRIGHT $(INST_CONFDIR)/COPYRIGHT
$(INSTALL) README.md $(INST_CONFDIR)/README.md
$(INSTALL) bin/apisix $(INST_BINDIR)/apisix
2019-06-03 16:24:38 +08:00
test:
prove -I../test-nginx/lib -r -s t/