66
77# ENV VARS
88export SHELL := $(shell which sh)
9+ export ARCH := $(shell arch)
910export UNAME := $(shell uname -s)
10- export ASDF_VERSION := v0.13 .1
11+ export ASDF_VERSION := v0.14 .1
1112
1213# check commands and OS
1314ifeq ($(UNAME ) , Darwin)
@@ -26,7 +27,7 @@ RESET := $(shell tput -Txterm sgr0)
2627
2728# Usage: $(call check_bin,command_name)
2829define check_bin
29- $( shell command -v $(1 ) 2 >/dev/null)
30+ ! command -v $(1 ) >/dev/null 2>&1
3031endef
3132
3233# Usage: $(call brew_install,package_name)
@@ -69,14 +70,16 @@ endif
6970
7071brew : xcode # # install homebrew
7172ifeq ($(UNAME ) , Darwin)
72- @if [ -z " $(call check_bin,brew)" ] ; then \
73+ @if $(call check_bin,brew); then \
7374 echo "Installing Homebrew..."; \
7475 /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
7576 else \
7677 echo "brew already installed."; \
7778 fi
7879else 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 \
8083 echo "Installing Homebrew..."; \
8184 /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
8285 else \
8790endif
8891
8992asdf : xcode # # install asdf
90- @if [ -z " $( call check_bin,asdf) " ] ; then \
93+ @if $(call check_bin,asdf) ; then \
9194 echo " Installing asdf..." ; \
9295 git clone https://github.com/asdf-vm/asdf.git ~ /.asdf --branch ${ASDF_VERSION} ; \
9396 echo " To use asdf, add the following to your shell rc (.bashrc/.zshrc):" ; \
@@ -99,7 +102,7 @@ asdf: xcode ## install asdf
99102 fi
100103
101104devbox : # # install devbox
102- @if [ -z " $( call check_bin,devbox) " ] ; then \
105+ @if $(call check_bin,devbox) ; then \
103106 echo " Installing devbox..." ; \
104107 curl -fsSL https://get.jetpack.io/devbox | bash; \
105108 else \
@@ -115,8 +118,19 @@ pre-commit: brew ## install pre-commit
115118sccache : brew # # install sccache
116119 $(call brew_install,sccache)
117120
118- task : brew # # install taskfile
121+ task : # # install taskfile
122+ ifeq ($(UNAME ) , Darwin)
119123 $(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
120134
121135help : # # show this help
122136 @echo ' '
0 commit comments