1 |
1 |
# Make
|
2 |
|
SHELL = /bin/bash
|
|
2 |
SHELL := /bin/bash
|
3 |
3 |
|
4 |
4 |
# OS
|
5 |
|
os = $(shell uname)
|
|
5 |
os := $(shell uname)
|
6 |
6 |
forOs = $(patsubst %,%-$(filter Linux Darwin,$(os)),$(1))
|
7 |
7 |
|
8 |
8 |
# Terminal
|
9 |
|
esc = '['
|
10 |
|
reset = $(esc)'0m'
|
11 |
|
emph = $(esc)'7m '
|
12 |
|
endEmph = ' '$(reset)
|
|
9 |
esc := '['
|
|
10 |
reset := $(esc)'0m'
|
|
11 |
emph := $(esc)'7m '
|
|
12 |
endEmph := ' '$(reset)
|
13 |
13 |
|
14 |
14 |
# User interaction
|
15 |
15 |
|
... | ... | |
19 |
19 |
getPassword = $(shell read -s -p $(emph)"Enter your $(1) password:"$(endEmph) \
|
20 |
20 |
REPLY; echo >&2; echo -n "$REPLY")
|
21 |
21 |
|
22 |
|
wait = read -p $(emph)'Press ENTER to continue:'$(endEmph) REPLY
|
|
22 |
wait := read -p $(emph)'Press ENTER to continue:'$(endEmph) REPLY
|
23 |
23 |
|
24 |
|
done = echo; echo $(emph)"Finished $@"$(endEmph); echo
|
|
24 |
done := echo; echo $(emph)"Finished $@"$(endEmph); echo
|
25 |
25 |
|
26 |
26 |
# Env
|
27 |
27 |
export PGOPTIONS = --client-min-messages=WARNING
|
... | ... | |
36 |
36 |
.PHONY: _not_file
|
37 |
37 |
|
38 |
38 |
%/: _not_file
|
39 |
|
$(if $(wildcard $@/Makefile*),$(MAKE) --directory=$@,)
|
|
39 |
-$(if $(wildcard $@/Makefile*),$(MAKE) --directory=$@ ,)
|
|
40 |
# ignore errors in sub-makes
|
40 |
41 |
|
41 |
42 |
#####
|
42 |
43 |
|
... | ... | |
64 |
65 |
|
65 |
66 |
postgres-: _not_file # other OSes
|
66 |
67 |
|
67 |
|
psqlOpts = --set ON_ERROR_STOP=1 --quiet
|
68 |
|
asPostgresAdmin = sudo -u postgres
|
69 |
|
psqlAsAdmin = $(asPostgresAdmin) psql $(psqlOpts)
|
70 |
|
psqlAsBien = ./util/psql_vegbien $(psqlOpts)
|
71 |
|
bienPassword = $(shell cat util/bien_password)
|
|
68 |
psqlOpts := --set ON_ERROR_STOP=1 --quiet
|
|
69 |
asPostgresAdmin:== sudo -u postgres
|
|
70 |
psqlAsAdmin := $(asPostgresAdmin) psql $(psqlOpts)
|
|
71 |
psqlAsBien := ./util/psql_vegbien $(psqlOpts)
|
|
72 |
bienPassword := $(shell cat util/bien_password)
|
72 |
73 |
|
73 |
74 |
postgres_user: _not_file
|
74 |
75 |
@echo $(emph)"At sudo password prompt, enter *your* password"$(endEmph)
|
... | ... | |
126 |
127 |
|
127 |
128 |
mysql-: _not_file # other OSes
|
128 |
129 |
|
129 |
|
mysqlAsRoot = mysql --user=root --password='$(bienPassword)'
|
|
130 |
mysqlAsRoot := mysql --user=root --password='$(bienPassword)'
|
130 |
131 |
|
131 |
132 |
mysql_user: _not_file
|
132 |
133 |
-$($@_cmd)
|
... | ... | |
140 |
141 |
|
141 |
142 |
#####
|
142 |
143 |
|
143 |
|
mysqlAsBien = mysql --user=bien --password='$(bienPassword)'
|
144 |
|
|
145 |
|
#####
|
146 |
|
|
147 |
144 |
inputs: _not_file $(wildcard ../../inputs/*/)
|
148 |
145 |
|
149 |
146 |
#####
|
Inputs now include inputs_Makefile to get mysql command, etc.