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