Project

General

Profile

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