Project

General

Profile

1 785 aaronmk
##### Vars/functions
2
3 895 aaronmk
bin := ../bin
4
5 1115 aaronmk
review_ = $(bin)/review <$(1) >for_review/$(1)
6
review = $(call review_,$@)
7 924 aaronmk
8 1121 aaronmk
coreMaps := DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv\
9
VegX-VegBIEN.organisms.csv
10 744 aaronmk
11 785 aaronmk
##### General targets
12
13 1115 aaronmk
all: _always $(coreMaps) join_maps ch_root_maps ;
14 150 aaronmk
15 223 aaronmk
.SUFFIXES:
16
17 383 aaronmk
_always:
18
.PHONY: _always
19 188 aaronmk
20 383 aaronmk
clean: _always
21 196 aaronmk
	$(RM) $(all)
22 188 aaronmk
23 924 aaronmk
all :=
24
25 423 aaronmk
remake: _always clean all ;
26
27 785 aaronmk
##### Core maps cleanup
28 198 aaronmk
29 895 aaronmk
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
30
.%.last_cleanup: %
31
	$(bin)/in_place $< $(bin)/simplify_xpath
32
	$(bin)/in_place $< $(bin)/sort 1 0
33
	touch $@
34 1115 aaronmk
	$(call review_,$<)
35 779 aaronmk
.PRECIOUS: .%.last_cleanup
36 895 aaronmk
else
37
$(coreMaps): _always
38
	$(MAKE) $(@:%=.%.last_cleanup)
39
endif
40 350 aaronmk
41 1118 aaronmk
##### Maps generated with join/union
42 1115 aaronmk
43
joinMaps :=
44
45 1118 aaronmk
DwC1-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv
46
	$(bin)/join_sort <$+ >$@
47 1115 aaronmk
joinMaps += DwC1-VegBIEN.specimens.csv
48
49 1118 aaronmk
DwC-VegBIEN.specimens.csv: DwC2-VegBIEN.specimens.csv DwC1-VegBIEN.specimens.csv
50
	$(bin)/union <$+|$(bin)/sort 1 0 >$@
51
	$(review)
52
joinMaps += DwC-VegBIEN.specimens.csv
53
54 1115 aaronmk
join_maps: $(joinMaps) ;
55
56
all += $(joinMaps)
57
58 785 aaronmk
##### Maps generated with ch_root
59 212 aaronmk
60 924 aaronmk
define chRoot
61
$(bin)/ch_root <$< >$@
62 1115 aaronmk
$(review)
63 924 aaronmk
endef
64 197 aaronmk
65 924 aaronmk
chRootMaps :=
66
67 438 aaronmk
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
68 188 aaronmk
	env \
69 439 aaronmk
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
70
left_out_root='/*s/plotObservation' \
71 525 aaronmk
right_in_root='/taxonoccurrence/*_id/locationevent' \
72
right_out_root='/locationevent' \
73 439 aaronmk
$(chRoot)
74 924 aaronmk
chRootMaps += VegX-VegBIEN.plots.csv
75 439 aaronmk
76
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
77
	env \
78 441 aaronmk
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
79 504 aaronmk
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
80 681 aaronmk
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
81 673 aaronmk
right_out_root='/stemobservation' \
82 439 aaronmk
$(chRoot)
83 924 aaronmk
chRootMaps += VegX-VegBIEN.plots.csv
84
85
ch_root_maps: $(chRootMaps) ;
86
87
all += $(chRootMaps)