-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
35 lines (24 loc) · 1.16 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
ALL = src/rhs.js web/bracery.js web/bracery.min.js
NODE_MOD = node_modules
PEGJS = $(NODE_MOD)/.bin/pegjs
BROWSERIFY = $(NODE_MOD)/browserify/bin/cmd.js
UGLIFYJS = $(NODE_MOD)/uglify-js/bin/uglifyjs
all: $(ALL)
postinstall: all
clean:
rm $(ALL)
src/rhs.js: src/rhs.defs.js src/rhs.peg.js
(echo "{"; cat src/rhs.defs.js; echo "}"; cat src/rhs.peg.js) | $(PEGJS) >$@
src/shim.js:
echo "window.bracery = require('./bracery');" >$@
web/bracery.nocompromise.js: src/shim.js src/bracery.js src/parsetree.js src/rhs.js src/chomsky.js src/template.js
$(BROWSERIFY) src/shim.js >$@
web/bracery.js: web/bracery.nocompromise.js
cat $(NODE_MOD)/compromise/builds/compromise.es6.js >$@
cat $< >>$@
web/bracery.min.js: web/bracery.nocompromise.js
cat $(NODE_MOD)/compromise/builds/compromise.es6.min.js >$@
cat $< >>$@
%.md:
node -e 'var n = 0;console.log (fs.readFileSync("$@").toString().replace(/(~~~~\n)([^~]+)(\n~~~~\n\n<\!--DEMO-->).*/g,function(_m,b,c,e){return b+c+e+" <em> <a style=\"float:right;\" href=\"https://bracery.org/guest/readme_example"+(++n)+"?demo=true&reset=true&enableParse=true&eval="+encodeURIComponent(c)+"\">Try this</a> </em>"}))' >$@.tmp
mv $@.tmp $@