Project

General

Profile

1
##### Vars/functions
2

    
3
bin := ../bin
4

    
5
coreMaps := DwC-VegBIEN.specimens.csv VegX-VegBIEN.organisms.csv
6
chRootMaps := VegX-VegBIEN.plots.csv VegX-VegBIEN.stems.csv
7
all := $(wildcard for_review/*) $(chRootMaps)
8

    
9
##### General targets
10

    
11
all: _always $(coreMaps) $(chRootMaps)
12
	./review
13

    
14
.SUFFIXES:
15

    
16
_always:
17
.PHONY: _always
18

    
19
clean: _always
20
	$(RM) $(all)
21

    
22
remake: _always clean all ;
23

    
24
##### Core maps cleanup
25

    
26
ifneq ($(filter .%.last_cleanup,$(MAKECMDGOALS)),)
27
.%.last_cleanup: %
28
	$(bin)/in_place $< $(bin)/simplify_xpath
29
	$(bin)/in_place $< $(bin)/sort 1 0
30
	touch $@
31
.PRECIOUS: .%.last_cleanup
32
else
33
$(coreMaps): _always
34
	$(MAKE) $(@:%=.%.last_cleanup)
35
endif
36

    
37
##### Maps generated with ch_root
38

    
39
chRoot = $(bin)/ch_root <$< >$@
40

    
41
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
42
	env \
43
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
44
left_out_root='/*s/plotObservation' \
45
right_in_root='/taxonoccurrence/*_id/locationevent' \
46
right_out_root='/locationevent' \
47
$(chRoot)
48

    
49
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
50
	env \
51
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
52
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
53
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
54
right_out_root='/stemobservation' \
55
$(chRoot)
(4-4/9)