-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
67 lines (47 loc) · 1.98 KB
/
Copy pathMakefile
File metadata and controls
67 lines (47 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ── Variables ────────────────────────────────────────────────────────
BIN_DIR := $(CURDIR)/bin
UNAME_S := $(shell uname -s | tr '[:upper:]' '[:lower:]')
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_M),arm64)
ARCH := aarch64
else ifeq ($(UNAME_M),aarch64)
ARCH := aarch64
else
ARCH := $(UNAME_M)
endif
ifeq ($(UNAME_S),darwin)
DPRINT_TARGET := $(ARCH)-apple-darwin
else ifeq ($(UNAME_S),linux)
DPRINT_TARGET := $(ARCH)-unknown-linux-gnu
endif
DPRINT_VERSION := 0.54.0
DPRINT := $(BIN_DIR)/dprint
DPRINT_RELEASE_URL := https://github.com/dprint/dprint/releases/download/$(DPRINT_VERSION)/dprint-$(DPRINT_TARGET).zip
OBS := $(BIN_DIR)/obs
# ── Setup ────────────────────────────────────────────────────────────
.PHONY: setup clean reset-projects
setup: tools reset-projects
clean:
rm -rf $(BIN_DIR)
reset-projects:
@./scripts/reset-projects.sh
# ── Tools ────────────────────────────────────────────────────────────
.PHONY: tools obs
tools: $(DPRINT) obs
$(DPRINT):
@mkdir -p $(BIN_DIR)
@echo "Downloading dprint $(DPRINT_VERSION) for $(DPRINT_TARGET)..."
@curl -fsSL "$(DPRINT_RELEASE_URL)" -o $(BIN_DIR)/dprint.zip
@unzip -oq $(BIN_DIR)/dprint.zip -d $(BIN_DIR)
@rm $(BIN_DIR)/dprint.zip
@chmod +x $(DPRINT)
@echo "Installed dprint -> $(DPRINT)"
obs:
@mkdir -p $(BIN_DIR)
cd tools/obs && go build -o $(OBS) ./cmd/obs
# ── Lint ─────────────────────────────────────────────────────────────
.PHONY: lint check
lint: $(DPRINT)
$(DPRINT) fmt
check: $(DPRINT)
$(DPRINT) check