-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (40 loc) · 1.8 KB
/
Makefile
File metadata and controls
55 lines (40 loc) · 1.8 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
BUILDDIR ?= "./bin"
BUILDTIME=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
MAINFILE=cmd/main.go
LDFLAGS=-X "github.com/footprintai/go-certs/pkg/version.BuildTime=${BUILDTIME}"
tidy: ## Tidy go modules
./gomodtidy.sh
windows: ## Build for Windows
env GOOS=windows GOARCH=amd64 CGO_ENABLED=0 \
go build -ldflags '${LDFLAGS} -extldflags "-static"' -o ${BUILDDIR}/go-certs.windows.exe ${MAINFILE}
linux: ## Build for Linux
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -ldflags '${LDFLAGS} -extldflags "-static"' -o ${BUILDDIR}/go-certs.linux ${MAINFILE}
darwin: ## Build for Darwin (macOS)
env GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 \
go build -ldflags '${LDFLAGS} -extldflags "-static"' -o ${BUILDDIR}/go-certs.darwin ${MAINFILE}
darwinSilicon: ## Build for Darwin Silicon (macOS M1)
env GOOS=darwin GOARCH=arm64 CGO_ENABLED=0 \
go build -ldflags '${LDFLAGS} -extldflags "-static"' -o ${BUILDDIR}/go-certs.darwin-arm64 ${MAINFILE}
build: windows linux darwin darwinSilicon ## Build all platform binaries
@echo commitid: $(GITCOMMITID)
@echo buildtime: $(BUILDTIME)
local: ## Build for local development
mkdir -p ${BUILDDIR}
go build -ldflags '${LDFLAGS}' -o ${BUILDDIR}/go-certs ${MAINFILE}
test: ## Run tests
go test -v ./...
clean: ## Clean build artifacts
go clean
rm -rf ${BUILDDIR}
run: local ## Run local build
${BUILDDIR}/go-certs
generate: local ## Run generate command
${BUILDDIR}/go-certs generate
inspect: local ## Run inspect command
${BUILDDIR}/go-certs inspect
deps: ## Install dependencies
go get github.com/spf13/cobra
help: ## Display available commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $1, $2}'
.PHONY: tidy windows linux darwin darwinSilicon build local test clean run generate inspect deps help