-
Notifications
You must be signed in to change notification settings - Fork 70
/
Makefile
43 lines (39 loc) · 1.44 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
REPO = [email protected]:brendandahl/pdf.js.utils.git
BUILD_DIR = build
BASE_VERSION = ec7ead2b5a0fa898151d7c67b4f0f281a62e4a70
BUILD_NUMBER = git log --format=oneline $(BASE_VERSION).. | wc -l | awk '{print $$1}'
GIT_STATUS = git status --porcelain
# make web
#
# This target produces the website for the project, by checking out
# the gh-pages branch underneath the build directory, and then move
# the various viewer files into place.
GH_PAGES = $(BUILD_DIR)/gh-pages
web: | pages-repo
@test -z "`$(GIT_STATUS) 2>&1`" || { echo; echo "Your working tree is not clean" 1>&2; $(GIT_STATUS); exit 1; }
@cp -R browser/* $(GH_PAGES)/browser
@cp -R maker/* $(GH_PAGES)/maker
@cp -R xfa/* $(GH_PAGES)/xfa
@cd $(GH_PAGES); git add -A; git commit -m "Build `$(BUILD_NUMBER)`."
@echo
@echo "Website built in $(GH_PAGES)."
@echo "Don't forget to cd into $(GH_PAGES)/ and git push."
# make pages-repo
#
# This target clones the gh-pages repo into the build directory. It
# deletes the current contents of the repo, since we overwrite
# everything with data from the master repo. The 'make web' target
# then uses 'git add -A' to track additions, modifications, moves,
# and deletions.
pages-repo: | $(BUILD_DIR)
@if [ ! -d "$(GH_PAGES)" ]; then \
git clone -b gh-pages $(REPO) $(GH_PAGES); \
rm -rf $(GH_PAGES)/*; \
fi;
@mkdir -p $(GH_PAGES)/browser;
@mkdir -p $(GH_PAGES)/maker;
@mkdir -p $(GH_PAGES)/xfa;
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
clean:
rm -rf $(BUILD_DIR)