-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (44 loc) · 1.37 KB
/
Makefile
File metadata and controls
64 lines (44 loc) · 1.37 KB
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
DIST = ./dist
ELM_ENTRYPOINT = ./src/Main.elm
MAIN_JS = main.js
MAIN_MIN_JS = main.min.js
# my servers - use your own
SERVER = damjan.softver.org.mk:public_html/elm-wip/
COUCHDB = https://db.softver.org.mk/irclog
ELM_FILES = $(shell find src/ -type f -name '*.elm')
CSS_FILES = $(shell find css/ -type f -name '*.css')
IMG_FILES = $(shell find img/ -type f -name '*.png')
CSS_DIST = $(addprefix $(DIST)/,$(CSS_FILES))
CSS_DIST_GZ = $(addsuffix .gz,$(CSS_DIST))
IMG_DIST = $(addprefix $(DIST)/,$(IMG_FILES))
default:
@echo "make build|clean|publish"
$(DIST)/$(MAIN_JS): $(ELM_FILES)
@mkdir -p $(dir $@)
elm-make --yes $(ELM_ENTRYPOINT) --output $@
$(DIST)/$(MAIN_MIN_JS): $(DIST)/$(MAIN_JS)
uglifyjs $< -o $@
compile: $(DIST)/$(MAIN_JS)
# poor mans templating
TRAVIS_COMMIT ?= $(shell date -r $(DIST)/$(MAIN_JS) +%s)
$(DIST)/index.html: index.html $(DIST)/$(MAIN_JS)
@mkdir -p $(dir $@)
sed 's#/_compile/src/Main.elm#'$(MAIN_MIN_JS)?$(TRAVIS_COMMIT)'#' $< > $@
$(DIST)/css/%.css: css/%.css
@mkdir -p $(dir $@)
cp -a $< $@
$(DIST)/img/%: img/%
@mkdir -p $(dir $@)
cp -a $< $@
build: $(IMG_DIST) $(CSS_DIST) $(CSS_DIST_GZ) $(DIST)/$(MAIN_MIN_JS).gz $(DIST)/index.html
clean:
rm -rf $(DIST)
clean-deps:
rm -rf elm-stuff
publish: build
couchapp push couch/ $(COUCHDB)
rsync: build
rsync -av $(DIST)/ $(SERVER)
%.gz : %
gzip -9fk $<
.PHONY: clean clean-deps publish default