Project

General

Profile

1
os = $(shell uname)
2

    
3
SED = sed -$(if $(filter Darwin,$(os)),E,r)
4

    
5
repl = ../scripts/util/repl
6
sort = ../scripts/util/sort 1 0
7
chRoot = ../scripts/util/ch_root <$< >$@
8
empty = $(SED) -n \
9
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@
10

    
11
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
12

    
13

    
14
all: _not_file $(misc)
15
	$(MAKE) plots
16
	./join VegX VegBank
17
	./join VegX VegBIEN
18
	./review
19
.PRECIOUS: $(misc)
20

    
21
.SUFFIXES:
22

    
23
_not_file:
24
.PHONY: _not_file
25

    
26
all =\
27
$(wildcard for_review/*.csv) \
28
$(filter-out VegX-% VegBank-%,$(wildcard *-VegBank.*.csv)) \
29
VegX-*.plots.csv $(misc)
30

    
31
clean: _not_file
32
	$(RM) $(all)
33

    
34

    
35
schemas/vegbien.sql: schemas/vegbank.sql
36
	$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
37

    
38
schemas/vegbien_empty.sql: schemas/vegbien.sql
39
	$(empty)
40

    
41
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
42
	$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
43

    
44

    
45
plots: _not_file $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
46

    
47
chRoot2PlotsLeftVegx =\
48
	env \
49
	left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
50
	left_out_root='/*s/plotObservation' \
51
	$(chRoot)
52

    
53
VegX-VegBank.plots.csv: VegX-VegBank.organisms.csv
54
	$(chRoot2PlotsVegxVegbank)
55
chRoot2PlotsVegxVegbank =\
56
	env \
57
	right_in_root='/taxonObservation/*_ID/observation' \
58
	right_out_root='/observation' \
59
	$(chRoot2PlotsLeftVegx)
60

    
61
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
62
	$(chRoot2PlotsVegxVegbien)
63
chRoot2PlotsVegxVegbien =\
64
	env \
65
	right_in_root='/taxonoccurrence/*_ID/plotevent' \
66
	right_out_root='/plotevent' \
67
	$(chRoot2PlotsLeftVegx)
(1-1/24)