forked from perf101/rage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OMakefile
42 lines (34 loc) · 1.09 KB
/
OMakefile
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
SHELL=/bin/bash
SRC=src
PROGRAM=rage
CONFIG=/usr/groups/perfeng/rage/config
RAGE_DB=$(shell grep "^rage_db=" $(CONFIG) | awk -F '=' '{print $$2}')
RAGE_HOST=$(shell grep "^rage_host=" $(CONFIG) | awk -F '=' '{print $$2}')
RAGE_USER=$(shell grep "^rage_user=" $(CONFIG) | awk -F '=' '{print $$2}')
RAGE_PASS=$(shell grep "^rage_pass=" $(CONFIG) | awk -F '=' '{print $$2}')
SETTINGS="host=$(RAGE_HOST) user=$(RAGE_USER) password=$(RAGE_PASS) dbname=$(RAGE_DB)"
RUN_CMD=OCAMLRUNPARAM='b1' ./$(PROGRAM) "$(SETTINGS)"
WWW_DIR=/var/www
CGI_SCRIPT=index.cgi
STATIC_DIR=static
README=README.markdown
DISTRO_DIR=distro
MODE=775
INSTALL=install -m $(MODE)
.PHONY: readme build distro run install log clean
.DEFAULT: build
.SUBDIRS: $(SRC)
distro: build
rsync -avpL $(STATIC_DIR)/ $(SRC)/$(PROGRAM) $(DISTRO_DIR)
printf '#!/bin/bash\n\n$(RUN_CMD)' > $(DISTRO_DIR)/$(CGI_SCRIPT)
chmod $(MODE) $(DISTRO_DIR)/$(CGI_SCRIPT)
run: distro
$(DISTRO_DIR)/$(RUN_CMD)
install: distro
cp $(DISTRO_DIR)/* $(WWW_DIR)
clean:
rm -rf $(DISTRO_DIR) *.omc
readme:
markdown $(README)
log:
sudo tail -F /var/log/apache2/error.log