@@ -26,13 +26,7 @@ RESET := $(shell tput -Txterm sgr0)
26
26
27
27
# Usage: $(call check_bin,command_name)
28
28
define 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)
36
30
endef
37
31
38
32
# Usage: $(call brew_install,package_name)
@@ -44,7 +38,7 @@ define brew_install
44
38
"go-task") binary_name="task" ;; \
45
39
*) binary_name="$(1 ) " ;; \
46
40
esac; \
47
- if $(call check_bin,$$binary_name) ; then \
41
+ if [ -z " $(call check_bin,$$binary_name) " ] ; then \
48
42
echo "Installing $(1 ) ..."; \
49
43
brew install $(1 ) ; \
50
44
else \
57
51
58
52
# targets
59
53
.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
61
57
62
58
xcode : # # install xcode command line tools
63
59
ifeq ($(UNAME ) , Darwin)
@@ -73,14 +69,14 @@ endif
73
69
74
70
brew : xcode # # install homebrew
75
71
ifeq ($(UNAME ) , Darwin)
76
- @if $(call check_bin,brew); then \
72
+ @if [ -z " $(call check_bin,brew)" ] ; then \
77
73
echo "Installing Homebrew..."; \
78
74
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
79
75
else \
80
76
echo "brew already installed."; \
81
77
fi
82
78
else ifeq ($(UNAME), Linux)
83
- @if $(call check_bin,brew) && [ "${ID_LIKE}" = "debian" ]; then \
79
+ @if [ -z " $(call check_bin,brew)" ] && [ "${ID_LIKE}" = "debian" ]; then \
84
80
echo "Installing Homebrew..."; \
85
81
/bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; \
86
82
else \
91
87
endif
92
88
93
89
asdf : xcode # # install asdf
94
- @if $(call check_bin,asdf) ; then \
90
+ @if [ -z " $( call check_bin,asdf) " ] ; then \
95
91
echo " Installing asdf..." ; \
96
92
git clone https://github.com/asdf-vm/asdf.git ~ /.asdf --branch ${ASDF_VERSION} ; \
97
93
echo " To use asdf, add the following to your shell rc (.bashrc/.zshrc):" ; \
@@ -102,6 +98,14 @@ asdf: xcode ## install asdf
102
98
echo " asdf already installed." ; \
103
99
fi
104
100
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
+
105
109
jq : brew # # install jq
106
110
$(call brew_install,jq)
107
111
@@ -114,8 +118,6 @@ sccache: brew ## install sccache
114
118
task : brew # # install taskfile
115
119
$(call brew_install,go-task)
116
120
117
- install : xcode asdf brew jq pre-commit sccache task # # install dependencies
118
-
119
121
help : # # show this help
120
122
@echo ' '
121
123
@echo ' Usage:'
0 commit comments