-
-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 1.32 KB
/
Makefile
File metadata and controls
68 lines (56 loc) · 1.32 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
68
REPO := github.com/edoardottt/scilla
BIN := scilla
BUILD_DIR := ./cmd/$(BIN)
INSTALL_PATH := /usr/local/bin/$(BIN)
.PHONY: tidy remod update lint linux unlinux test
tidy:
@echo "Tidying modules..."
@go get -u ./...
@go mod tidy -v
fmt:
@gofmt -s ./*
@echo "Done."
remod:
@echo "Reinitializing modules..."
@rm -f go.mod go.sum
@go mod init $(REPO)
@go get
@echo "Done."
update: unlinux
@echo "Updating modules..."
@go get -u ./...
@go mod tidy -v
@git pull
@$(MAKE) linux
@echo "Done."
lint:
@echo "Running linter..."
@golangci-lint run
linux:
@echo "Building for Linux..."
@go build -o $(BIN) $(BUILD_DIR)
@sudo mv $(BIN) $(INSTALL_PATH)
@chmod +x scripts/config.sh
@./scripts/config.sh
@echo "Installed at $(INSTALL_PATH)."
linux-arm64:
@echo "Building for Linux ARM64..."
@GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o $(BIN)-arm64 $(BUILD_DIR)
@echo "Output: $(BIN)-arm64"
windows:
@echo "Building for Windows..."
@GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o $(BIN).exe $(BUILD_DIR)
@echo "Output: $(BIN).exe"
unlinux:
@echo "Removing Linux binary..."
@sudo rm -f $(INSTALL_PATH)
@rm -rf ~/.config/scilla
@echo "Done."
test:
@echo "Running tests..."
@go test -race ./...
@echo "Done."
clean:
@echo "Cleaning up build artifacts..."
@rm -f $(BIN) $(BIN).exe $(BIN)-arm64
@echo "Cleaned."