Revision 4252
Added by Aaron Marcuse-Kubitza about 12 years ago
inputs/input.Makefile | ||
---|---|---|
152 | 152 |
withCatSrcs = $(catSrcs:$(bin)/%=$(bin)/with_%) -- |
153 | 153 |
|
154 | 154 |
# Usage: `make {--silent|-s} inputs/<datasrc>/cat` (don't echo make commands) |
155 |
cat: $(addprefix cat-,$(tables)) _always ;
|
|
155 |
cat: $(tables:%=%/cat) _always ;
|
|
156 | 156 |
|
157 |
cat-%: _always
|
|
157 |
%/cat: _always
|
|
158 | 158 |
$(catSrcs) |
159 | 159 |
|
160 | 160 |
##### Staging tables installation |
161 | 161 |
|
162 |
install: _always schema $(addprefix install-,$(tables)) ;
|
|
162 |
install: _always schema $(tables:%=%/install) ;
|
|
163 | 163 |
|
164 | 164 |
uninstall: _always rm_schema ; |
165 | 165 |
# rm_schema will also drop all staging tables |
... | ... | |
173 | 173 |
rm_schema: _always |
174 | 174 |
echo 'DROP SCHEMA IF EXISTS "$(datasrc)" CASCADE;'|$(psqlAsBien) |
175 | 175 |
|
176 |
install-%: _always
|
|
176 |
%/install: _always
|
|
177 | 177 |
$(if $(isCsv),$(import_install_)) |
178 | 178 |
import_install_ = (prefix=; . $(bin)/vegbien_dest; "time" nice -n +5\ |
179 | 179 |
env schema=$(datasrc) table=$* $(bin)/csv2db $(catSrcs)\ |
... | ... | |
276 | 276 |
$(if $(n),,&>$(log_)))$(if $(log),$(if $(n), 2>&1|tee -a $(log_)))) |
277 | 277 |
# don't abort on import errors, which often relate to invalid input data |
278 | 278 |
|
279 |
import: $(addprefix import-,$(tables)) _always ;
|
|
279 |
import: $(tables:%=%/import) _always ;
|
|
280 | 280 |
|
281 |
import-%: %/VegBIEN.csv _always
|
|
281 |
%/import: %/VegBIEN.csv _always
|
|
282 | 282 |
$(import) |
283 | 283 |
# default: |
284 |
import-%: _always ;
|
|
284 |
%/import: _always ;
|
|
285 | 285 |
|
286 | 286 |
##### Log files from import |
287 | 287 |
|
... | ... | |
292 | 292 |
|
293 | 293 |
##### Verification of import |
294 | 294 |
|
295 |
verify: $(addprefix verify-,$(tables)) _always ;
|
|
295 |
verify: $(tables:%=%/verify) _always ;
|
|
296 | 296 |
|
297 |
verify-%: verify/%.ref verify/%.out _always
|
|
297 |
%/verify: verify/%.ref verify/%.out _always
|
|
298 | 298 |
-$(diffVerbose) $(+_) |
299 | 299 |
# don't abort on verification errors, which are expected during development |
300 | 300 |
# default: |
301 |
verify-%: verify/%.out _always
|
|
301 |
%/verify: verify/%.out _always
|
|
302 | 302 |
$(if $(shell test -e $< && echo t),cat $<) |
303 | 303 |
# don't run if verify/%.out's default do-nothing action was used |
304 | 304 |
# can't use $(wildcard) because it won't recheck file after verify/%.out is run |
Also available in: Unified diff
input.Makefile: Renamed "...-%" targets to "%/..." so they are more logically associated with a specific subdir