Revision 635
Added by Aaron Marcuse-Kubitza almost 13 years ago
input.Makefile | ||
---|---|---|
141 | 141 |
|
142 | 142 |
# Each input type needs var $(mapEnv) and targets install, uninstall |
143 | 143 |
|
144 |
dbFile := $(firstword $(wildcard src/*.sql)) |
|
144 |
dbFile := $(firstword $(wildcard src/db.*.sql))
|
|
145 | 145 |
|
146 | 146 |
ifneq ($(dbFile),) |
147 | 147 |
|
148 |
dbFileBasename := $(basename $(notdir $(dbFile))) |
|
149 |
dbEngineExt := $(subst .,,$(suffix $(dbFileBasename))) |
|
150 |
db := $(basename $(dbFileBasename)) |
|
148 |
dbEngineExt := $(subst .,,$(suffix $(basename $(notdir $(dbFile))))) |
|
149 |
db := $(notdir $(realpath .)) |
|
151 | 150 |
|
152 | 151 |
%.ref: %.ref.sql |
153 | 152 |
$(inputDbAsBien) $(db) <$< >$@ |
... | ... | |
173 | 172 |
dbAsBien := $(call mysqlAs,bien) |
174 | 173 |
|
175 | 174 |
db: $(dbFile) _always |
176 |
-$(mysqlAsRoot) <$< |
|
175 |
echo "CREATE DATABASE $(db) DEFAULT CHARACTER SET latin1;"|$(mysqlAsRoot) |
|
176 |
-$(mysqlAsRoot) --database=$(db) <$< |
|
177 | 177 |
echo "GRANT SELECT ON $(db).* TO 'bien'@'localhost';"|$(mysqlAsRoot) |
178 | 178 |
# ignore errors in db import so that GRANT will still be run |
179 | 179 |
|
... | ... | |
185 | 185 |
### |
186 | 186 |
|
187 | 187 |
else |
188 |
$(error The DB filename $(dbFile) must have the form <db_name>.{my|pg}.sql)
|
|
188 |
$(error The DB filename $(dbFile) must have the form db.{my|pg}.sql)
|
|
189 | 189 |
endif |
190 | 190 |
|
191 | 191 |
# Must come after dbEngine is set |
Also available in: Unified diff
input.Makefile: Determine DB name from input directory name, rather than DB file name