forked from orlabs/orange
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (54 loc) · 2.17 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
INST_PREFIX ?= /usr
INST_LUADIR ?= $(INST_PREFIX)/share/lua/5.1
INST_BINDIR ?= /usr/bin
INSTALL ?= install
COPY ?= cp
LINK ?= ln
REMOVE ?= rm
CHMOD ?= chmod
LUAROCKS_VER ?= $(shell luarocks --version | grep -E -o "luarocks [0-9]+")
### help: Show Makefile rules.
.PHONY: help
help:
@echo Makefile rules:
@echo
@grep -E '^### [-A-Za-z0-9_]+:' Makefile | sed 's/###/ /'
### dev: Create Orange development ENV
.PHONY: dev
dev:
$(REMOVE) -f conf/*.conf
$(INSTALL) conf/nginx.conf.example conf/nginx.conf
$(INSTALL) conf/orange.conf.example conf/orange.conf
$(INSTALL) install/orange-v0.8.1.sql conf/orange-v0.8.1.sql
### install: Install the Orange
.PHONY: install
install:
$(INSTALL) -d /usr/local/orange/logs
$(INSTALL) -d /usr/local/orange/conf
$(INSTALL) -d /usr/local/orange/dashboard/views
$(INSTALL) -d /usr/local/orange/dashboard/static
$(INSTALL) conf/nginx.conf.example /usr/local/orange/conf/nginx.conf
$(INSTALL) conf/orange.conf.example /usr/local/orange/conf/orange.conf
$(INSTALL) conf/mime.types /usr/local/orange/conf/mime.types
$(INSTALL) install/orange-v0.8.1.sql /usr/local/orange/conf/orange-v0.8.1.sql
$(INSTALL) -d $(INST_LUADIR)/orange/dashboard
$(INSTALL) -d $(INST_LUADIR)/orange/orange
$(INSTALL) -d $(INST_LUADIR)/orange/bin
$(INSTALL) -d $(INST_LUADIR)/orange/api
$(COPY) -rf dashboard/* $(INST_LUADIR)/orange/dashboard
$(COPY) -rf dashboard/views/* /usr/local/orange/dashboard/views
$(COPY) -rf dashboard/static/* /usr/local/orange/dashboard/static
$(COPY) -rf orange/* $(INST_LUADIR)/orange/orange
$(COPY) -rf bin/* $(INST_LUADIR)/orange/bin
$(COPY) -rf api/* $(INST_LUADIR)/orange/api
$(INSTALL) bin/orange $(INST_BINDIR)/orange
$(REMOVE) -f /usr/local/bin/orange
$(LINK) -s $(INST_BINDIR)/orange /usr/local/bin/orange
### dependency: install the dependencies from .rockspec
.PHONY: dependency
dependency:
ifneq ($(LUAROCKS_VER),'luarocks 3')
luarocks install rockspec/orange-master-0.rockspec --server=https://luarocks.cn --tree=deps --only-deps --local
else
luarocks install --server=https://luarocks.cn --lua-dir=/usr/local/openresty/luajit rockspec/orange-master-0.rockspec --tree=deps --only-deps --local
endif