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
|
removeEmpty = $(bin)/remove_empty
|
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
|
|
29
|
_always:
|
30
|
.PHONY: _always
|
31
|
|
32
|
clean: _always
|
33
|
$(RM) $(all)
|
34
|
|
35
|
all :=
|
36
|
|
37
|
##### Core maps cleanup
|
38
|
|
39
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
40
|
.%.last_cleanup: %
|
41
|
$(bin)/in_place $< $(bin)/simplify_xpath
|
42
|
$(bin)/in_place $< $(bin)/sort_map
|
43
|
touch $@
|
44
|
$(call review_,$<)
|
45
|
else
|
46
|
$(coreMaps): _always
|
47
|
$(MAKE) $(@:%=.%.last_cleanup)
|
48
|
endif
|
49
|
|
50
|
##### DwC
|
51
|
|
52
|
joinMaps :=
|
53
|
|
54
|
DwC2.ci-VegBIEN.specimens.csv: DwC2-VegBIEN.specimens.csv
|
55
|
$(selfMap) <$<|$(bin)/ucase_first 0|$(join) $< >$@
|
56
|
joinMaps += DwC2.ci-VegBIEN.specimens.csv
|
57
|
|
58
|
DwC-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2.ci-VegBIEN.specimens.csv
|
59
|
$(join) <$+ >$@
|
60
|
joinMaps += DwC-VegBIEN.specimens.csv
|
61
|
|
62
|
DwC.self.specimens.csv: DwC-VegBIEN.specimens.csv
|
63
|
$(selfMap) <$< >$@
|
64
|
joinMaps += DwC.self.specimens.csv
|
65
|
|
66
|
DwC-VegBIEN.specimens.no_empty.csv: DwC-VegBIEN.specimens.csv
|
67
|
$(removeEmpty) <$< >$@
|
68
|
joinMaps += DwC-VegBIEN.specimens.no_empty.csv
|
69
|
|
70
|
join_maps: $(joinMaps) ;
|
71
|
|
72
|
all += $(joinMaps)
|
73
|
|
74
|
##### VegX
|
75
|
|
76
|
chRootMaps :=
|
77
|
|
78
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
79
|
env \
|
80
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
81
|
left_out_root='/*s/plotObservation' \
|
82
|
right_in_root='/taxonoccurrence/*_id/locationevent' \
|
83
|
right_out_root='/locationevent' \
|
84
|
$(chRoot)
|
85
|
chRootMaps += VegX-VegBIEN.plots.csv
|
86
|
|
87
|
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
|
88
|
env \
|
89
|
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
90
|
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
91
|
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
|
92
|
right_out_root='/stemobservation' \
|
93
|
$(chRoot)
|
94
|
chRootMaps += VegX-VegBIEN.plots.csv
|
95
|
|
96
|
ch_root_maps: $(chRootMaps) ;
|
97
|
|
98
|
all += $(chRootMaps)
|