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