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 := DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv\
9
VegX-VegBIEN.organisms.csv
10

    
11
##### General targets
12

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

    
15
.SUFFIXES:
16

    
17
_always:
18
.PHONY: _always
19

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

    
23
all :=
24

    
25
remake: _always clean all ;
26

    
27
##### Core maps cleanup
28

    
29
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
	$(call review_,$<)
35
.PRECIOUS: .%.last_cleanup
36
else
37
$(coreMaps): _always
38
	$(MAKE) $(@:%=.%.last_cleanup)
39
endif
40

    
41
##### Maps generated with join/union
42

    
43
joinMaps :=
44

    
45
DwC1-VegBIEN.specimens.csv: DwC1-DwC2.specimens.csv DwC2-VegBIEN.specimens.csv
46
	$(bin)/join_sort <$+ >$@
47
joinMaps += DwC1-VegBIEN.specimens.csv
48

    
49
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
join_maps: $(joinMaps) ;
55

    
56
all += $(joinMaps)
57

    
58
##### Maps generated with ch_root
59

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

    
65
chRootMaps :=
66

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

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

    
85
ch_root_maps: $(chRootMaps) ;
86

    
87
all += $(chRootMaps)
(8-8/12)