Project

General

Profile

1
##### Vars/functions
2

    
3
bin := ../bin
4

    
5
review = $(bin)/review <$(1) >for_review/$(1)
6

    
7
coreMaps := DwC-VegBIEN.specimens.csv VegX-VegBIEN.organisms.csv
8

    
9
##### General targets
10

    
11
all: _always $(coreMaps) ch_root_maps ;
12

    
13
.SUFFIXES:
14

    
15
_always:
16
.PHONY: _always
17

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

    
21
all :=
22

    
23
remake: _always clean all ;
24

    
25
##### Core maps cleanup
26

    
27
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
	$(call review,$<)
33
.PRECIOUS: .%.last_cleanup
34
else
35
$(coreMaps): _always
36
	$(MAKE) $(@:%=.%.last_cleanup)
37
endif
38

    
39
##### Maps generated with ch_root
40

    
41
define chRoot
42
$(bin)/ch_root <$< >$@
43
$(call review,$@)
44
endef
45

    
46
chRootMaps :=
47

    
48
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
49
	env \
50
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
51
left_out_root='/*s/plotObservation' \
52
right_in_root='/taxonoccurrence/*_id/locationevent' \
53
right_out_root='/locationevent' \
54
$(chRoot)
55
chRootMaps += VegX-VegBIEN.plots.csv
56

    
57
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
58
	env \
59
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
60
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
61
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
62
right_out_root='/stemobservation' \
63
$(chRoot)
64
chRootMaps += VegX-VegBIEN.plots.csv
65

    
66
ch_root_maps: $(chRootMaps) ;
67

    
68
all += $(chRootMaps)
(4-4/8)