1 |
785
|
aaronmk
|
##### Vars/functions
|
2 |
|
|
|
3 |
1272
|
aaronmk
|
# Paths
|
4 |
895
|
aaronmk
|
bin := ../bin
|
5 |
1272
|
aaronmk
|
coreMaps := DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv\
|
6 |
|
|
VegX-VegBIEN.organisms.csv
|
7 |
895
|
aaronmk
|
|
8 |
1272
|
aaronmk
|
# Commands
|
9 |
|
|
|
10 |
1115
|
aaronmk
|
review_ = $(bin)/review <$(1) >for_review/$(1)
|
11 |
|
|
review = $(call review_,$@)
|
12 |
924
|
aaronmk
|
|
13 |
1272
|
aaronmk
|
join = env header_num=1 $(bin)/join_union_sort
|
14 |
|
|
selfMap = $(bin)/cols 0 0
|
15 |
1285
|
aaronmk
|
removeEmpty = $(bin)/remove_empty
|
16 |
744
|
aaronmk
|
|
17 |
1272
|
aaronmk
|
define chRoot
|
18 |
|
|
$(bin)/ch_root <$< >$@
|
19 |
|
|
$(review)
|
20 |
|
|
endef
|
21 |
|
|
|
22 |
785
|
aaronmk
|
##### General targets
|
23 |
|
|
|
24 |
1115
|
aaronmk
|
all: _always $(coreMaps) join_maps ch_root_maps ;
|
25 |
150
|
aaronmk
|
|
26 |
1260
|
aaronmk
|
.SUFFIXES: # turn off built-in suffix rules
|
27 |
|
|
.SECONDARY: # don't automatically delete intermediate files
|
28 |
1354
|
aaronmk
|
.DELETE_ON_ERROR: # delete target if recipe fails
|
29 |
223
|
aaronmk
|
|
30 |
383
|
aaronmk
|
_always:
|
31 |
|
|
.PHONY: _always
|
32 |
188
|
aaronmk
|
|
33 |
383
|
aaronmk
|
clean: _always
|
34 |
196
|
aaronmk
|
$(RM) $(all)
|
35 |
188
|
aaronmk
|
|
36 |
924
|
aaronmk
|
all :=
|
37 |
|
|
|
38 |
785
|
aaronmk
|
##### Core maps cleanup
|
39 |
198
|
aaronmk
|
|
40 |
895
|
aaronmk
|
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
|
41 |
|
|
.%.last_cleanup: %
|
42 |
|
|
$(bin)/in_place $< $(bin)/simplify_xpath
|
43 |
1132
|
aaronmk
|
$(bin)/in_place $< $(bin)/sort_map
|
44 |
895
|
aaronmk
|
touch $@
|
45 |
1115
|
aaronmk
|
$(call review_,$<)
|
46 |
895
|
aaronmk
|
else
|
47 |
|
|
$(coreMaps): _always
|
48 |
|
|
$(MAKE) $(@:%=.%.last_cleanup)
|
49 |
|
|
endif
|
50 |
350
|
aaronmk
|
|
51 |
1272
|
aaronmk
|
##### DwC
|
52 |
1115
|
aaronmk
|
|
53 |
|
|
joinMaps :=
|
54 |
|
|
|
55 |
1452
|
aaronmk
|
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-VegBIEN.specimens.csv: DwC.cs-VegBIEN.specimens.csv
|
60 |
1457
|
aaronmk
|
$(bin)/ci_map $< >$@
|
61 |
1118
|
aaronmk
|
joinMaps += DwC-VegBIEN.specimens.csv
|
62 |
|
|
|
63 |
1140
|
aaronmk
|
DwC.self.specimens.csv: DwC-VegBIEN.specimens.csv
|
64 |
1270
|
aaronmk
|
$(selfMap) <$< >$@
|
65 |
1140
|
aaronmk
|
joinMaps += DwC.self.specimens.csv
|
66 |
|
|
|
67 |
1285
|
aaronmk
|
DwC-VegBIEN.specimens.no_empty.csv: DwC-VegBIEN.specimens.csv
|
68 |
|
|
$(removeEmpty) <$< >$@
|
69 |
|
|
joinMaps += DwC-VegBIEN.specimens.no_empty.csv
|
70 |
|
|
|
71 |
1115
|
aaronmk
|
join_maps: $(joinMaps) ;
|
72 |
|
|
|
73 |
|
|
all += $(joinMaps)
|
74 |
|
|
|
75 |
1272
|
aaronmk
|
##### VegX
|
76 |
212
|
aaronmk
|
|
77 |
924
|
aaronmk
|
chRootMaps :=
|
78 |
|
|
|
79 |
438
|
aaronmk
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
80 |
188
|
aaronmk
|
env \
|
81 |
439
|
aaronmk
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
82 |
|
|
left_out_root='/*s/plotObservation' \
|
83 |
525
|
aaronmk
|
right_in_root='/taxonoccurrence/*_id/locationevent' \
|
84 |
|
|
right_out_root='/locationevent' \
|
85 |
439
|
aaronmk
|
$(chRoot)
|
86 |
924
|
aaronmk
|
chRootMaps += VegX-VegBIEN.plots.csv
|
87 |
439
|
aaronmk
|
|
88 |
|
|
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
|
89 |
|
|
env \
|
90 |
441
|
aaronmk
|
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
91 |
504
|
aaronmk
|
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
|
92 |
681
|
aaronmk
|
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
|
93 |
673
|
aaronmk
|
right_out_root='/stemobservation' \
|
94 |
439
|
aaronmk
|
$(chRoot)
|
95 |
924
|
aaronmk
|
chRootMaps += VegX-VegBIEN.plots.csv
|
96 |
|
|
|
97 |
|
|
ch_root_maps: $(chRootMaps) ;
|
98 |
|
|
|
99 |
|
|
all += $(chRootMaps)
|