-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
50 lines (39 loc) · 1.08 KB
/
Makefile
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
# Makefile for building the Go CLI application
# The output binary name
BINARY_NAME=mxlint
# Go related variables
GOBASE=$(shell pwd)
GOBIN=$(GOBASE)/bin
GOPKG=$(GOBASE)/cmd/$(BINARY_NAME)
# Go commands
GOBUILD=go build
GOCLEAN=go clean
GOTEST=go test
GOGET=go get
# Build targets
all: clean deps test build-macos build-windows build-macos-arm64
# Build for macOS
build-macos:
@echo "Building for macOS amd64..."
@GOOS=darwin GOARCH=amd64 $(GOBUILD) -o $(GOBIN)/$(BINARY_NAME)-darwin-amd64 $(GOPKG)
build-macos-arm64:
@echo "Building for macOS arm64..."
@GOOS=darwin GOARCH=arm64 $(GOBUILD) -o $(GOBIN)/$(BINARY_NAME)-darwin-arm64 $(GOPKG)
# Build for Windows
build-windows:
@echo "Building for Windows amd64..."
@GOOS=windows GOARCH=amd64 $(GOBUILD) -o $(GOBIN)/$(BINARY_NAME)-windows-amd64.exe $(GOPKG)
# Clean up binaries
clean:
@echo "Cleaning..."
@$(GOCLEAN)
@rm -f $(GOBIN)/$(BINARY_NAME)*
# Run tests
test:
@echo "Running tests"
@$(GOTEST) -v ./...
# Fetch dependencies
deps:
@echo "Fetching dependencies"
@go mod tidy
.PHONY: all build-macos build-windows clean test deps