Revision 383
Added by Aaron Marcuse-Kubitza almost 13 years ago
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) |
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