Revision 1378
Added by Aaron Marcuse-Kubitza almost 13 years ago
inputs/input.Makefile | ||
---|---|---|
130 | 130 |
|
131 | 131 |
##### Mapping |
132 | 132 |
|
133 |
dbFile := $(firstword $(wildcard src/db.*.sql))
|
|
133 |
dbExport := $(firstword $(wildcard src/db.*.sql))
|
|
134 | 134 |
inputFiles := $(wildcard src/*.csv src/*.txt src/*.xml) |
135 | 135 |
|
136 | 136 |
+maps = $(filter maps/% $(mappings)/%,$(+_)) |
... | ... | |
141 | 141 |
|
142 | 142 |
##### Import to VegBIEN |
143 | 143 |
|
144 |
ifneq ($(dbFile)$(inputFiles),)
|
|
144 |
ifneq ($(dbExport)$(inputFiles),)
|
|
145 | 145 |
|
146 | 146 |
log_ = $(@:-all=)$(if $(n),.n=$(n),).$(date).log |
147 | 147 |
trace = $(log_:.log=.trace) |
... | ... | |
194 | 194 |
|
195 | 195 |
all += $(wildcard verify/*.out) |
196 | 196 |
|
197 |
ifneq ($(dbFile),)
|
|
197 |
ifneq ($(dbExport),)
|
|
198 | 198 |
%.ref: %.ref.sql |
199 | 199 |
$(dbAsBien) $(db) <$< >$@ |
200 | 200 |
endif |
... | ... | |
263 | 263 |
|
264 | 264 |
# Each input type needs var $(mapEnv) and targets install, uninstall |
265 | 265 |
|
266 |
ifneq ($(dbFile),)
|
|
266 |
ifneq ($(dbExport),)
|
|
267 | 267 |
|
268 |
dbEngineExt := $(subst .,,$(suffix $(basename $(notdir $(dbFile)))))
|
|
268 |
dbEngineExt := $(subst .,,$(suffix $(basename $(notdir $(dbExport)))))
|
|
269 | 269 |
db := $(datasrc) |
270 | 270 |
|
271 | 271 |
#### Installation |
... | ... | |
295 | 295 |
endef |
296 | 296 |
# ignore errors in db import so that GRANT will still be run |
297 | 297 |
|
298 |
db: $(dbFile) _always
|
|
298 |
db: $(dbExport) _always
|
|
299 | 299 |
$(if $(dbExists),,$(createDb)) |
300 | 300 |
echo "GRANT SELECT ON $(db).* TO 'bien'@'localhost';"|$(mysqlAsRoot) |
301 | 301 |
|
... | ... | |
307 | 307 |
### Unrecognized DB engine |
308 | 308 |
|
309 | 309 |
else |
310 |
$(error The DB filename $(dbFile) must be db.my.sql)
|
|
310 |
$(error The DB filename $(dbExport) must be db.my.sql)
|
|
311 | 311 |
endif |
312 | 312 |
|
313 | 313 |
# Must come after dbEngine is set |
Also available in: Unified diff
input.Makefile: Changed $(dbFile) to $(dbExport) to make it unambiguous that it refers to a SQL export, not a pre-existing DB, which will be supported later