-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathMakefile
49 lines (35 loc) · 1.24 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
# Makefile Usage
# make lint -- linting
# make uglify -- compile minified source file
# make tarball -- create dfb.tar.gz file suitable for deployment as a website
source_map :=
# Name of minified output file
dfbjs := js/dfb.min.js
minified := js/utils.min.js js/worker.min.js
# locations of javascript source files
# manual dependency tracking, because node-style require is for another day
src_before := src/view.js src/metadata.js src/bib.js
src_after := src/dfb.js
src_skip := src/utils.js src/worker.js
src := $(wildcard src/*.js src/*/*.js)
src := $(filter-out $(min_js) $(src_skip) $(src_before) $(src_after),$(src))
src := $(src_before) $(src) $(src_after)
css := $(wildcard css/*.css)
lib := $(wildcard lib/*)
dfb_files := index.html $(dfbjs) $(minified) \
$(css) $(lib) fonts/
lint:
jslint --regexp --todo --white --browser --bitwise --unparam \
$(src) $(src_skip)
uglify: $(dfbjs) $(minified)
$(minified): js/%.min.js: src/%.js
uglifyjs $< $(if $(source_map),--source-map [email protected]) --mangle -o $@
$(dfbjs): $(src)
uglifyjs $(src) $(if $(source_map),--source-map [email protected]) \
--mangle -o $@
dfb.tar.gz: $(dfb_files)
rm -f $@
tar -cvzf $@ $(dfb_files) data/*
tarball: dfb.tar.gz
.DEFAULT_GOAL := uglify
.PHONY: lint uglify tarball