Project

General

Profile

« Previous | Next » 

Revision 7471

mappings/Makefile: Veg+-VegCore.csv: Generate dynamically from VegCore.htm, which allows the VegCore thesaurus to be automatically kept up to date. More importantly, it allows terms in all map spreadsheets to be updated simultaneously when a term is renamed (e.g. by replacing a term with one of its synonyms).

View differences:

Makefile
8 8

  
9 9
# Paths
10 10
bin := ../bin
11
inputCoreMaps := Veg+-VegCore.csv VegCore-VegBIEN.csv VegX-VegCore.csv
11
inputCoreMaps := VegCore-VegBIEN.csv VegX-VegCore.csv
12 12
vocab := VegCore.csv
13 13
dict := Veg+-VegCore.csv
14 14

  
15 15
##### General targets
16 16

  
17
all: _always VegCore.csv VegCore.tables.redmine $(inputCoreMaps) ;
17
all: _always VegCore.csv Veg+-VegCore.csv VegCore.tables.redmine\
18
$(inputCoreMaps) ;
18 19

  
19 20
clean: _always
20 21
	$(RM) $(all)
......
30 31
	(echo VegCore; $(sed) -n 's/^.*<a name="([a-z][^"]*|[A-Z]+)">.*$$/\1/p')\
31 32
<$< >$@
32 33

  
33
#Veg+-VegCore.csv: VegCore.htm
34
#	(echo "Veg+,VegCore"; $(bin)/redmine_synonyms|grep -vE '^\??[A-Z][a-z]')\
35
#<$< >$@
36
#	# Canonicalize alternatives of ambiguous terms using unambiguous mappings
37
#	$(bin)/in_place $@ $(bin)/translate 1 <(grep -vE '^\?' $(dict))
38
#	$(bin)/in_place $@ $(bin)/collapse_multimap
39
#	# Replace ambiguous terms with alternatives lists
40
#	$(bin)/in_place $@ $(bin)/translate 1 $(dict)
34
Veg+-VegCore.csv: VegCore.htm
35
	(echo "Veg+,VegCore"; $(bin)/redmine_synonyms|grep -vE '^\??[A-Z][a-z]')\
36
<$< >$@
37
	# Canonicalize alternatives of ambiguous terms using unambiguous mappings
38
	$(bin)/in_place $@ $(bin)/translate 1 <(grep -vE '^\?' $(dict))
39
	$(bin)/in_place $@ $(bin)/collapse_multimap
40
	# Replace ambiguous terms with alternatives lists
41
	$(bin)/in_place $@ $(bin)/translate 1 $(dict)
41 42

  
42 43
VegCore.tables.csv: VegCore.htm
43 44
	<$< $(sed) -n 's/^.*<h1 *><a href="#[^>]+>([^?<][^<]*).*$$/\1/p' >$@
......
54 55

  
55 56
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
56 57

  
57
.Veg+-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
58
	$(bin)/in_place $< $(bin)/translate_ci 1 $(dict)
59
	$(bin)/in_place $< $(bin)/canon 1 $(vocab)
60
	touch $@
61
.PRECIOUS: .Veg+-VegCore.csv.last_cleanup
62

  
63 58
.VegX-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
64 59
	$(bin)/in_place $< $(bin)/translate_ci 1 $(dict)
65 60
	$(bin)/in_place $< $(bin)/sort 0 1

Also available in: Unified diff