Skip to content

Commit 44a0956

Browse files
committed
build: Example build scripts
1 parent adf782e commit 44a0956

File tree

6 files changed

+62
-0
lines changed

6 files changed

+62
-0
lines changed

build/Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
JS := $(wildcard ../layer/*/*.js ../layer/*.js ../control/*js)
2+
#JS += control/Scale.js control/Distance.js
3+
#JS += control/Permalink.js $(wildcard control/Permalink.*.js)
4+
JS := $(shell python ./deps.py $(JS))
5+
6+
#JS_EXTRA := $(JS) $(wildcard layer/*.js)
7+
all: compiled.yui.js compiled.closure.js
8+
9+
compile: $(patsubst %,compiled/%,$(JS))
10+
11+
closure/%: ../%
12+
mkdir -p $(dir $@)
13+
java -jar /tmp/closure.jar --compilation_level ADVANCED_OPTIMIZATIONS --charset UTF-8 --js $< --js_output_file $@.tmp
14+
mv $@.tmp $@
15+
16+
yui/%: ../%
17+
mkdir -p $(dir $@)
18+
yui-compressor --charset UTF-8 -o $@.tmp $<
19+
mv $@.tmp $@
20+
21+
compiled.yui.js: $(patsubst ../%,yui/%,$(JS))
22+
compiled.closure.js: $(patsubst ../%,closure/%,$(JS))
23+
24+
compiled.%.js:
25+
for f in $^; do cat $$f >> $@.tmp; echo >> $@.tmp; done
26+
mv $@.tmp $@
27+
28+
.PHONY: all compile

build/deps.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
# vim: sts=4 sw=4 et
3+
4+
import os, sys
5+
6+
printed = set()
7+
8+
def includes(f):
9+
d = os.path.dirname(f)
10+
for l in open(f):
11+
if l.startswith('//#include'):
12+
yield os.path.join(d, l.strip().split(None, 1)[1].strip(""""'"""))
13+
14+
work = list(sys.argv[1:])
15+
16+
while work:
17+
f = work.pop(0)
18+
if f in printed:
19+
continue
20+
i = list(filter(lambda x: x not in printed, includes(f)))
21+
if i:
22+
work = i + [f] + work
23+
continue
24+
printed.add(f)
25+
print f
26+

control/Permalink.Layer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//#include "Permalink.js
2+
13
L.Control.Permalink.include({
24
/*
35
options: {

control/Permalink.Line.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//#include "Permalink.js
2+
13
L.Control.Permalink.include({
24
/*
35
options: {

control/Permalink.Marker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//#include "Permalink.js
2+
13
L.Control.Permalink.include({
24
/*
35
options: {

layer/vector/GPX.Speed.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//#include "GPX.js"
2+
13
(function() {
24

35
function d2h(d) {

0 commit comments

Comments
 (0)