Revision 383
Added by Aaron Marcuse-Kubitza almost 13 years ago
input.Makefile | ||
---|---|---|
17 | 17 |
|
18 | 18 |
##### |
19 | 19 |
|
20 |
all: _not_file maps import verify
|
|
20 |
all: _always maps import verify
|
|
21 | 21 |
|
22 | 22 |
.SUFFIXES: |
23 | 23 |
|
24 |
_not_file:
|
|
25 |
.PHONY: _not_file
|
|
24 |
_always:
|
|
25 |
.PHONY: _always
|
|
26 | 26 |
|
27 |
clean: _not_file
|
|
27 |
clean: _always
|
|
28 | 28 |
$(RM) $(all) |
29 | 29 |
|
30 |
rm-%: _not_file
|
|
30 |
rm-%: _always
|
|
31 | 31 |
$(RM) $* |
32 | 32 |
|
33 |
%.out: % _not_file
|
|
33 |
%.out: % _always
|
|
34 | 34 |
./$* >$@ |
35 | 35 |
.PRECIOUS: %.out |
36 | 36 |
|
37 | 37 |
##### |
38 | 38 |
|
39 |
reinstall: _not_file uninstall install
|
|
39 |
reinstall: _always uninstall install
|
|
40 | 40 |
|
41 | 41 |
##### |
42 | 42 |
|
43 |
maps: $(vegbienMaps) _not_file
|
|
43 |
maps: $(vegbienMaps) _always
|
|
44 | 44 |
|
45 | 45 |
all += $(vegbienMaps) |
46 | 46 |
|
... | ... | |
50 | 50 |
|
51 | 51 |
##### |
52 | 52 |
|
53 |
import: _not_file $(addprefix import-,$(tables))
|
|
53 |
import: _always $(addprefix import-,$(tables))
|
|
54 | 54 |
|
55 | 55 |
log = $*$(if $(n),.n=$(n),).log |
56 | 56 |
|
57 | 57 |
logs := $(wildcard *.log) |
58 | 58 |
|
59 |
rm_logs: _not_file
|
|
59 |
rm_logs: _always
|
|
60 | 60 |
$(RM) $(logs) |
61 | 61 |
|
62 | 62 |
##### |
63 | 63 |
|
64 |
verify: _not_file $(addprefix verify-,$(tables))
|
|
64 |
verify: _always $(addprefix verify-,$(tables))
|
|
65 | 65 |
|
66 |
verify-%: verify.%.ref verify.%.out _not_file
|
|
66 |
verify-%: verify.%.ref verify.%.out _always
|
|
67 | 67 |
$(DIFF) |
68 | 68 |
|
69 |
%.out: %.sql _not_file
|
|
69 |
%.out: %.sql _always
|
|
70 | 70 |
$(psqlAsBien) --no-align --field-separator=' ' --pset=footer=off <$< >$@ |
71 | 71 |
.PRECIOUS: %.out |
72 | 72 |
|
... | ... | |
74 | 74 |
|
75 | 75 |
##### |
76 | 76 |
|
77 |
test: _not_file $(addprefix test-,$(tables))
|
|
77 |
test: _always $(addprefix test-,$(tables))
|
|
78 | 78 |
|
79 |
test-%: test.%.ref test.%.out _not_file
|
|
79 |
test-%: test.%.ref test.%.out _always
|
|
80 | 80 |
$(DIFF) |
81 | 81 |
|
82 | 82 |
all += $(filter-out %.ref,$(wildcard test.*.out)) |
... | ... | |
96 | 96 |
mysqlAsRoot := $(call mysqlAs,root) |
97 | 97 |
mysqlAsBien := $(call mysqlAs,bien) |
98 | 98 |
|
99 |
import-%: map.VegBIEN.%.csv _not_file
|
|
100 |
$(importCmd)
|
|
101 |
importCmd = (set -x; "time" env commit=1 $(map) $<) \
|
|
99 |
import-%: map.VegBIEN.%.csv _always
|
|
100 |
-$($@_cmd)
|
|
101 |
import_cmd = (set -x; "time" env commit=1 $(map) $<) \
|
|
102 | 102 |
$(if $(n),,>>$(log)) 2>&1$(if $(n),|tee -a $(log)) |
103 | 103 |
|
104 | 104 |
%.ref: %.ref.sql |
... | ... | |
107 | 107 |
|
108 | 108 |
### |
109 | 109 |
|
110 |
install: _not_file db
|
|
110 |
install: _always db
|
|
111 | 111 |
|
112 |
uninstall: _not_file rm_db
|
|
112 |
uninstall: _always rm_db
|
|
113 | 113 |
|
114 |
db: src.$(db).sql _not_file
|
|
114 |
db: src.$(db).sql _always
|
|
115 | 115 |
-$(mysqlAsRoot) <$< |
116 | 116 |
echo "GRANT SELECT ON $(db).* TO 'bien'@'localhost';"|$(mysqlAsRoot) |
117 | 117 |
# ignore errors in db import so that GRANT will still be run |
118 | 118 |
|
119 |
rm_db: _not_file
|
|
119 |
rm_db: _always
|
|
120 | 120 |
-echo "REVOKE ALL ON $(db).* FROM 'bien'@'localhost';"|$(mysqlAsRoot) |
121 | 121 |
echo "DROP DATABASE IF EXISTS $(db);"|$(mysqlAsRoot) |
122 | 122 |
# ignore errors if grant not defined |
... | ... | |
129 | 129 |
|
130 | 130 |
#### |
131 | 131 |
|
132 |
test.%.out: map.VegBIEN.%.csv _not_file
|
|
132 |
test.%.out: map.VegBIEN.%.csv _always
|
|
133 | 133 |
env n=2 $(map) $< >$@ 2>&1 |
134 | 134 |
.PRECIOUS: test.%.out |
135 | 135 |
|
Also available in: Unified diff
Makefiles: Changed _not_file to _always because _not_file is sometimes used to force a file to always be remade