Project

General

Profile

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