Revision 724
Added by Aaron Marcuse-Kubitza almost 13 years ago
input.Makefile | ||
---|---|---|
16 | 16 |
CP = cp -p |
17 | 17 |
DIFF = diff --unified=2 |
18 | 18 |
|
19 |
tablesSort := plots organisms stems |
|
20 |
vegxMaps := $(wildcard $(tablesSort:%=maps/VegX.%.csv)) |
|
21 |
vegxMaps += $(filter-out $(vegxMaps),$(wildcard maps/VegX.*.csv)) |
|
22 |
tables := $(vegxMaps:maps/VegX.%.csv=%) |
|
23 |
vegbienMaps := $(subst VegX.,VegBIEN.,$(vegxMaps)) |
|
19 |
# Config |
|
20 |
test_n ?= 2 |
|
21 |
tablesSort ?= plots organisms stems |
|
22 |
|
|
23 |
# Paths |
|
24 |
viaMaps := $(filter-out maps/VegBIEN.%.csv,$(wildcard maps/*.csv)) |
|
25 |
via := $(firstword $(sort $(basename $(basename $(notdir $(viaMaps)))))) |
|
26 |
viaMapsSort := $(wildcard $(tablesSort:%=maps/$(via).%.csv)) |
|
27 |
viaMaps := $(viaMapsSort) $(filter-out $(viaMapsSort),$(viaMaps)) |
|
28 |
tables := $(viaMaps:maps/$(via).%.csv=%) |
|
29 |
directMaps := $(subst $(via).,VegBIEN.,$(viaMaps)) |
|
30 |
directMaps += $(filter-out $(directMaps),$(wildcard maps/VegBIEN.*.csv)) |
|
24 | 31 |
dbFile := $(firstword $(wildcard src/db.*.sql)) |
25 | 32 |
|
26 | 33 |
+maps = $(filter maps/%,$(+_)) |
... | ... | |
29 | 36 |
root := $(selfDir_uZPPqC).. |
30 | 37 |
psqlAsBien := $(root)/bin/psql_vegbien |
31 | 38 |
|
32 |
# Config |
|
33 |
test_n ?= 2 |
|
34 |
|
|
35 | 39 |
##### |
36 | 40 |
|
37 | 41 |
all: _always maps ; |
... | ... | |
59 | 63 |
|
60 | 64 |
##### |
61 | 65 |
|
62 |
maps: $(vegbienMaps) _always ;
|
|
66 |
maps: $(directMaps) _always ;
|
|
63 | 67 |
|
64 |
all += $(vegbienMaps)
|
|
68 |
all += $(directMaps)
|
|
65 | 69 |
|
66 |
maps/VegBIEN.%.csv: maps/VegX.%.csv $(root)/mappings/VegX-VegBIEN.%.csv
|
|
70 |
maps/VegBIEN.%.csv: maps/$(via).%.csv $(root)/mappings/$(via)-VegBIEN.%.csv
|
|
67 | 71 |
$(root)/bin/join_sort <$+ >$@ |
68 | 72 |
.PRECIOUS: maps/VegBIEN.%.csv |
69 | 73 |
|
... | ... | |
78 | 82 |
$(if $(n),,>>$(log)) 2>&1$(if $(n),|tee -a $(log)) |
79 | 83 |
# ignore import errors, which are often benign (e.g. invalid date format) |
80 | 84 |
|
81 |
import-all: $(vegbienMaps) _always
|
|
85 |
import-all: $(directMaps) _always
|
|
82 | 86 |
$(import) |
83 | 87 |
|
84 | 88 |
import-%: maps/VegBIEN.%.csv _always |
... | ... | |
118 | 122 |
|
119 | 123 |
ifneq ($(wildcard test/),) |
120 | 124 |
|
121 |
tests := test/VegX.xml test/VegBIEN.xml test/VegBIEN.2-step.xml test/import.out
|
|
125 |
tests := |
|
122 | 126 |
|
123 |
test: _always $(tests) ; |
|
124 |
|
|
125 |
.PRECIOUS: $(tests) |
|
126 |
|
|
127 |
all += $(tests) |
|
128 |
|
|
129 | 127 |
hasOwnRef = $(filter-out %.2-step.xml,$@) |
130 | 128 |
testRef = $(1:.2-step.xml=.xml).ref |
131 | 129 |
|
... | ... | |
137 | 135 |
exit $$e;} |
138 | 136 |
endef |
139 | 137 |
|
140 |
test/VegX.xml: $(vegxMaps) _always
|
|
138 |
test/$(via).xml: $(viaMaps) _always
|
|
141 | 139 |
$(call test,$(map)) |
140 |
tests += test/$(via).xml |
|
142 | 141 |
|
143 |
test/VegBIEN.xml: $(vegbienMaps) _always
|
|
142 |
test/VegBIEN.xml: $(directMaps) _always
|
|
144 | 143 |
$(call test,$(map)) |
144 |
tests += test/VegBIEN.xml |
|
145 | 145 |
|
146 |
test/VegBIEN.2-step.xml: test/VegX.xml\
|
|
147 |
$(root)/mappings/VegX-VegBIEN.organisms.csv _always
|
|
146 |
test/VegBIEN.2-step.xml: test/$(via).xml\
|
|
147 |
$(root)/mappings/$(via)-VegBIEN.organisms.csv _always
|
|
148 | 148 |
-$(call test,$(root)/map) |
149 | 149 |
# Don't abort tester if only 2-step test fails, as it's often finicky |
150 |
tests += test/VegBIEN.2-step.xml |
|
150 | 151 |
|
151 |
test/import.out: $(vegbienMaps) _always
|
|
152 |
test/import.out: $(directMaps) _always
|
|
152 | 153 |
$(call test,$(map2db)) |
154 |
tests += test/import.out |
|
153 | 155 |
|
156 |
test: _always $(tests) ; |
|
157 |
|
|
158 |
.PRECIOUS: $(tests) |
|
159 |
|
|
160 |
all += $(tests) |
|
161 |
|
|
154 | 162 |
# Accepts a test output: make <test_output_path>-ok |
155 | 163 |
%-ok: _always |
156 | 164 |
$(CP) $* $(call testRef,$*) |
Also available in: Unified diff
input.Makefile: Generalized to handle mapping via any format, not just VegX