-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (22 loc) · 959 Bytes
/
Makefile
File metadata and controls
29 lines (22 loc) · 959 Bytes
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
BINARY := yaad
PKG := ./cmd/yaad
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
LDFLAGS := -ldflags="-s -w -X main.version=$(VERSION)"
.PHONY: build run test clean install release
build:
CGO_ENABLED=0 go build $(LDFLAGS) -o $(BINARY) $(PKG)
run: build
./$(BINARY)
test:
CGO_ENABLED=0 go test -count=1 ./...
clean:
rm -f $(BINARY)
install:
CGO_ENABLED=0 go install $(LDFLAGS) $(PKG)
# Cross-compile release binaries
release:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o dist/yaad_darwin_amd64 $(PKG)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o dist/yaad_darwin_arm64 $(PKG)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o dist/yaad_linux_amd64 $(PKG)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o dist/yaad_linux_arm64 $(PKG)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o dist/yaad_windows_amd64.exe $(PKG)