1
|
os = $(shell uname)
|
2
|
|
3
|
SED = sed -$(if $(filter Darwin,$(os)),E,r)
|
4
|
|
5
|
#####
|
6
|
|
7
|
all: _always misc
|
8
|
$(MAKE) plots
|
9
|
./join VegX VegBIEN
|
10
|
./review
|
11
|
|
12
|
.SUFFIXES:
|
13
|
|
14
|
_always:
|
15
|
.PHONY: _always
|
16
|
|
17
|
misc := schemas/vegbien.sql schemas/vegbien_empty.sql
|
18
|
|
19
|
all = $(wildcard for_review/*.csv) \
|
20
|
$(filter-out VegX-%,$(wildcard *-VegBIEN.*.csv)) VegX-*.plots.csv $(misc)
|
21
|
|
22
|
clean: _always
|
23
|
$(RM) $(all)
|
24
|
|
25
|
%:: %.make
|
26
|
./$< >$@
|
27
|
.PRECIOUS: %
|
28
|
|
29
|
#####
|
30
|
|
31
|
misc: $(misc)
|
32
|
.PRECIOUS: $(misc)
|
33
|
|
34
|
bin = ../bin
|
35
|
repl = $(bin)/repl
|
36
|
sort = $(bin)/sort 1 0
|
37
|
chRoot = $(bin)/ch_root <$< >$@
|
38
|
empty = $(SED) -n \
|
39
|
's/^CREATE TABLE ([0-9A-Za-z_]+) \($$/TRUNCATE \1 CASCADE;/p' <$< >$@
|
40
|
|
41
|
schemas/vegbien_empty.sql: schemas/vegbien.sql
|
42
|
$(empty)
|
43
|
|
44
|
VegX-VegBIEN.organisms.csv: _always
|
45
|
$(bin)/in_place $@ $(sort)
|
46
|
|
47
|
#####
|
48
|
|
49
|
plots: _always $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
|
50
|
|
51
|
chRoot2PlotsLeftVegx =\
|
52
|
env \
|
53
|
left_in_root='/*s/individualOrganismObservation/*ID->/*s/plotObservation' \
|
54
|
left_out_root='/*s/plotObservation' \
|
55
|
$(chRoot)
|
56
|
|
57
|
VegX-VegBIEN.plots.csv: VegX-VegBIEN.organisms.csv
|
58
|
$(chRoot2PlotsVegxVegbien)
|
59
|
chRoot2PlotsVegxVegbien =\
|
60
|
env \
|
61
|
right_in_root='/taxonoccurrence/*_ID/plotevent' \
|
62
|
right_out_root='/plotevent' \
|
63
|
$(chRoot2PlotsLeftVegx)
|