-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (51 loc) · 2.29 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
67
68
69
70
71
72
73
TOP_DIR = ../..
include $(TOP_DIR)/tools/Makefile.common
DEPLOY_RUNTIME ?= /kb/runtime
TARGET ?= /kb/deployment
APP_SERVICE = app_service
SRC_PERL = $(wildcard scripts/*.pl)
BIN_PERL = $(addprefix $(BIN_DIR)/,$(basename $(notdir $(SRC_PERL))))
DEPLOY_PERL = $(addprefix $(TARGET)/bin/,$(basename $(notdir $(SRC_PERL))))
SRC_SERVICE_PERL = $(wildcard service-scripts/*.pl)
BIN_SERVICE_PERL = $(addprefix $(BIN_DIR)/,$(basename $(notdir $(SRC_SERVICE_PERL))))
DEPLOY_SERVICE_PERL = $(addprefix $(SERVICE_DIR)/bin/,$(basename $(notdir $(SRC_SERVICE_PERL))))
CLIENT_TESTS = $(wildcard t/client-tests/*.t)
SERVER_TESTS = $(wildcard t/server-tests/*.t)
PROD_TESTS = $(wildcard t/prod-tests/*.t)
STARMAN_WORKERS = 8
STARMAN_MAX_REQUESTS = 100
TPAGE_ARGS = --define kb_top=$(TARGET) --define kb_runtime=$(DEPLOY_RUNTIME) --define kb_service_name=$(SERVICE) \
--define kb_service_port=$(SERVICE_PORT) --define kb_service_dir=$(SERVICE_DIR) \
--define kb_sphinx_port=$(SPHINX_PORT) --define kb_sphinx_host=$(SPHINX_HOST) \
--define kb_starman_workers=$(STARMAN_WORKERS) \
--define kb_starman_max_requests=$(STARMAN_MAX_REQUESTS)
all: bin
bin: $(BIN_PERL) $(BIN_SERVICE_PERL)
deploy: deploy-all
deploy-all: deploy-client
deploy-client: deploy-libs deploy-scripts deploy-docs
deploy-service: deploy-libs deploy-scripts deploy-service-scripts deploy-specs
deploy-specs:
mkdir -p $(TARGET)/services/$(APP_SERVICE)
rsync -arv app_specs $(TARGET)/services/$(APP_SERVICE)/.
deploy-service-scripts:
export KB_TOP=$(TARGET); \
export KB_RUNTIME=$(DEPLOY_RUNTIME); \
export KB_PERL_PATH=$(TARGET)/lib ; \
for src in $(SRC_SERVICE_PERL) ; do \
basefile=`basename $$src`; \
base=`basename $$src .pl`; \
echo install $$src $$base ; \
cp $$src $(TARGET)/plbin ; \
$(WRAP_PERL_SCRIPT) "$(TARGET)/plbin/$$basefile" $(TARGET)/bin/$$base ; \
done
deploy-dir:
if [ ! -d $(SERVICE_DIR) ] ; then mkdir $(SERVICE_DIR) ; fi
if [ ! -d $(SERVICE_DIR)/bin ] ; then mkdir $(SERVICE_DIR)/bin ; fi
deploy-docs:
clean:
$(BIN_DIR)/%: service-scripts/%.pl $(TOP_DIR)/user-env.sh
$(WRAP_PERL_SCRIPT) '$$KB_TOP/modules/$(CURRENT_DIR)/$<' $@
$(BIN_DIR)/%: service-scripts/%.py $(TOP_DIR)/user-env.sh
$(WRAP_PYTHON_SCRIPT) '$$KB_TOP/modules/$(CURRENT_DIR)/$<' $@
include $(TOP_DIR)/tools/Makefile.common.rules