This repository has been archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (63 loc) · 1.94 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
SRC=src
RAW=build/raw
MIN=build/min
test: node_modules/requirejs node_modules/buster build/min/jso/Schema.js
nodejs ./test/test.js
nodejs ./test/examples.js
$(RAW)/jquery.jsoSchema.js: $(SRC)/jsoSchema.js
mkdir -p $(dir $@)
echo "(function (jQuery) { " > $@
cat $< >> $@
echo >> $@
cat build/export-from-advanced-compile.js >> $@
echo "jQuery.fn['jsoSchema'] = jsoSchema;" >> $@
echo "})(jQuery);" >> $@
$(RAW)/jso/Schema.js: $(SRC)/jsoSchema.js
mkdir -p $(dir $@)
echo "define([ ], function () { " > $@
cat $< >> $@
echo >> $@
cat build/export-from-advanced-compile.js >> $@
echo "return jsoSchema;" >> $@
echo "});" >> $@
.PHONY: test
node_modules/%:
npm install $(notdir $@)
build/compiler.jar:
mkdir -p build
wget "http://dl.google.com/closure-compiler/compiler-latest.zip" -O build/compiler-latest.zip
(cd build && unzip compiler-latest.zip compiler.jar && rm compiler-latest.zip)
define js_compile
java -jar build/compiler.jar \
--externs build/externs.js \
--compilation_level ADVANCED_OPTIMIZATIONS \
--warning_level=VERBOSE \
--property_map_output_file $(patsubst %.js,%.property-map,$<) \
--create_source_map $(patsubst %.js,%.source-map,$<) \
--js $(SRC)/jsoSchema_types.js \
--js $< --js_output_file $@ 2>&1
endef
$(MIN)/jso/Schema.js: build/raw/jso/Schema.js build/compiler.jar
mkdir -p $(dir $@)
$(js_compile)
$(MIN)/jquery.jsoSchema.js: build/raw/jquery.jsoSchema.js build/compiler.jar
mkdir -p $(dir $@)
$(js_compile)
compile: $(MIN)/jso/Schema.js $(MIN)/jquery.jsoSchema.js
clean:
rm -rf build/min build/raw build/README.html
distclean:
rm -rf node_modules build
git checkout build
release:
git checkout -b $(VERSION)
make distclean
make compile
find build/min build/raw -name "*.js" -print0 | xargs -0 git add -f
echo $(VERSION) > ./VERSION
git add VERSION
make test
build/README.html: README.asciidoc
mkdir -p $(dir $@)
asciidoc -o $@ README.asciidoc
doc: build/README.html