@@ -26,13 +26,7 @@ RESET := $(shell tput -Txterm sgr0)
2626
2727# Usage: $(call check_bin,command_name)
2828define check_bin
29- $(shell \
30- if command -v $(1 ) >/dev/null 2>&1; then \
31- echo "false"; \
32- else \
33- echo "true"; \
34- fi \
35- )
29+ $(shell command -v $(1 ) 2>/dev/null)
3630endef
3731
3832# Usage: $(call brew_install,package_name)
@@ -44,7 +38,7 @@ define brew_install
4438 "go-task") binary_name="task" ;; \
4539 *) binary_name="$(1 ) " ;; \
4640 esac; \
47- if $(call check_bin,$$binary_name) ; then \
41+ if [ -z " $(call check_bin,$$binary_name) " ] ; then \
4842 echo "Installing $(1 ) ..."; \
4943 brew install $(1 ) ; \
5044 else \
5751
5852# targets
5953.PHONY : all
60- all : help asdf xcode brew jq pre-commit sccache task # # run all targets
54+ all : help install # # run all targets
55+
56+ install : xcode asdf brew devbox jq pre-commit sccache task # # install dependencies
6157
6258xcode : # # install xcode command line tools
6359ifeq ($(UNAME ) , Darwin)
@@ -73,14 +69,14 @@ endif
7369
7470brew : xcode # # install homebrew
7571ifeq ($(UNAME ) , Darwin)
76- @if $(call check_bin,brew); then \
72+ @if [ -z " $(call check_bin,brew)" ] ; then \
7773 echo "Installing Homebrew..."; \
7874 /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
7975 else \
8076 echo "brew already installed."; \
8177 fi
8278else ifeq ($(UNAME), Linux)
83- @if $(call check_bin,brew) && [ "${ID_LIKE}" = "debian" ]; then \
79+ @if [ -z " $(call check_bin,brew)" ] && [ "${ID_LIKE}" = "debian" ]; then \
8480 echo "Installing Homebrew..."; \
8581 /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
8682 else \
9187endif
9288
9389asdf : xcode # # install asdf
94- @if $(call check_bin,asdf) ; then \
90+ @if [ -z " $( call check_bin,asdf) " ] ; then \
9591 echo " Installing asdf..." ; \
9692 git clone https://github.com/asdf-vm/asdf.git ~ /.asdf --branch ${ASDF_VERSION} ; \
9793 echo " To use asdf, add the following to your shell rc (.bashrc/.zshrc):" ; \
@@ -102,6 +98,14 @@ asdf: xcode ## install asdf
10298 echo " asdf already installed." ; \
10399 fi
104100
101+ devbox : # # install devbox
102+ @if [ -z " $( call check_bin,devbox) " ]; then \
103+ echo " Installing devbox..." ; \
104+ curl -fsSL https://get.jetpack.io/devbox | bash; \
105+ else \
106+ echo " devbox already installed." ; \
107+ fi
108+
105109jq : brew # # install jq
106110 $(call brew_install,jq)
107111
@@ -114,8 +118,6 @@ sccache: brew ## install sccache
114118task : brew # # install taskfile
115119 $(call brew_install,go-task)
116120
117- install : xcode asdf brew jq pre-commit sccache task # # install dependencies
118-
119121help : # # show this help
120122 @echo ' '
121123 @echo ' Usage:'
0 commit comments