-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
91 lines (74 loc) · 2.65 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
TOP_DIR = ../..
include $(TOP_DIR)/tools/Makefile.common
DEPLOY_RUNTIME ?= /kb/runtime
TARGET ?= /kb/deployment
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-dir:
if [ ! -d $(SERVICE_DIR) ] ; then mkdir $(SERVICE_DIR) ; fi
if [ ! -d $(SERVICE_DIR)/webroot ] ; then mkdir $(SERVICE_DIR)/webroot ; fi
if [ ! -d $(SERVICE_DIR)/bin ] ; then mkdir $(SERVICE_DIR)/bin ; fi
if [ ! -d $(SERVICE_DIR)/sphinx ] ; then mkdir $(SERVICE_DIR)/sphinx ; fi
deploy-docs:
test: test-client
echo "running client and script tests"
# What does it mean to test a client. This is a test of a client
# library. If it is a client-server module, then it should be
# run against a running server. You can say that this also tests
# the server, and I agree. You can add a test-server dependancy
# to the test-client target if it makes sense to you. This test
# example assumes there is already a tested running server.
test-client:
# run each client test
for t in $(CLIENT_TESTS) ; do \
if [ -f $$t ] ; then \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
test-server:
# run each server test
for t in $(SERVER_TESTS) ; do \
if [ -f $$t ] ; then \
echo Running $$t ; \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
test-prod-server:
# run each prod test
for t in $(PROD_TESTS) ; do \
if [ -f $$t ] ; then \
echo Running $$t ; \
$(DEPLOY_RUNTIME)/bin/perl $$t ; \
if [ $$? -ne 0 ] ; then \
exit 1 ; \
fi \
fi \
done
clean:
ant clean
include $(TOP_DIR)/tools/Makefile.common.rules