1
|
##### Vars/functions
|
2
|
|
3
|
# Paths
|
4
|
bin := ../bin
|
5
|
coreMaps := DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv\
|
6
|
VegX-VegBIEN.organisms.csv
|
7
|
|
8
|
# Commands
|
9
|
|
10
|
review_ = $(bin)/review <$(1) >for_review/$(1)
|
11
|
review = $(call review_,$@)
|
12
|
|
13
|
join = env header_num=1 $(bin)/join_union_sort
|
14
|
selfMap = $(bin)/cols 0 0
|
15
|
mkSelfMap = $(selfMap) <$<|$(bin)/sort_map >$@
|
16
|
|
17
|
define chRoot
|
18
|
$(bin)/ch_root <$< >$@
|
19
|
$(review)
|
20
|
endef
|
21
|
|
22
|
##### General targets
|
23
|
|
24
|
all: _always $(coreMaps) join_maps ch_root_maps ;
|
25
|
|
26
|
.SUFFIXES: # turn off built-in suffix rules
|
27
|
.SECONDARY: # don't automatically delete intermediate files
|
28
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
29
|
|
30
|
_always:
|
31
|
.PHONY: _always
|
32
|
|
33
|
clean: _always
|
34
|
$(RM) $(all)
|
35
|
|
36
|
all :=
|
37
|
|
38
|
##### Core maps cleanup
|
39
|
|
40
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
41
|
.%.last_cleanup: %
|
42
|
$(bin)/in_place $< $(bin)/simplify_xpath
|
43
|
$(bin)/in_place $< $(bin)/sort_map
|
44
|
touch $@
|
45
|
$(call review_,$<)
|
46
|
else
|
47
|
$(coreMaps): _always
|
48
|
$(MAKE) $(@:%=.%.last_cleanup)
|
49
|
endif
|
50
|
|
51
|
##### DwC
|
52
|
|
53
|
dwcMaps :=
|
54
|
|
55
|
DwC.cs-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv
|
56
|
$(join) <$+ >$@
|
57
|
dwcMaps += DwC.cs-VegBIEN.specimens.csv
|
58
|
|
59
|
DwC-VegBIEN.specimens.csv: DwC.cs-VegBIEN.specimens.csv
|
60
|
$(bin)/ci_map $< >$@
|
61
|
dwcMaps += DwC-VegBIEN.specimens.csv
|
62
|
|
63
|
DwC.self.specimens.csv: DwC-VegBIEN.specimens.csv
|
64
|
$(mkSelfMap)
|
65
|
dwcMaps += DwC.self.specimens.csv
|
66
|
|
67
|
join_maps: $(dwcMaps) ;
|
68
|
|
69
|
all += $(dwcMaps)
|
70
|
|
71
|
##### VegX
|
72
|
|
73
|
vegxMaps :=
|
74
|
|
75
|
VegX.self.organisms.csv: VegX-VegBIEN.organisms.csv
|
76
|
$(mkSelfMap)
|
77
|
vegxMaps += VegX.self.organisms.csv
|
78
|
|
79
|
rootAttrs :=
|
80
|
#:[@xmlns:tcs="http://www.tdwg.org/schemas/tcs/1.01"]
|
81
|
|
82
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
83
|
env \
|
84
|
left_in_root='$(rootAttrs)/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
85
|
left_out_root='/*s/plotObservation' \
|
86
|
right_in_root='/taxonoccurrence/*_id/locationevent' \
|
87
|
right_out_root='/locationevent' \
|
88
|
$(chRoot)
|
89
|
vegxMaps += VegX-VegBIEN.plots.csv
|
90
|
|
91
|
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
|
92
|
env \
|
93
|
left_in_root='$(rootAttrs)/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
94
|
left_out_root='$(rootAttrs)/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
95
|
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
|
96
|
right_out_root='/stemobservation' \
|
97
|
$(chRoot)
|
98
|
vegxMaps += VegX-VegBIEN.stems.csv
|
99
|
|
100
|
ch_root_maps: $(vegxMaps) ;
|
101
|
|
102
|
all += $(vegxMaps)
|