-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
96 lines (73 loc) · 2.76 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
continents = africa antarctica asia australasia europe \
northamerica southamerica etcetera backward
zone_sources = $(continents:%=eggert/tz/%)
olson_as_json = $(continents:%=build/olson/%.js)
root_sources = package.json README.md CHANGELOG
src_sources = synopsis.js rfc822.js loaded.js .npmignore
locale_sources = $(wildcard src/locales/*.js)
root_targets = $(root_sources:%=build/timezone/%)
src_targets = $(src_sources:%=build/timezone/%)
locale_targets = $(locale_sources:src/locales/%=build/timezone/%)
# GNU `make` will build and rebuild `build/Makefile.deps` when it is out of
# date. See the **The GNU `make include` Directive** section of [Advanced
# Auto-Dependency Generation](http://make.paulandlesley.org/autodep.html) for
# details.
-include build/Makefile.deps
zoneinfo_files = $(timezones:%=build/zoneinfo/%)
olson = $(olson_as_json:build/olson/%.js=eggert/tz/%)
all: $(root_targets) $(src_targets) $(locale_targets) \
build/timezone/index.js \
build/timezone/locales.js build/timezone/zones.js \
build/timezone/America/Detroit.js \
$(zoneinfo_files) \
build/transitions.txt
zic: eggert/tz/zic
$(locale_targets): build/timezone/%: src/locales/%
mkdir -p build/timezone
cp $< $@
build/timezone/zones.js: util/indexer.js build/timezone/America/Detroit.js
node util/indexer.js $@ > $@
build/timezone/locales.js: util/indexer.js build/timezone/America/Detroit.js
node util/indexer.js $@ > $@
build/olson/index.js: util/indexer.js $(olson_as_json)
node util/indexer.js $@ > $@
build/transitions.txt: $(olson_as_json) build/olson/index.js util/verifiable.js
node util/verifiable.js > build/transitions.txt
touch $@
build/timezone/America/Detroit.js: $(olson_as_json) build/olson/index.js util/zones.js
node util/zones.js
for dir in $$(find build/timezone -mindepth 1 -type d); do \
node util/indexer.js $$dir/index.js > $$dir/index.js; \
done
touch $@
eggert/tz/zic:
make -C eggert/tz -f Makefile
$(zoneinfo_files): $(zone_sources)
mkdir -p build
@(cd eggert/tz && echo "Using zic: $$(which ./zic || which zic)")
(cd eggert/tz && $$(which ./zic || which zic) -d ../../build/zoneinfo $(continents))
build/olson/%.js: eggert/tz/%
mkdir -p build/olson
node util/tz2json.js $< > $@
touch $@
build/timezone/index.js: src/timezone.js
mkdir -p build/timezone
cp $< $@
$(src_targets): build/timezone/%: src/%
mkdir -p build/timezone
cp $< $@
$(root_targets): build/timezone/%: %
mkdir -p build/timezone
cp $< $@
clean:
rm -rf build
make -C eggert/tz -f Makefile clean
build/Makefile.deps: $(zone_sources)
mkdir -p build
node util/tz2deps.js $^ > $@
publish:
make zic && make
find . -depth \( -name .AppleDouble -o -name .DS_Store \) -exec rm -rf {} \;
find . \( -name .AppleDouble -o -name .DS_Store \) ;
(cd build/timezone && npm publish)
.PHONEY: publish