Project

General

Profile

1
SED = sed -$(if $(filter Darwin,$(shell uname)),E,r)
2

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

    
9
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
10

    
11

    
12
all: FORCE $(misc)
13
	$(MAKE) plots
14
	./join VegX VegBank
15
	./join VegX VegBIEN
16
	./review
17
.PRECIOUS: $(misc)
18

    
19
.SUFFIXES:
20

    
21
FORCE:
22
.PHONY: FORCE
23

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

    
29
clean: FORCE
30
	$(RM) $(all)
31

    
32

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

    
36
schemas/vegbien_empty.sql: schemas/vegbien.sql
37
	$(empty)
38

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

    
42

    
43
plots: FORCE $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
44

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

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

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