Skip to content

Commit 91c87f2

Browse files
wip
1 parent f2afec7 commit 91c87f2

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

Makefile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# TODO: debug why it immediately crashes current terminal on macOS
2+
3+
.DEFAULT_GOAL := help
4+
SHELL := /bin/bash
5+
UNAME := $(shell uname -s)
6+
7+
GREEN := $(shell tput -Txterm setaf 2)
8+
YELLOW := $(shell tput -Txterm setaf 3)
9+
WHITE := $(shell tput -Txterm setaf 7)
10+
CYAN := $(shell tput -Txterm setaf 6)
11+
RESET := $(shell tput -Txterm sgr0)
12+
13+
.PHONY: all
14+
15+
all: check help homebrew just install xcode
16+
17+
check: ## verify running on macOS
18+
@echo "Verifying macOS..."
19+
$(shell [[ "${UNAME}" != "Darwin" ]] && echo "Not running on macOS"; exit 1)
20+
21+
xcode: check ## install xcode command line tools
22+
@echo "Installing Xcode command line tools..."
23+
$(shell xcode-select --install)
24+
25+
homebrew: check ## install homebrew
26+
@echo "Installing Homebrew..."
27+
$(shell /bin/bash -c "$$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")
28+
29+
just: check ## install justfile
30+
@echo "Installing Justfile..."
31+
$(shell brew install just)
32+
33+
install: xcode homebrew just ## install all dependencies
34+
35+
help: ## Show this help.
36+
@echo ''
37+
@echo 'Usage:'
38+
@echo ' ${YELLOW}make${RESET} ${GREEN}<target>${RESET}'
39+
@echo ''
40+
@echo 'Targets:'
41+
@awk 'BEGIN {FS = ":.*?## "} { \
42+
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
43+
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
44+
}' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)