-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
66 lines (49 loc) · 1.9 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
SERVER_SRC_FILES=$(shell find src/server -name "*.cljs")
CLIENT_SRC_FILES=$(shell find src/client -name "*.cljs")
CLOJURESCRIPT_HOME=./clojurescript
SERVER_FILES=src/server/
CLIENT_FILES=src/client/
CLJSC_CP=lib/*:
DEPLOY_USER=root
DEPLOY_HOST=172.16.0.4
DEPLOY_PATH=/opt
RELEASE_NAME=vmwebadm
RELEASE_VERSION=0.4.4
all: out/server/server.js out/client/client.js
$(CLOJURESCRIPT_HOME)/bin/cljsc:
git submodule init
git submodule update
cd clojurescript/ && ./script/bootstrap
cp lib/* clojurescript/lib/
clean: clean-server clean-client clean-release clean-zip
clean-server:
-rm -r out/server/*
clean-client:
-rm -r out/client/*
run: all
node out/server/server.js
out/server/server.js: $(SERVER_SRC_FILES) $(CLOJURESCRIPT_HOME)/bin/cljsc
$(CLOJURESCRIPT_HOME)/bin/cljsc $(SERVER_FILES) \
'{:optimizations :simple :pretty-print true :target :nodejs :output-dir "out/server" :output-to "out/server/server.js"}'
out/client/client.js: $(CLIENT_SRC_FILES) $(CLOJURESCRIPT_HOME)/bin/cljsc
$(CLOJURESCRIPT_HOME)/bin/cljsc $(CLIENT_FILES) \
'{:optimizations :simple :pretty-print true :target :nodejs :output-dir "out/client" :output-to "out/client/client.js"}'
deploy: rel all
scp -r $(RELEASE_NAME) $(DEPLOY_USER)@$(DEPLOY_HOST):$(DEPLOY_PATH)
clean-release:
-rm -rf $(RELEASE_NAME)
clean-zip:
-rm vmwebadm.zip
release_pre:
mkdir -p $(RELEASE_NAME)/js
fix_path:
sed -i $(RELEASE_NAME)/data/vmwebadmd.xml -e 's;!DEPLOY_PATH!;$(DEPLOY_PATH)/$(RELEASE_NAME);g'
sed -i $(RELEASE_NAME)/vmwebadm -e 's;!DEPLOY_PATH!;$(DEPLOY_PATH)/$(RELEASE_NAME);g'
sed -i $(RELEASE_NAME)/vmwebadmd -e 's;!DEPLOY_PATH!;$(DEPLOY_PATH)/$(RELEASE_NAME);g'
release_main:
cp out/client/client.js out/server/server.js $(RELEASE_NAME)/js
cp -r static/* jslib $(RELEASE_NAME)
-find $(RELEASE_NAME) -name "*~" -delete
rel: clean-release all release_pre release_main fix_path
tar: rel
tar cvzf vmwebadm-$(RELEASE_VERSION).tar.bz2 vmwebadm