forked from audreyt/ethercalc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (60 loc) · 2.15 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
ETHERCALC_FILES=\
third-party/class-js/lib/Class.js \
third-party/wikiwyg/lib/Document/Emitter.js \
third-party/wikiwyg/lib/Document/Emitter/HTML.js \
third-party/wikiwyg/lib/Document/Parser.js \
third-party/wikiwyg/lib/Document/Parser/Wikitext.js \
static/jquery.js \
static/vex.combined.min.js
LS_FILES=$(wildcard src/*.ls)
JS_FILES=$(LS_FILES:src/%.ls=%.js)
ifneq ("$(wildcard static/jquery-ui.min.js)","")
ETHERCALC_FILES += static/jquery-ui.min.js
endif
UGLIFYJS_ARGS = -c -m
ifdef DEBUG
UGLIFYJS_ARGS += -b
endif
run: all
node app.js --cors $(ETHERCALC_ARGS)
vm: all
node app.js --vm $(ETHERCALC_ARGS)
expire: all
node app.js --expire 10 $(ETHERCALC_ARGS)
all: depends $(JS_FILES)
$(JS_FILES): %.js: src/%.ls
env PATH="$$PATH:./node_modules/livescript/bin" lsc -c -o . $<
manifest ::
perl -pi -e 's/# [A-Z].*\n/# @{[`date`]}/m' manifest.appcache
./node_modules/streamline/bin/_node \
./node_modules/uglify-js/bin/uglifyjs :
npm i --dev
static/multi.js :: multi/main.ls multi/styles.styl
webpack --optimize-minimize
depends: app.js static/ethercalc.js static/start.css static/multi.js
node_modules/socialcalc/dist/SocialCalc.js: ./node_modules/streamline/bin/_node
@-mkdir -p node_modules/socialcalc/dist
cp node_modules/socialcalc/SocialCalc.js node_modules/socialcalc/dist/SocialCalc.js || true
static/ethercalc.js: $(ETHERCALC_FILES) \
./node_modules/socialcalc/dist/SocialCalc.js \
./node_modules/uglify-js/bin/uglifyjs
@-mkdir -p .git
@echo '// Auto-generated from "make depends"; ALL CHANGES HERE WILL BE LOST!' > $@
node node_modules/uglify-js/bin/uglifyjs node_modules/socialcalc/dist/SocialCalc.js $(ETHERCALC_FILES) $(UGLIFYJS_ARGS) --source-map ethercalc.js.map --source-map-include-sources >> $@
mv ethercalc.js.map static
COFFEE := $(shell command -v coffee 2> /dev/null)
.coffee.js:
ifndef COFFEE
$(error "coffee is not available please install sass")
endif
coffee -c $<
SASS := $(shell command -v sass 2> /dev/null)
.sass.css:
ifndef SASS
$(error "sass is not available please install sass")
endif
sass -t compressed $< > $@
clean ::
@-rm $(JS_FILES)
.SUFFIXES: .js .css .sass .ls
.PHONY: run vm expire all clean depends