summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-09-23 10:39:51 -0400
committerAndrew Cady <d@cryptonomic.net>2022-09-23 10:40:05 -0400
commit259cd8442ca4132257c7699076c48a9dff376ee4 (patch)
treef94babe930d06eed0814555e91ac9a35657b990a
parent563497c8b6f194415faf5cb0e97040cc1db0695c (diff)
Makefile: automatically install stack if needed
"install-stack" target will try more methods
-rw-r--r--Makefile24
1 files changed, 20 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index b082c3d..1303b5e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,9 @@
1all: 1stack_path != which stack
2
3all: $(if $(stack_path),,install-stack)
2 stack build 4 stack build
3 ln -sfT $$(stack path --local-install-root)/bin ./bin 5 ln -sfT $$(stack path --local-install-root)/bin ./bin
4 6
5install-stack:
6 curl -sSL https://get.haskellstack.org/ | sh
7
8.PHONY: all run install install-dev-tools 7.PHONY: all run install install-dev-tools
9 8
10run: all 9run: all
@@ -15,3 +14,20 @@ install:
15 14
16install-dev-tools: 15install-dev-tools:
17 stack install apply-refact hlint stylish-haskell hasktags hoogle 16 stack install apply-refact hlint stylish-haskell hasktags hoogle
17
18become_root != [ "$$(id -u)" = 0 ] || echo sudo
19install-stack:
20ifneq (,$(shell which curl))
21 curl -sSL https://get.haskellstack.org/ | sh
22else
23ifneq (,$(shell which wget))
24 wget -qO- https://get.haskellstack.org/ | sh
25else
26ifneq (,$(shell which apt))
27 $(become_root) apt install haskell-stack
28else
29 $(error No stack binary found; and no known means of installing (no curl, wget, or apt).\
30 Follow instructions at <https://haskellstack.org>)
31endif
32endif
33endif