-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
51 lines (40 loc) · 1.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
INTERMEDIATE_DIR := ./intermediates
BUILD_DIR := ./build
IMG_DIR := ./img
STAGE_DIR := ./staged
VISUALIZE_JS := $(BUILD_DIR)/visualize.min.js
TS_SRCS := $(shell echo ts/*.ts)
JS_SRCS := $(patsubst ts/%.ts,$(INTERMEDIATE_DIR)/%.js,$(TS_SRCS))
HTML_SRCS := html/index.html html/tutorial.html
CSS := css
.PHONY: default
default: stage
.PHONY: lint
lint: $(JS_SRCS) | $(BUILD_DIR)
uglifyjs --lint --output $(VISUALIZE_JS) $^
# Hack to ensure just a single invocation of tsc
.INTERMEDIATE: hack_js.intermediate | $(INTERMEDIATE_DIR)
hack_js.intermediate: $(TS_SRCS)
tsc --outDir $(INTERMEDIATE_DIR) $^
$(JS_SRCS): hack_js.intermediate
$(VISUALIZE_JS): $(JS_SRCS) | $(BUILD_DIR)
uglifyjs --compress --mangle --output $@ $^
$(INTERMEDIATE_DIR) $(BUILD_DIR):
mkdir -p $@
prerequisites:
@echo "npm install -g typescript"
@echo "npm install -g uglify-js"
.PHONY: stage
stage: $(VISUALIZE_JS) $(HTML_SRCS)
rm -Rf $(STAGE_DIR)
mkdir -p $(STAGE_DIR)
cp $(HTML_SRCS) $(STAGE_DIR)
cp -r $(IMG_DIR) $(CSS) $(STAGE_DIR)
mkdir $(STAGE_DIR)/js/
cp $(VISUALIZE_JS) ./external_js/*.min.js $(STAGE_DIR)/js/
.PHONY: deploy
deploy: stage
rsync -avze ssh --prune-empty-dirs $(STAGE_DIR)/ ridiculousfish.com:/home/pammon/webapps/main/wavefiz
.PHONY: clean
clean:
rm -rf $(INTERMEDIATE_DIR) $(BUILD_DIR) $(STAGE_DIR)