-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
213 lines (173 loc) · 5.36 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
.SUFFIXES: .js .css .html .msc .mscin .msgenny .svg .png .jpg
GIT=git
GIT_CURRENT_BRANCH=$(shell utl/get_current_git_branch.sh)
GIT_PRODUCTION_DEPLOYMENT_BRANCH=master
PNG2FAVICO=utl/png2favico.sh
RESIZE=utl/resize.sh
IOSRESIZE=utl/iosresize.sh
SEDVERSION=utl/sedversion.sh
NPM=npm
SASS=node_modules/.bin/sass --style compressed --no-source-map
ifeq ($(GIT_PRODUCTION_DEPLOYMENT_BRANCH), $(GIT_CURRENT_BRANCH))
BUILDDIR=dist
MODE=production
else
BUILDDIR=dist/$(GIT_CURRENT_BRANCH)
MODE=development
endif
GENERATED_STYLESHEETS=src/style/interp.css \
src/style/doc.css
GENERATED_SOURCES=$(GENERATED_STYLESHEETS)
REMOVABLEPRODDIRS=$(BUILDDIR)/style \
$(BUILDDIR)/fonts
PRODDIRS=$(BUILDDIR) \
$(REMOVABLEPRODDIRS)
FONTS=$(BUILDDIR)/fonts/controls.eot \
$(BUILDDIR)/fonts/controls.svg \
$(BUILDDIR)/fonts/controls.ttf \
$(BUILDDIR)/fonts/controls.woff
FAVICONMASTER=src/images/xu.png
FAVICONS=$(BUILDDIR)/favicon.ico \
$(BUILDDIR)/favicon-16.png \
$(BUILDDIR)/favicon-24.png \
$(BUILDDIR)/favicon-32.png \
$(BUILDDIR)/favicon-48.png \
$(BUILDDIR)/favicon-64.png \
$(BUILDDIR)/favicon-128.png \
$(BUILDDIR)/favicon-144.png \
$(BUILDDIR)/favicon-152.png \
$(BUILDDIR)/favicon-195.png \
$(BUILDDIR)/favicon-228.png \
$(BUILDDIR)/favicon-512.png \
$(BUILDDIR)/iosfavicon-57.png \
$(BUILDDIR)/iosfavicon-72.png \
$(BUILDDIR)/iosfavicon-114.png \
$(BUILDDIR)/iosfavicon-120.png \
$(BUILDDIR)/iosfavicon-144.png \
$(BUILDDIR)/iosfavicon-152.png \
$(BUILDDIR)/maskable_icon.png
.PHONY: help build deploy-gh-pages clean prerequisites
help:
@echo " --------------------------------------------------------"
@echo "| Just downloaded the mscgen_js sources? |"
@echo "| First run 'make prerequisites' |"
@echo " --------------------------------------------------------"
@echo
@echo "Most important build targets:"
@echo
@echo "build"
@echo " -> this is probably the target you want when"
@echo " hosting mscgen_js"
@echo
@echo " creates the production version (minified js, images,"
@echo " html)"
@echo
@echo "clean"
@echo " removes everything created by build
@echo
@echo "deploy-gh-pages"
@echo " deploys the build to gh-pages"
@echo " - 'master' branch: the root of gh-pages"
@echo " - other branches : in ./branche-name"
@echo
@echo " --------------------------------------------------------"
@echo "| More information and other targets: see wikum/build.md |"
@echo " --------------------------------------------------------"
@echo
# production rules
$(BUILDDIR)/%.html: src/%.html tracking.id tracking.host siteverification.id
$(SEDVERSION) < $< > $@
$(BUILDDIR)/%.xml: src/%.xml
cp $< $@
$(BUILDDIR)/robots.txt: src/robots.txt
cp $< $@
$(BUILDDIR)/%.json: src/%.json
cp $< $@
%.css: %.scss
$(SASS) $< $@
$(BUILDDIR)/style/%.css: src/style/%.css
cp $< $@
$(BUILDDIR)/fonts/%: src/fonts/%
cp $< $@
$(BUILDDIR)/favicon.ico: $(FAVICONMASTER)
$(PNG2FAVICO) $< $@
$(BUILDDIR)/favicon-%.png: $(FAVICONMASTER)
$(RESIZE) $< $@
$(BUILDDIR)/iosfavicon-%.png: $(FAVICONMASTER)
$(IOSRESIZE) $< $@
$(BUILDDIR)/maskable_icon.png: src/images/maskable_icon.png
cp $< $@
$(PRODDIRS):
mkdir -p $@
# dependencies
include src/dependencies.mk
# file targets prod
$(BUILDDIR)/index.html: $(PRODDIRS) \
src/index.html \
$(BUILDDIR)/style/interp.css \
$(BUILDDIR)/mscgen-interpreter.min.js \
$(BUILDDIR)/manifest.json \
$(BUILDDIR)/images/ \
$(BUILDDIR)/samples/ \
$(BUILDDIR)/sitemap.xml \
$(BUILDDIR)/robots.txt \
$(FAVICONS) \
$(FONTS)
LIVE_DOC_DEPS=$(PRODDIRS) \
$(BUILDDIR)/style/doc.css \
$(BUILDDIR)/mscgen-inpage.js \
$(BUILDDIR)/mscgen-inpage.js.map \
$(BUILDDIR)/images/ \
$(FAVICONS) \
$(FONTS)
$(BUILDDIR)/embed.html: $(LIVE_DOC_DEPS) src/embed.html
$(BUILDDIR)/tutorial.html: $(LIVE_DOC_DEPS) src/tutorial.html
siteverification.id:
@echo yoursiteverifactionidhere > $@
tracking.id:
@echo yourtrackingidhere > $@
tracking.host:
@echo auto > $@
$(BUILDDIR)/images/: src/images
cp -R $< $@
$(BUILDDIR)/samples/: src/samples
cp -R $< $@
# $(shell echo production)
$(BUILDDIR)/mscgen-interpreter.min.js:
npx webpack --output-path $(BUILDDIR) --mode $(MODE)
$(BUILDDIR)/mscgen-inpage.js: node_modules/mscgenjs-inpage/dist/mscgen-inpage.js
cp $< $@
$(BUILDDIR)/mscgen-inpage.js.map: node_modules/mscgenjs-inpage/dist/mscgen-inpage.js.map
cp $< $@
$(BUILDDIR)/script/mscgen-inpage.js: $(BUILDDIR)/mscgen-inpage.js
cp $< $@
$(BUILDDIR)/script/mscgen-inpage.js.map: $(BUILDDIR)/mscgen-inpage.js.map
cp $< $@
# "phony" targets
prerequisites:
$(NPM) install
build: $(BUILDDIR)/index.html $(BUILDDIR)/embed.html $(BUILDDIR)/tutorial.html
BUILDDIR=$(BUILDDIR) npx sw-precache --config .sw-precache-config.js
deploy-gh-pages: build
@echo Deploying build `utl/getver` to $(BUILDDIR)
$(GIT) -C $(BUILDDIR) add --all .
$(GIT) -C $(BUILDDIR) commit -m "build `utl/getver`"
$(GIT) -C $(BUILDDIR) push origin gh-pages
$(GIT) -C $(BUILDDIR) status
clean-the-build:
rm -rf $(REMOVABLEPRODDIRS) \
$(BUILDDIR)/images \
$(BUILDDIR)/samples \
$(BUILDDIR)/index.html \
$(BUILDDIR)/embed.html \
$(BUILDDIR)/tutorial.html \
$(BUILDDIR)/mscgen-inpage.js \
$(BUILDDIR)/mscgen-interpreter.min.js \
$(BUILDDIR)/mscgen-interpreter.min.js.map \
$(BUILDDIR)/manifest.json \
$(BUILDDIR)/service-worker.js \
rm -rf coverage
clean-generated-sources:
rm -rf $(GENERATED_SOURCES)
clean: clean-the-build clean-generated-sources
rm -rf $(FAVICONS)