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
|
.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
|
joinMaps :=
|
54
|
|
55
|
DwC.cs-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv
|
56
|
$(join) <$+ >$@
|
57
|
joinMaps += DwC.cs-VegBIEN.specimens.csv
|
58
|
|
59
|
DwC.ci-VegBIEN.specimens.csv: DwC.cs-VegBIEN.specimens.csv
|
60
|
$(bin)/ci_map $< >$@
|
61
|
joinMaps += DwC.ci-VegBIEN.specimens.csv
|
62
|
|
63
|
DwC-VegBIEN.specimens.csv: DwC.ci-VegBIEN.specimens.csv
|
64
|
$(removeEmpty) <$< >$@
|
65
|
joinMaps += DwC-VegBIEN.specimens.csv
|
66
|
|
67
|
DwC.self.specimens.csv: DwC.ci-VegBIEN.specimens.csv
|
68
|
$(selfMap) <$<|$(bin)/sort_map >$@
|
69
|
joinMaps += DwC.self.specimens.csv
|
70
|
|
71
|
join_maps: $(joinMaps) ;
|
72
|
|
73
|
all += $(joinMaps)
|
74
|
|
75
|
##### VegX
|
76
|
|
77
|
chRootMaps :=
|
78
|
|
79
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
80
|
env \
|
81
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
82
|
left_out_root='/*s/plotObservation' \
|
83
|
right_in_root='/taxonoccurrence/*_id/locationevent' \
|
84
|
right_out_root='/locationevent' \
|
85
|
$(chRoot)
|
86
|
chRootMaps += VegX-VegBIEN.plots.csv
|
87
|
|
88
|
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
|
89
|
env \
|
90
|
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
91
|
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
92
|
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
|
93
|
right_out_root='/stemobservation' \
|
94
|
$(chRoot)
|
95
|
chRootMaps += VegX-VegBIEN.plots.csv
|
96
|
|
97
|
ch_root_maps: $(chRootMaps) ;
|
98
|
|
99
|
all += $(chRootMaps)
|