1
|
os = $(shell uname)
|
2
|
|
3
|
SED = sed -$(if $(filter Darwin,$(os)),E,r)
|
4
|
|
5
|
#####
|
6
|
|
7
|
all: _not_file misc
|
8
|
$(MAKE) plots
|
9
|
./join VegX VegBank
|
10
|
./join VegX VegBIEN
|
11
|
./review
|
12
|
|
13
|
.SUFFIXES:
|
14
|
|
15
|
_not_file:
|
16
|
.PHONY: _not_file
|
17
|
|
18
|
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
|
19
|
|
20
|
all =\
|
21
|
$(wildcard for_review/*.csv) \
|
22
|
$(filter-out VegX-% VegBank-%,$(wildcard *-VegBank.*.csv)) \
|
23
|
VegX-*.plots.csv $(misc)
|
24
|
|
25
|
clean: _not_file
|
26
|
$(RM) $(all)
|
27
|
|
28
|
#####
|
29
|
|
30
|
misc: $(misc)
|
31
|
.PRECIOUS: $(misc)
|
32
|
|
33
|
repl = ../bin/repl
|
34
|
sort = ../bin/sort 1 0
|
35
|
chRoot = ../bin/ch_root <$< >$@
|
36
|
empty = $(SED) -n \
|
37
|
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@
|
38
|
|
39
|
schemas/vegbien.sql: schemas/vegbank.sql
|
40
|
$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
|
41
|
|
42
|
schemas/vegbien_empty.sql: schemas/vegbien.sql
|
43
|
$(empty)
|
44
|
|
45
|
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
|
46
|
$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
|
47
|
|
48
|
#####
|
49
|
|
50
|
plots: _not_file $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
|
51
|
|
52
|
chRoot2PlotsLeftVegx =\
|
53
|
env \
|
54
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
55
|
left_out_root='/*s/plotObservation' \
|
56
|
$(chRoot)
|
57
|
|
58
|
VegX-VegBank.plots.csv: VegX-VegBank.organisms.csv
|
59
|
$(chRoot2PlotsVegxVegbank)
|
60
|
chRoot2PlotsVegxVegbank =\
|
61
|
env \
|
62
|
right_in_root='/taxonObservation/*_ID/observation' \
|
63
|
right_out_root='/observation' \
|
64
|
$(chRoot2PlotsLeftVegx)
|
65
|
|
66
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
67
|
$(chRoot2PlotsVegxVegbien)
|
68
|
chRoot2PlotsVegxVegbien =\
|
69
|
env \
|
70
|
right_in_root='/taxonoccurrence/*_ID/plotevent' \
|
71
|
right_out_root='/plotevent' \
|
72
|
$(chRoot2PlotsLeftVegx)
|