-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
286 lines (207 loc) · 6.53 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
instances = clouseau1 clouseau2 clouseau3
ifneq ($(WITH_COOKIE),)
with-cookie := -Dlauncher=with-cookie -Dcookie=$(WITH_COOKIE)
endif
.PHONY: help
# target: help - Print this help
help:
@egrep "^# target: " Makefile \
| sed -e 's/^# target: //g' \
| sort \
| awk '{printf(" %-20s", $$1); $$1=$$2=""; print "-" $$0}'
.PHONY: build
# target: build - Build package, run tests and create distribution
build: .asdf check-epmd
@mvn
# target: clouseau1 - Start local instance of clouseau1 node
# target: clouseau2 - Start local instance of clouseau2 node
# target: clouseau3 - Start local instance of clouseau3 node
$(instances): .asdf check-epmd
@mvn scala:run -Dname=$@ $(with-cookie)
.PHONY: clean
# target: clean - Remove build artifacts
clean:
@mvn clean
check-epmd:
@if ! pgrep epmd >>/dev/null 2>&1 ; then echo "Error: Please start 'epmd' first"; exit 1; fi
# ==========================
# Setting up the environment
# --------------------------
define CURRENT_SHELL
"$(shell basename $${SHELL})"
endef
define CURRENT_OS
"$(shell uname -s | tr '[:upper:]' '[:lower:]')"
endef
# Testing from fish
# set SHELL bash && make .asdf
# set SHELL fish && make .asdf
# set SHELL zsh && make .asdf
# set SHELL unsupported && make .asdf
# Testing from other shells
# SHELL=bash && make .asdf
# SHELL=fish && make .asdf
# SHELL=zsh && make .asdf
# SHELL=unsupported && make .asdf
ifndef ASDF_DIRENV_BIN
.asdf:
@case $(CURRENT_SHELL)-$(CURRENT_OS) in \
fish-darwin) echo "$$FISH_DARWIN_HELP" ;; \
bash-darwin) echo "$$BASH_DARWIN_HELP" ;; \
zsh-darwin) echo "$$ZSH_DARWIN_HELP" ;; \
*) echo "$$CONTRIBUTE_SHELL_SETUP" ;; \
esac
else
.asdf:
@touch $@
@touch .envrc
endif
define FISH_DARWIN_HELP
There are two steps which need to be done to set up environment.
- The asdf tool manager would need to be installed
- The direnv plugin for asdf manager would need to be installed
= Setting up asdf tool manager
You can install asdf from brew by following command.
```
brew install asdf
```
Once you finish installation add following line to ~/.config/fish/config.fish
```
source (brew --prefix asdf)/libexec/asdf.fish
```
You can do it by copy/paste of the following line
```
echo -e "\\nsource (brew --prefix asdf)/libexec/asdf.fish" >> ~/.config/fish/config.fish
```
= Setting up direnv
Run following commands to install direnv plugin
```
asdf plugin-add direnv
asdf install direnv latest
asdf global direnv latest
```
Once you have done with above commands add following to the ~/.config/fish/config.fish
```
# Hook direnv into your shell.
asdf exec direnv hook fish | source
# A shortcut for asdf managed direnv.
function direnv
asdf exec direnv "$$argv"
end
```
You can do it by copy/paste of the following
```
printf "\
# Hook direnv into your shell.
asdf exec direnv hook fish | source
# A shortcut for asdf managed direnv.
function direnv
asdf exec direnv \\"\$$argv\\"
end
" >> ~/.config/fish/config.fish
```
= Enabling direnv integration
- After finishing the above two steps restart your shell.
- Run following `asdf direnv setup --shell fish --version latest`
- Restart your shell once again
endef
export FISH_DARWIN_HELP
define BASH_DARWIN_HELP
There are two steps which need to be done to set up environment.
- The asdf tool manager would need to be installed
- The direnv plugin for asdf manager would need to be installed
= Setting up asdf tool manager
You can install asdf from brew by following command.
```
brew install asdf
```
Once you finish installation add following line to ~/.bash_profile
```
source $$(brew --prefix asdf)/libexec/asdf.sh
```
You can do it by copy/paste of the following line
```
echo -e "\n. $$(brew --prefix asdf)/libexec/asdf.sh" >> ~/.bash_profile
```
= Setting up direnv
Run following commands to install direnv plugin
```
asdf plugin-add direnv
asdf install direnv latest
asdf global direnv latest
```
Once you have done with above commands add following to the ~/.bash_profile
```
# Hook direnv into your shell.
eval "$$(asdf exec direnv hook bash)"
# A shortcut for asdf managed direnv.
direnv() { asdf exec direnv "$$@"; }
```
You can do it by copy/paste of the following
```
cat << EOF >> ~/.bashrc
# Hook direnv into your shell.
eval "$$(asdf exec direnv hook bash)"
# A shortcut for asdf managed direnv.
direnv() { asdf exec direnv "$$@"; }
EOF
```
= Enabling direnv integration
- After finishing the above two steps restart your shell.
- Run following `asdf direnv setup --shell bash --version latest`
- Restart your shell once again
endef
export BASH_DARWIN_HELP
define ZSH_DARWIN_HELP
There are two steps which need to be done to set up environment.
- The asdf tool manager would need to be installed
- The direnv plugin for asdf manager would need to be installed
= Setting up asdf tool manager
You can install asdf from brew by following command.
```
brew install asdf
```
Once you finish installation add following line to ~/.zshrc
(or ${ZDOTDIR}/.zshrc if you use custom location).
```
source $$(brew --prefix asdf)/libexec/asdf.sh
```
You can do it by copy/paste of the following line
```
echo -e "\n. $$(brew --prefix asdf)/libexec/asdf.sh" >> $${ZDOTDIR:-~}/.zshrc
```
= Setting up direnv
Run following commands to install direnv plugin
```
asdf plugin-add direnv
asdf install direnv latest
asdf global direnv latest
```
Once you have done with above commands add following to the ~/.zshrc
(or ${ZDOTDIR}/.zshrc if you use custom location).
```
# Hook direnv into your shell.
eval "$$(asdf exec direnv hook zsh)"
# A shortcut for asdf managed direnv.
direnv() { asdf exec direnv "$$@"; }
```
You can do it by copy/paste of the following
```
cat << EOF >> ~/.zshrc
# Hook direnv into your shell.
eval "$$(asdf exec direnv hook zsh)"
# A shortcut for asdf managed direnv.
direnv() { asdf exec direnv "$$@"; }
EOF
```
= Enabling direnv integration
- After finishing the above two steps restart your shell.
- Run following `asdf direnv setup --shell zsh --version latest`
- Restart your shell once again
endef
export ZSH_DARWIN_HELP
define CONTRIBUTE_SHELL_SETUP
We detected $(CURRENT_SHELL) running on $(CURRENT_OS). Unfortunately
documentation for this combination is not available. Contributions are welcome.
endef
export CONTRIBUTE_SHELL_SETUP