Project

General

Profile

1 223 aaronmk
misc = schemas/vegbien.sql schemas/vegbien_empty.sql VegX-VegBIEN.organisms.csv
2
3
all: FORCE $(misc)
4 197 aaronmk
	$(MAKE) plots
5 198 aaronmk
	./join VegX VegBank
6
	./join VegX VegBIEN
7 199 aaronmk
	./review
8 223 aaronmk
.PRECIOUS: $(misc)
9 150 aaronmk
10 223 aaronmk
.SUFFIXES:
11
12 150 aaronmk
FORCE:
13 223 aaronmk
.PHONY: FORCE
14 188 aaronmk
15 199 aaronmk
all =\
16
$(wildcard for_review/*.csv) \
17
$(filter-out VegX-% VegBank-%,$(wildcard *-VegBank.*.csv)) \
18 223 aaronmk
VegX-*.plots.csv $(misc)
19 196 aaronmk
20 188 aaronmk
clean: FORCE
21 196 aaronmk
	$(RM) $(all)
22 188 aaronmk
23 223 aaronmk
repl = ../scripts/util/repl
24 221 aaronmk
sort = ../scripts/util/sort 1 0
25
chRoot = ../scripts/util/ch_root <$< >$@
26 223 aaronmk
empty = sed -nE 's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' \
27
<$< >$@
28 198 aaronmk
29 221 aaronmk
30 212 aaronmk
schemas/vegbien.sql: schemas/vegbank.sql
31 218 aaronmk
	$(repl) <$< VegBank-VegBIEN.schema.csv|$(repl) VegBank-VegBIEN.csv >$@
32 212 aaronmk
33 223 aaronmk
schemas/vegbien_empty.sql: schemas/vegbien.sql
34
	$(empty)
35
36 212 aaronmk
VegX-VegBIEN.organisms.csv: VegX-VegBank.organisms.csv
37 221 aaronmk
	$(repl) <$< VegBank-VegBIEN.csv 1|$(sort) >$@
38 212 aaronmk
39
40 223 aaronmk
plots: FORCE $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
41 197 aaronmk
42 188 aaronmk
chRoot2PlotsLeftVegx =\
43
	env \
44
	left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
45
	left_out_root='/*s/plotObservation' \
46
	$(chRoot)
47
48
VegX-VegBank.plots.csv: VegX-VegBank.organisms.csv
49
	$(chRoot2PlotsVegxVegbank)
50
chRoot2PlotsVegxVegbank =\
51
	env \
52
	right_in_root='/taxonObservation/*_ID/observation' \
53
	right_out_root='/observation' \
54
	$(chRoot2PlotsLeftVegx)
55
56
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
57
	$(chRoot2PlotsVegxVegbien)
58
chRoot2PlotsVegxVegbien =\
59
	env \
60 200 aaronmk
	right_in_root='/taxonoccurrence/*_ID/plotevent' \
61 188 aaronmk
	right_out_root='/plotevent' \
62
	$(chRoot2PlotsLeftVegx)