-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (40 loc) · 1.3 KB
/
Copy pathMakefile
File metadata and controls
54 lines (40 loc) · 1.3 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
.ONESHELL:
.DELETE_ON_ERROR:
.SHELLFLAGS := -eu -c
SHELL := bash
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
BIN_DIR := bin
BINARY := $(BIN_DIR)/dfmicro
BUILD_TIME := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
LDFLAGS := -X dfmicro/internal/buildinfo.BuildTime=$(BUILD_TIME)
TOPOLVM_VERSION ?= 17.2.0
.PHONY: vet fmt generate generate-topolvm build build-cross build-release build-analyze build-fetch lint
vet:
go vet -tags fetch ./...
lint:
golangci-lint run
fmt:
go fmt ./...
generate: generate-topolvm
go generate ./internal/docs
generate-topolvm:
TOPOLVM_VERSION=$(TOPOLVM_VERSION) ./hack/generate-topolvm.sh
fix:
go fix -tags fetch ./...
build-fetch: fmt vet
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 go build -tags fetch -o $(BIN_DIR)/fetch ./cmd/fetch
build: fmt vet generate fix
$(MAKE) -s build-cross
install: build
install $(BINARY) ~/.local/bin
build-release: fmt vet generate
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 go build -trimpath -tags '!fetch' -ldflags="-s -w $(LDFLAGS)" -o $(BINARY) ./cmd/dfmicro
build-analyze: fmt vet generate
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 go build -trimpath -tags '!fetch' -ldflags="$(LDFLAGS)" -o $(BINARY) ./cmd/dfmicro
build-cross:
@mkdir -p $(BIN_DIR)
CGO_ENABLED=0 go build -tags '!fetch' -ldflags="$(LDFLAGS)" -o $(BINARY) ./cmd/dfmicro