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
|
|
16
|
define chRoot
|
17
|
$(bin)/ch_root <$< >$@
|
18
|
$(review)
|
19
|
endef
|
20
|
|
21
|
##### General targets
|
22
|
|
23
|
all: _always $(coreMaps) join_maps ch_root_maps ;
|
24
|
|
25
|
.SUFFIXES: # turn off built-in suffix rules
|
26
|
.SECONDARY: # don't automatically delete intermediate files
|
27
|
|
28
|
_always:
|
29
|
.PHONY: _always
|
30
|
|
31
|
clean: _always
|
32
|
$(RM) $(all)
|
33
|
|
34
|
all :=
|
35
|
|
36
|
##### Core maps cleanup
|
37
|
|
38
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
39
|
.%.last_cleanup: %
|
40
|
$(bin)/in_place $< $(bin)/simplify_xpath
|
41
|
$(bin)/in_place $< $(bin)/sort_map
|
42
|
touch $@
|
43
|
$(call review_,$<)
|
44
|
else
|
45
|
$(coreMaps): _always
|
46
|
$(MAKE) $(@:%=.%.last_cleanup)
|
47
|
endif
|
48
|
|
49
|
##### DwC
|
50
|
|
51
|
joinMaps :=
|
52
|
|
53
|
DwC2.ci-VegBIEN.specimens.csv: DwC2-VegBIEN.specimens.csv
|
54
|
$(selfMap) <$<|$(bin)/ucase_first 0|$(join) $< >$@
|
55
|
joinMaps += DwC2.ci-VegBIEN.specimens.csv
|
56
|
|
57
|
DwC-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2.ci-VegBIEN.specimens.csv
|
58
|
$(join) <$+ >$@
|
59
|
joinMaps += DwC-VegBIEN.specimens.csv
|
60
|
|
61
|
DwC.self.specimens.csv: DwC-VegBIEN.specimens.csv
|
62
|
$(selfMap) <$< >$@
|
63
|
joinMaps += DwC.self.specimens.csv
|
64
|
|
65
|
join_maps: $(joinMaps) ;
|
66
|
|
67
|
all += $(joinMaps)
|
68
|
|
69
|
##### VegX
|
70
|
|
71
|
chRootMaps :=
|
72
|
|
73
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
74
|
env \
|
75
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
76
|
left_out_root='/*s/plotObservation' \
|
77
|
right_in_root='/taxonoccurrence/*_id/locationevent' \
|
78
|
right_out_root='/locationevent' \
|
79
|
$(chRoot)
|
80
|
chRootMaps += VegX-VegBIEN.plots.csv
|
81
|
|
82
|
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
|
83
|
env \
|
84
|
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
85
|
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
86
|
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
|
87
|
right_out_root='/stemobservation' \
|
88
|
$(chRoot)
|
89
|
chRootMaps += VegX-VegBIEN.plots.csv
|
90
|
|
91
|
ch_root_maps: $(chRootMaps) ;
|
92
|
|
93
|
all += $(chRootMaps)
|