This repository has been archived by the owner on Feb 22, 2022. It is now read-only.
/
Makefile
61 lines (47 loc) · 1.61 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
RHINO ?= js
JSLINT ?= ../jslint.js
JAVA ?= java
YUICOMP ?= ../yuicompressor.jar
HTMLCOMP ?= ../htmlcompressor.jar
OGGENC ?= oggenc
JSFILES := $(shell find src -iname '*.js' | grep -v '.lint.js')
WAVFILES := $(shell find snd -iname '*.wav')
OGGFILES := $(WAVFILES:%.wav=%.ogg)
DISTSOUNDS := $(WAVFILES:snd/%=dist/snd/%) $(OGGFILES:snd/%=dist/snd/%)
usage:
@echo "The following make targets are defined:"
@echo " dist: Create compressed JavaScript and CSS."
@echo " lint: Run JSLint on all JavaScript source files."
@echo " clean: Remove any files created by the above."
dist: dist/arashi.html dist/arashi.js dist/arashi.css ${DISTSOUNDS}
clean:
-rm -f dist/arashi.html dist/arashi.js dist/arashi.css ${DISTSOUNDS}
-find src -iname '*.lint.js' | xargs rm -f
lint:
for i in ${JSFILES}; do \
echo "Linting $$i..."; \
cat util/lint.head.js $$i > $$i.lint.js; \
${RHINO} ${JSLINT} $$i.lint.js; \
rm -fr $$i.lint.js; \
echo; \
done
dist/arashi.html: arashi.html
sed arashi.html \
-e '/script src="src\//d' \
-e 's/<\/head>/<script src="arashi.js"><\/script><\/head>/' \
-e 's/jquery\.js/jquery.min.js/' \
| ${JAVA} -jar ${HTMLCOMP} \
--compress-js --compress-css \
--remove-intertag-spaces --remove-quotes \
> dist/arashi.html
dist/arashi.js: ${JSFILES} util/dist.head.js
cat util/dist.head.js ${JSFILES} \
| ${JAVA} -jar ${YUICOMP} --type js \
> dist/arashi.js
dist/arashi.css: arashi.css
${JAVA} -jar ${YUICOMP} --type css -o dist/arashi.css arashi.css
dist/snd/%.wav: snd/%.wav
cp $< $@
dist/snd/%.ogg: dist/snd/%.wav
${OGGENC} -o $@ -Q $<
.PHONY: usage dist clean lint