Project

General

Profile

1
##### Vars/functions
2

    
3
bin := ../bin
4

    
5
review_ = $(bin)/review <$(1) >for_review/$(1)
6
review = $(call review_,$@)
7

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

    
10
##### General targets
11

    
12
all: _always $(coreMaps) join_maps ch_root_maps ;
13

    
14
.SUFFIXES:
15

    
16
_always:
17
.PHONY: _always
18

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

    
22
all :=
23

    
24
remake: _always clean all ;
25

    
26
##### Core maps cleanup
27

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

    
40
##### Maps generated with join
41

    
42
define join
43
$(bin)/join_sort <$+ >$@
44
$(review)
45
endef
46

    
47
joinMaps :=
48

    
49
DwC1-VegBIEN.specimens.csv: DwC1-DwC.specimens.csv DwC-VegBIEN.specimens.csv
50
	$(join)
51
joinMaps += DwC1-VegBIEN.specimens.csv
52

    
53
join_maps: $(joinMaps) ;
54

    
55
all += $(joinMaps)
56

    
57
##### Maps generated with ch_root
58

    
59
define chRoot
60
$(bin)/ch_root <$< >$@
61
$(review)
62
endef
63

    
64
chRootMaps :=
65

    
66
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
67
	env \
68
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
69
left_out_root='/*s/plotObservation' \
70
right_in_root='/taxonoccurrence/*_id/locationevent' \
71
right_out_root='/locationevent' \
72
$(chRoot)
73
chRootMaps += VegX-VegBIEN.plots.csv
74

    
75
VegX-VegBIEN.stems.csv: VegX-VegBIEN.organisms.csv
76
	env \
77
left_in_root='/*s/individualOrganismObservation->/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
78
left_out_root='/*s/individualOrganismObservation[relatedItem[relationshipType=stemParent]/relatedItemID]' \
79
right_in_root='/taxonoccurrence/aggregateoccurrence/*_id/plantobservation/stemobservation' \
80
right_out_root='/stemobservation' \
81
$(chRoot)
82
chRootMaps += VegX-VegBIEN.plots.csv
83

    
84
ch_root_maps: $(chRootMaps) ;
85

    
86
all += $(chRootMaps)
(6-6/10)