6
6
7
7
# ENV VARS
8
8
export SHELL := $(shell which sh)
9
+ export ARCH := $(shell arch)
9
10
export UNAME := $(shell uname -s)
10
- export ASDF_VERSION := v0.13 .1
11
+ export ASDF_VERSION := v0.14 .1
11
12
12
13
# check commands and OS
13
14
ifeq ($(UNAME ) , Darwin)
@@ -26,7 +27,7 @@ RESET := $(shell tput -Txterm sgr0)
26
27
27
28
# Usage: $(call check_bin,command_name)
28
29
define check_bin
29
- $( shell command -v $(1 ) 2 >/dev/null)
30
+ ! command -v $(1 ) >/dev/null 2>&1
30
31
endef
31
32
32
33
# Usage: $(call brew_install,package_name)
@@ -69,14 +70,16 @@ endif
69
70
70
71
brew : xcode # # install homebrew
71
72
ifeq ($(UNAME ) , Darwin)
72
- @if [ -z " $(call check_bin,brew)" ] ; then \
73
+ @if $(call check_bin,brew); then \
73
74
echo "Installing Homebrew..."; \
74
75
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
75
76
else \
76
77
echo "brew already installed."; \
77
78
fi
78
79
else ifeq ($(UNAME), Linux)
79
- @if [ -z "$(call check_bin,brew)" ] && [ "${ID_LIKE}" = "debian" ]; then \
80
+ @if [ "$(ARCH)" = "aarch64" ]; then \
81
+ echo "Homebrew on Linux is not supported on ARM processors."; \
82
+ elif $(call check_bin,brew) && [ "$(ID_LIKE)" = "debian" ]; then \
80
83
echo "Installing Homebrew..."; \
81
84
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
82
85
else \
87
90
endif
88
91
89
92
asdf : xcode # # install asdf
90
- @if [ -z " $( call check_bin,asdf) " ] ; then \
93
+ @if $(call check_bin,asdf) ; then \
91
94
echo " Installing asdf..." ; \
92
95
git clone https://github.com/asdf-vm/asdf.git ~ /.asdf --branch ${ASDF_VERSION} ; \
93
96
echo " To use asdf, add the following to your shell rc (.bashrc/.zshrc):" ; \
@@ -99,7 +102,7 @@ asdf: xcode ## install asdf
99
102
fi
100
103
101
104
devbox : # # install devbox
102
- @if [ -z " $( call check_bin,devbox) " ] ; then \
105
+ @if $(call check_bin,devbox) ; then \
103
106
echo " Installing devbox..." ; \
104
107
curl -fsSL https://get.jetpack.io/devbox | bash; \
105
108
else \
@@ -115,8 +118,19 @@ pre-commit: brew ## install pre-commit
115
118
sccache : brew # # install sccache
116
119
$(call brew_install,sccache)
117
120
118
- task : brew # # install taskfile
121
+ task : # # install taskfile
122
+ ifeq ($(UNAME ) , Darwin)
119
123
$(call brew_install,go-task)
124
+ else ifeq ($(UNAME), Linux)
125
+ @if $(call check_bin,task); then \
126
+ echo "Installing task..."; \
127
+ sh -c "$$(curl -sl https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin; \
128
+ else \
129
+ echo "task already installed."; \
130
+ fi
131
+ else
132
+ @echo "task installation not supported on this OS."
133
+ endif
120
134
121
135
help : # # show this help
122
136
@echo ' '
0 commit comments