forked from whatwg/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (50 loc) · 1.84 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
SHELL=/bin/bash -o pipefail
spec = console
targetfolder = $(spec).spec.whatwg.org
server = $(spec).spec.whatwg.org
# find all bikeshed files and create a target for them
# ./index.bs gets console.spec.whatwg.org/index.html
markupfiles := $(shell find . -name '*.bs' \
| sed 's|.bs|.html|g' \
| sed 's|./|$(targetfolder)/|g')
# and build after a clean
all: clean $(markupfiles) $(targetfolder)/images
# rule matches our target files from markupfiles:
# $(targetfolder)/%.html matches all html file in the targetfolder
# $@ in the rule gets the target files from markupfiles
# i.e. if markupfiles contains bla/foo.html and bla/index.html it gets:
# bla/index.html and bla/foo.html
# the magic var @D is the directory part of our matching rule.
# @$ is basically what is matched in the % of the %.html
$(targetfolder)/%.html:
@[ -d $(@D) ] || mkdir -p $(@D) # create dir if it does not exist
@curl -f -s https://api.csswg.org/bikeshed/ -F file=@$*.bs \
| node_modules/.bin/emu-algify > $@
# copy images
$(targetfolder)/images:
$(shell cp -R images $(targetfolder)/)
# cleaning up
clean:
@rm -rf $(targetfolder)
# deployment
ifneq ($(TRAVIS_BRANCH),master)
deploy:
@echo "Not on master branch; skipping deploy"
else ifneq ($(TRAVIS_PULL_REQUEST),false)
deploy:
@echo "Building a pull request; skipping deploy"
else
deploy: clean all upload
@echo "Living standard output to $(targetfolder)"
@echo ""
@find $(targetfolder) -print
@echo ""
endif
# upload to server
upload:
@openssl aes-256-cbc -K $(encrypted_b9b018a1d67d_key) -iv $(encrypted_b9b018a1d67d_iv) -in console_spec_id_rsa.enc -out console_spec_id_rsa -d
@chmod 600 console_spec_id_rsa
@scp -r -i console_spec_id_rsa $(targetfolder) $(DEPLOY_USER)@$(server):
# don't confuse make given we have files called "clean" "upload"
# "deploy" or "all" in our root dir
.PHONY: clean upload deploy all