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
|
bin = ../bin
|
34
|
in_place = $(bin)/in_place
|
35
|
repl = $(bin)/repl
|
36
|
sort = $(bin)/sort 1 0
|
37
|
chRoot = $(bin)/ch_root <$< >$@
|
38
|
empty = $(SED) -n \
|
39
|
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@
|
40
|
|
41
|
schemas/vegbien.sql: schemas/vegbank.sql
|
42
|
$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
|
43
|
|
44
|
schemas/vegbien_empty.sql: schemas/vegbien.sql
|
45
|
$(empty)
|
46
|
|
47
|
VegX-VegBank.organisms.csv: _not_file
|
48
|
$(in_place) $@ $(sort)
|
49
|
|
50
|
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
|
51
|
$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
|
52
|
|
53
|
#####
|
54
|
|
55
|
plots: _not_file $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
|
56
|
|
57
|
chRoot2PlotsLeftVegx =\
|
58
|
env \
|
59
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
60
|
left_out_root='/*s/plotObservation' \
|
61
|
$(chRoot)
|
62
|
|
63
|
VegX-VegBank.plots.csv: VegX-VegBank.organisms.csv
|
64
|
$(chRoot2PlotsVegxVegbank)
|
65
|
chRoot2PlotsVegxVegbank =\
|
66
|
env \
|
67
|
right_in_root='/taxonObservation/*_ID/observation' \
|
68
|
right_out_root='/observation' \
|
69
|
$(chRoot2PlotsLeftVegx)
|
70
|
|
71
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
72
|
$(chRoot2PlotsVegxVegbien)
|
73
|
chRoot2PlotsVegxVegbien =\
|
74
|
env \
|
75
|
right_in_root='/taxonoccurrence/*_ID/plotevent' \
|
76
|
right_out_root='/plotevent' \
|
77
|
$(chRoot2PlotsLeftVegx)
|