Revision 383
Added by Aaron Marcuse-Kubitza about 13 years ago
inputs/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 |
|
Makefile | ||
---|---|---|
32 | 32 |
|
33 | 33 |
##### |
34 | 34 |
|
35 |
all: _not_file install
|
|
35 |
all: _always install
|
|
36 | 36 |
|
37 | 37 |
.SUFFIXES: |
38 | 38 |
|
39 |
_not_file:
|
|
40 |
.PHONY: _not_file
|
|
39 |
_always:
|
|
40 |
.PHONY: _always
|
|
41 | 41 |
|
42 | 42 |
##### |
43 | 43 |
|
44 |
install: _not_file core mysql inputs test
|
|
44 |
install: _always core mysql inputs test
|
|
45 | 45 |
@$(done) |
46 | 46 |
|
47 |
uninstall: _not_file rm_inputs rm_mysql rm_core
|
|
47 |
uninstall: _always rm_inputs rm_mysql rm_core
|
|
48 | 48 |
|
49 |
reinstall: _not_file uninstall install
|
|
49 |
reinstall: _always uninstall install
|
|
50 | 50 |
|
51 | 51 |
##### |
52 | 52 |
|
53 |
core: _not_file $(call forOs,python postgres) postgres_user db
|
|
53 |
core: _always $(call forOs,python postgres) postgres_user db
|
|
54 | 54 |
@$(done) |
55 | 55 |
|
56 |
rm_core: _not_file rm_db rm_postgres_user
|
|
56 |
rm_core: _always rm_db rm_postgres_user
|
|
57 | 57 |
|
58 |
reinstall_core: _not_file rm_core core
|
|
58 |
reinstall_core: _always rm_core core
|
|
59 | 59 |
|
60 |
python-Linux: _not_file
|
|
60 |
python-Linux: _always
|
|
61 | 61 |
-sudo apt-get install python python-dev python-dateutil python-pip |
62 | 62 |
|
63 |
python-Darwin: _not_file
|
|
63 |
python-Darwin: _always
|
|
64 | 64 |
@echo $(emph)'Installing python-dateutil on Mac OS X:'$(endEmph) |
65 | 65 |
@echo 'Download it: http://labix.org/download/python-dateutil/python-dateutil-1.5.tar.gz' |
66 | 66 |
@echo 'Extract the archive' |
... | ... | |
83 | 83 |
editApachePortsConf = echo $$'1\n,s/\\b80\\b/8080/g\nwq'|\ |
84 | 84 |
sudo ed --loose-exit-status --verbose /etc/apache2/ports.conf |
85 | 85 |
|
86 |
postgres-Linux: _not_file
|
|
86 |
postgres-Linux: _always
|
|
87 | 87 |
-sudo apt-get install postgresql libpq-dev phppgadmin |
88 | 88 |
$(editPhppgadminApacheConf) |
89 | 89 |
$(editApacheConfForPhppgadmin) |
... | ... | |
92 | 92 |
-sudo pip install psycopg2 |
93 | 93 |
# ignore errors if conf files already edited |
94 | 94 |
|
95 |
postgres-Darwin: _not_file
|
|
95 |
postgres-Darwin: _always
|
|
96 | 96 |
@echo $(emph)'Installing PostgreSQL on Mac OS X:'$(endEmph) |
97 | 97 |
@echo 'Download it using the topmost "Mac OS X" link at http://http://www.enterprisedb.com/products-services-training/pgdownload' |
98 | 98 |
@echo 'Open the disk image' |
99 | 99 |
@echo 'Run the installer in it' |
100 | 100 |
@$(wait) |
101 | 101 |
|
102 |
postgres-: _not_file # other OSes
|
|
102 |
postgres-: _always # other OSes
|
|
103 | 103 |
|
104 | 104 |
psqlOpts := --set ON_ERROR_STOP=1 --quiet |
105 | 105 |
psqlAsAdmin := sudo -u postgres psql $(psqlOpts) |
106 | 106 |
psqlAsBien := ./bin/psql_vegbien $(psqlOpts) |
107 | 107 |
bienPassword := $(shell cat config/bien_password) |
108 | 108 |
|
109 |
postgres_user: _not_file
|
|
109 |
postgres_user: _always
|
|
110 | 110 |
-echo "CREATE USER bien PASSWORD '$(bienPassword)';"|$(psqlAsAdmin) |
111 | 111 |
# ignore errors if user exists |
112 | 112 |
|
113 |
rm_postgres_user: _not_file
|
|
113 |
rm_postgres_user: _always
|
|
114 | 114 |
echo "DROP USER IF EXISTS bien;"|$(psqlAsAdmin) |
115 | 115 |
|
116 | 116 |
##### |
117 | 117 |
|
118 |
db: _not_file
|
|
119 |
-$(dbCreateCmd)
|
|
118 |
db: _always
|
|
119 |
-$($@_create_cmd)
|
|
120 | 120 |
$(psqlAsBien) <mappings/schemas/vegbien.sql |
121 | 121 |
# ignore errors if database exists |
122 |
dbCreateCmd = echo "CREATE DATABASE vegbien OWNER bien ENCODING 'UTF8' \
|
|
122 |
db_create_cmd = echo "CREATE DATABASE vegbien OWNER bien ENCODING 'UTF8' \
|
|
123 | 123 |
TEMPLATE template1;"|$(psqlAsAdmin) |
124 | 124 |
|
125 |
rm_db: _not_file
|
|
125 |
rm_db: _always
|
|
126 | 126 |
echo "DROP DATABASE IF EXISTS vegbien;"|$(psqlAsAdmin) |
127 | 127 |
|
128 |
reinstall_db: _not_file rm_db db
|
|
128 |
reinstall_db: _always rm_db db
|
|
129 | 129 |
|
130 |
empty_db: _not_file
|
|
130 |
empty_db: _always
|
|
131 | 131 |
$(psqlAsBien) <mappings/schemas/vegbien_empty.sql |
132 | 132 |
|
133 | 133 |
##### |
134 | 134 |
|
135 |
mysql: _not_file $(call forOs,mysql) mysql_user
|
|
135 |
mysql: _always $(call forOs,mysql) mysql_user
|
|
136 | 136 |
@$(done) |
137 | 137 |
|
138 |
rm_mysql: _not_file rm_mysql_user
|
|
138 |
rm_mysql: _always rm_mysql_user
|
|
139 | 139 |
|
140 |
mysql-Linux: _not_file
|
|
140 |
mysql-Linux: _always
|
|
141 | 141 |
@echo $(emph)"If asked for MySQL root password, enter $(bienPassword)"$(endEmph) |
142 | 142 |
@$(wait) |
143 | 143 |
-sudo apt-get install mysql-server mysql-client python-mysqldb |
144 | 144 |
|
145 |
mysql-Darwin: _not_file
|
|
145 |
mysql-Darwin: _always
|
|
146 | 146 |
@echo $(emph)'Installing MySQLdb Python driver on Mac OS X 10.7 (may work on other versions):'$(endEmph) |
147 | 147 |
@echo 'Download it using "latest version" link at http://sourceforge.net/projects/mysql-python/files/' |
148 | 148 |
@echo 'Extract the archive' |
... | ... | |
159 | 159 |
@echo "Run python -c 'import MySQLdb'" |
160 | 160 |
@$(wait) |
161 | 161 |
|
162 |
mysql-: _not_file # other OSes
|
|
162 |
mysql-: _always # other OSes
|
|
163 | 163 |
|
164 | 164 |
mysqlAsRoot := mysql --user=root --password='$(bienPassword)' |
165 | 165 |
|
166 |
mysql_user: _not_file
|
|
166 |
mysql_user: _always
|
|
167 | 167 |
-$($@_cmd) |
168 | 168 |
# ignore errors if user exists |
169 | 169 |
mysql_user_cmd = echo "CREATE USER 'bien'@'localhost' IDENTIFIED BY \ |
170 | 170 |
'$(bienPassword)';"|$(mysqlAsRoot) |
171 | 171 |
|
172 |
rm_mysql_user: _not_file
|
|
172 |
rm_mysql_user: _always
|
|
173 | 173 |
-echo "DROP USER 'bien'@'localhost';"|$(mysqlAsRoot) |
174 | 174 |
# ignore errors if user exists |
175 | 175 |
|
... | ... | |
177 | 177 |
|
178 | 178 |
inputs := $(wildcard inputs/*/) |
179 | 179 |
|
180 |
inputs: _not_file $(addsuffix install,$(inputs))
|
|
180 |
inputs: _always $(addsuffix install,$(inputs))
|
|
181 | 181 |
|
182 |
rm_inputs: _not_file $(addsuffix uninstall,$(inputs))
|
|
182 |
rm_inputs: _always $(addsuffix uninstall,$(inputs))
|
|
183 | 183 |
|
184 |
verify: _not_file $(addsuffix verify,$(inputs))
|
|
184 |
verify: _always $(addsuffix verify,$(inputs))
|
|
185 | 185 |
|
186 |
test2: _not_file $(addsuffix test,$(inputs))
|
|
186 |
test2: _always $(addsuffix test,$(inputs))
|
|
187 | 187 |
|
188 |
inputs/%: _not_file
|
|
188 |
inputs/%: _always
|
|
189 | 189 |
+$(subMake) |
190 | 190 |
# ignore errors in sub-makes |
191 | 191 |
|
192 | 192 |
##### |
193 | 193 |
|
194 |
test: _not_file test-map
|
|
194 |
test: _always test-map
|
|
195 | 195 |
@$(done) |
196 | 196 |
|
197 |
test-%: _not_file
|
|
197 |
test-%: _always
|
|
198 | 198 |
./test/$(*F) |
mappings/Makefile | ||
---|---|---|
4 | 4 |
|
5 | 5 |
##### |
6 | 6 |
|
7 |
all: _not_file misc
|
|
7 |
all: _always misc
|
|
8 | 8 |
$(MAKE) plots |
9 | 9 |
./join VegX VegBIEN |
10 | 10 |
./review |
11 | 11 |
|
12 | 12 |
.SUFFIXES: |
13 | 13 |
|
14 |
_not_file:
|
|
15 |
.PHONY: _not_file
|
|
14 |
_always:
|
|
15 |
.PHONY: _always
|
|
16 | 16 |
|
17 | 17 |
misc := schemas/vegbien.sql schemas/vegbien_empty.sql |
18 | 18 |
|
19 | 19 |
all = $(wildcard for_review/*.csv) \ |
20 | 20 |
$(filter-out VegX-%,$(wildcard *-VegBIEN.*.csv)) VegX-*.plots.csv $(misc) |
21 | 21 |
|
22 |
clean: _not_file
|
|
22 |
clean: _always
|
|
23 | 23 |
$(RM) $(all) |
24 | 24 |
|
25 | 25 |
%:: %.make |
... | ... | |
41 | 41 |
schemas/vegbien_empty.sql: schemas/vegbien.sql |
42 | 42 |
$(empty) |
43 | 43 |
|
44 |
VegX-VegBIEN.organisms.csv: _not_file
|
|
44 |
VegX-VegBIEN.organisms.csv: _always
|
|
45 | 45 |
$(bin)/in_place $@ $(sort) |
46 | 46 |
|
47 | 47 |
##### |
48 | 48 |
|
49 |
plots: _not_file $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
|
|
49 |
plots: _always $(subst .organisms.,.plots.,$(wildcard VegX-*.organisms.csv))
|
|
50 | 50 |
|
51 | 51 |
chRoot2PlotsLeftVegx =\ |
52 | 52 |
env \ |
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