Project

General

Profile

« Previous | Next » 

Revision 6845

mappings/Makefile: Generate VegCore.csv from the VegCore data dictionary page by extracting all HTML anchors (in Redmine, each section heading, and therefore each VegCore term, gets its own anchor)

View differences:

Makefile
5 5

  
6 6
# Paths
7 7
bin := ../bin
8
inputCoreMaps := VegCore.csv Veg+-VegCore.csv VegCore-VegBIEN.csv \
9
VegX-VegCore.csv
8
inputCoreMaps := Veg+-VegCore.csv VegCore-VegBIEN.csv VegX-VegCore.csv
10 9
vocab := VegCore.csv
11 10
dict := Veg+-VegCore.csv
12 11

  
13 12
##### General targets
14 13

  
15
all: _always $(inputCoreMaps) ;
14
all: _always VegCore.csv $(inputCoreMaps) ;
16 15

  
17 16
clean: _always
18 17
	$(RM) $(all)
19 18

  
20 19
all :=
21 20

  
22
##### Core maps cleanup
21
##### Core maps
23 22

  
23
VegCore.htm:
24
	php -r 'fpassthru(fopen("https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore", "r"));' >$@
25

  
26
VegCore.csv: VegCore.htm
27
	$(sed) -n 's/^.*<a name="([^"]+)">.*$$/\1/p' <$< >$@
28

  
24 29
# This tracks VegCore terms that are mapped to VegBIEN but not documented in
25 30
# VegCore.csv. This file is *not* svn:ignored, so it will show up with a ? when
26 31
# the user runs `svn st` if there are any unsourced terms.
......
30 35

  
31 36
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
32 37

  
33
.VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
34
	touch $@
35
	$(MAKE) VegCore-VegBIEN.unsourced_terms.csv
36
.PRECIOUS: .VegCore.csv.last_cleanup
37

  
38 38
.Veg+-VegCore.csv.last_cleanup: .%.last_cleanup: % $(dict)
39 39
	$(bin)/in_place $< $(bin)/translate 1 $(dict)
40 40
	$(bin)/in_place $< $(bin)/canon 1 $(vocab)

Also available in: Unified diff