1 |
3793
|
aaronmk
|
include ../lib/common.Makefile
|
2 |
|
|
|
3 |
|
|
|
4 |
785
|
aaronmk
|
##### Vars/functions
|
5 |
|
|
|
6 |
1272
|
aaronmk
|
# Paths
|
7 |
895
|
aaronmk
|
bin := ../bin
|
8 |
6845
|
aaronmk
|
inputCoreMaps := Veg+-VegCore.csv VegCore-VegBIEN.csv VegX-VegCore.csv
|
9 |
5065
|
aaronmk
|
vocab := VegCore.csv
|
10 |
|
|
dict := Veg+-VegCore.csv
|
11 |
895
|
aaronmk
|
|
12 |
785
|
aaronmk
|
##### General targets
|
13 |
|
|
|
14 |
6851
|
aaronmk
|
all: _always VegCore.csv VegCore.tables.redmine $(inputCoreMaps) ;
|
15 |
150
|
aaronmk
|
|
16 |
383
|
aaronmk
|
clean: _always
|
17 |
196
|
aaronmk
|
$(RM) $(all)
|
18 |
188
|
aaronmk
|
|
19 |
924
|
aaronmk
|
all :=
|
20 |
|
|
|
21 |
6845
|
aaronmk
|
##### Core maps
|
22 |
198
|
aaronmk
|
|
23 |
6845
|
aaronmk
|
VegCore.htm:
|
24 |
|
|
php -r 'fpassthru(fopen("https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore", "r"));' >$@
|
25 |
|
|
|
26 |
7040
|
aaronmk
|
VegCore.csv: VegCore.htm
|
27 |
|
|
(echo VegCore; $(sed) -n 's/^.*<a name="([a-z][^"]*|[A-Z]+)">.*$$/\1/p')\
|
28 |
|
|
<$< >$@
|
29 |
6845
|
aaronmk
|
|
30 |
7432
|
aaronmk
|
#Veg+-VegCore.csv: VegCore.htm
|
31 |
7446
|
aaronmk
|
# (echo "Veg+,VegCore"; $(bin)/redmine_synonyms|$(bin)/collapse_multimap)\
|
32 |
|
|
#<$< >$@
|
33 |
7453
|
aaronmk
|
# $(bin)/in_place $@ $(bin)/translate 1 $(dict)
|
34 |
7432
|
aaronmk
|
|
35 |
6849
|
aaronmk
|
VegCore.tables.csv: VegCore.htm
|
36 |
7438
|
aaronmk
|
<$< $(sed) -n 's/^.*<h1 *><a href="#[^>]+>([^?<][^<]*).*$$/\1/p' >$@
|
37 |
6849
|
aaronmk
|
|
38 |
6851
|
aaronmk
|
VegCore.tables.redmine: VegCore.tables.csv
|
39 |
|
|
$(sed) -n 's/^.*$$/[[VegCore#&|&]]/p' <$< >$@
|
40 |
|
|
|
41 |
5045
|
aaronmk
|
# This tracks VegCore terms that are mapped to VegBIEN but not documented in
|
42 |
|
|
# VegCore.csv. This file is *not* svn:ignored, so it will show up with a ? when
|
43 |
|
|
# the user runs `svn st` if there are any unsourced terms.
|
44 |
|
|
VegCore-VegBIEN.unsourced_terms.csv: VegCore-VegBIEN.csv VegCore.csv
|
45 |
|
|
$(bin)/filter_out_ci 0 <$+ >$@
|
46 |
|
|
$(bin)/autoremove $@
|
47 |
|
|
|
48 |
895
|
aaronmk
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
49 |
3967
|
aaronmk
|
|
50 |
6597
|
aaronmk
|
.Veg+-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
|
51 |
7435
|
aaronmk
|
$(bin)/in_place $< $(bin)/translate_ci 1 $(dict)
|
52 |
6830
|
aaronmk
|
$(bin)/in_place $< $(bin)/canon 1 $(vocab)
|
53 |
4890
|
aaronmk
|
touch $@
|
54 |
6597
|
aaronmk
|
.PRECIOUS: .Veg+-VegCore.csv.last_cleanup
|
55 |
4890
|
aaronmk
|
|
56 |
6597
|
aaronmk
|
.VegX-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
|
57 |
7435
|
aaronmk
|
$(bin)/in_place $< $(bin)/translate_ci 1 $(dict)
|
58 |
6597
|
aaronmk
|
$(bin)/in_place $< $(bin)/sort_map
|
59 |
|
|
touch $@
|
60 |
|
|
# can't canon because this would remove ? prefixes
|
61 |
|
|
.PRECIOUS: .VegX-VegCore.csv.last_cleanup
|
62 |
|
|
|
63 |
5065
|
aaronmk
|
.VegCore-VegBIEN.csv.last_cleanup: .%.last_cleanup: % $(dict) $(vocab)
|
64 |
7435
|
aaronmk
|
$(bin)/in_place $< $(bin)/translate_ci 0 $(dict)
|
65 |
5065
|
aaronmk
|
$(bin)/in_place $< $(bin)/canon 0 $(vocab)
|
66 |
1132
|
aaronmk
|
$(bin)/in_place $< $(bin)/sort_map
|
67 |
895
|
aaronmk
|
touch $@
|
68 |
4692
|
aaronmk
|
$(bin)/review 1 <$< >for_review/$<
|
69 |
5045
|
aaronmk
|
$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
|
70 |
5253
|
aaronmk
|
.PRECIOUS: .VegCore-VegBIEN.csv.last_cleanup
|
71 |
3967
|
aaronmk
|
|
72 |
895
|
aaronmk
|
else
|
73 |
1824
|
aaronmk
|
$(inputCoreMaps): _always
|
74 |
895
|
aaronmk
|
$(MAKE) $(@:%=.%.last_cleanup)
|
75 |
5254
|
aaronmk
|
.PRECIOUS: $(inputCoreMaps)
|
76 |
895
|
aaronmk
|
endif
|