Project

General

Profile

1 224 aaronmk
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 223 aaronmk
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
10
11 224 aaronmk
12 223 aaronmk
all: FORCE $(misc)
13 197 aaronmk
	$(MAKE) plots
14 198 aaronmk
	./join VegX VegBank
15
	./join VegX VegBIEN
16 199 aaronmk
	./review
17 223 aaronmk
.PRECIOUS: $(misc)
18 150 aaronmk
19 223 aaronmk
.SUFFIXES:
20
21 150 aaronmk
FORCE:
22 223 aaronmk
.PHONY: FORCE
23 188 aaronmk
24 199 aaronmk
all =\
25
$(wildcard for_review/*.csv) \
26
$(filter-out VegX-% VegBank-%,$(wildcard *-VegBank.*.csv)) \
27 223 aaronmk
VegX-*.plots.csv $(misc)
28 196 aaronmk
29 188 aaronmk
clean: FORCE
30 196 aaronmk
	$(RM) $(all)
31 188 aaronmk
32 198 aaronmk
33 212 aaronmk
schemas/vegbien.sql: schemas/vegbank.sql
34 218 aaronmk
	$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
35 212 aaronmk
36 223 aaronmk
schemas/vegbien_empty.sql: schemas/vegbien.sql
37
	$(empty)
38
39 212 aaronmk
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
40 221 aaronmk
	$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
41 212 aaronmk
42
43 223 aaronmk
plots: FORCE $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
44 197 aaronmk
45 188 aaronmk
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 200 aaronmk
	right_in_root='/taxonoccurrence/*_ID/plotevent' \
64 188 aaronmk
	right_out_root='/plotevent' \
65
	$(chRoot2PlotsLeftVegx)