-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
53 lines (43 loc) · 1.48 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
##
## Makefile -- Build procedure for Trusterd HTTP/2 Web Server
## MATSUMOTO, Ryosuke
##
PWD=$(shell pwd)
TRUSTERD_ROOT=$(PWD)
MRUBY_ROOT=$(PWD)/mruby
INSTALL_PREFIX=$(TRUSTERD_ROOT)/build
# the default target
all: trusterd
# compile binary
trusterd:
git submodule init
git submodule update
cd $(MRUBY_ROOT) && cp -f ../build_config.rb . && make
cp -p $(MRUBY_ROOT)/bin/mruby $(TRUSTERD_ROOT)/bin/trusterd
mini-trusterd:
git submodule init
git submodule update
cd $(MRUBY_ROOT) && cp -f ../build_config.rb . && make
cd src/ && make
# test
test:
cd $(MRUBY_ROOT) && cp -f ../build_config.rb . && make test
# install
install:
install -d $(INSTALL_PREFIX)/bin $(INSTALL_PREFIX)/htdocs $(INSTALL_PREFIX)/ssl $(INSTALL_PREFIX)/conf $(INSTALL_PREFIX)/logs
install -m 755 $(TRUSTERD_ROOT)/bin/trusterd $(INSTALL_PREFIX)/bin/.
sed -e 's|root_dir = "/usr/local/trusterd"|root_dir = "$(INSTALL_PREFIX)"|' $(TRUSTERD_ROOT)/conf/trusterd.conf.rb > $(INSTALL_PREFIX)/conf/trusterd.conf.rb
echo hello trusterd world. > $(INSTALL_PREFIX)/htdocs/index.html
echo 'rputs JSON::stringify({:now => Time.now.to_s, :message => "hello world"})' > $(INSTALL_PREFIX)/htdocs/hello.rb
# cleanup
clean:
-rm -rf $(TRUSTERD_ROOT)/bin/trusterd
cd $(MRUBY_ROOT) && make clean
cd $(MRUBY_ROOT) && git checkout HEAD .
# the general trusterd start/restart/stop procedures
restart: stop start
start:
$(INSTALL_PREFIX)/bin/trusterd $(INSTALL_PREFIX)/conf/trusterd.conf.rb
stop:
killall trusterd
.PHONY: test