-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathGNUmakefile
50 lines (36 loc) · 1.34 KB
/
GNUmakefile
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
VERSION = $(shell jq -r .version package.json)
BASENAME = urlize-js-$(VERSION)
DEST = dist/$(BASENAME)
release: $(DEST).tar.gz $(DEST).zip
dist/$(BASENAME).tar.gz: dist/$(BASENAME)
tar -C dist -cvzf $@ $(BASENAME)
dist/$(BASENAME).zip: dist/$(BASENAME)
(cd dist; zip -r $(BASENAME).zip $(BASENAME))
SOURCES = urlize.js README.md LICENSE test_urlize.js
$(DEST): urlize.min.js urlize_tlds.js $(SOURCES)
test ! -e $(DEST)
test ! -e $(DEST).tmp
mkdir -p $(DEST).tmp
cp $+ $(DEST).tmp/
rm -rf $(DEST)
mv $(DEST).tmp $(DEST)
maintainer-clean:
rm -f urlize.min.js urlize_tlds.js README.html root.zone
rm -rf dist
ALL = urlize.min.js README.html urlize_tlds.js
all: $(ALL)
%.min.js: %.js
./node_modules/uglify-js/bin/uglifyjs $< > [email protected] && mv [email protected] $@ || rm -f $@
TLD_PREFIX = (function (r, f){if(typeof define=='function'\&\&define.amd){define('urlize_tlds',['urlize'],f)}else if(typeof exports=='object'){module.exports = f(require('.\/urlize'))}else{f(r.urlize)}}(this,function(urlize){urlize.top_level_domains=[
urlize_tlds.js: root.zone
grep 'IN NS ' root.zone | \
cut -f1 | sort -u | \
sed -e "s/^/'/" -e "s/\.$$/',/" | \
tr -d '\n' | \
sed -e "s/^'',/$(TLD_PREFIX)/" -e "s/,$$/\];return urlize}))/" > [email protected]
mv [email protected] $@
root.zone:
curl -O http://www.internic.net/domain/root.zone
README.html: README.md
md2html $< > [email protected]
mv [email protected] $@