-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
54 lines (42 loc) · 1.36 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
51
52
53
54
# SPDX-FileCopyrightText: 2023 Christoph Mewes
# SPDX-License-Identifier: MIT
GIT_VERSION = $(shell git describe --tags --always)
GIT_HEAD ?= $(shell git log -1 --format=%H)
NOW_GO_RFC339 = $(shell date --utc +'%Y-%m-%dT%H:%M:%SZ')
export CGO_ENABLED ?= 0
export GOFLAGS ?= -mod=readonly -trimpath
OUTPUT_DIR ?= _build
GO_DEFINES ?= -X main.BuildTag=$(GIT_VERSION) -X main.BuildCommit=$(GIT_HEAD) -X main.BuildDate=$(NOW_GO_RFC339)
GO_LDFLAGS += -w -extldflags '-static' $(GO_DEFINES)
GO_BUILD_FLAGS ?= -v -ldflags '$(GO_LDFLAGS)'
GO_TEST_FLAGS ?= -v -race
default: build
.PHONY: build
build:
go build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/ ./cmd/clusterdumper
go build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/ ./cmd/swaggerdumper
go build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/ ./cmd/render
go build $(GO_BUILD_FLAGS) -o $(OUTPUT_DIR)/ ./cmd/apidocs
.PHONY: test
test:
CGO_ENABLED=1 go test $(GO_TEST_FLAGS) ./...
.PHONY: clean
clean:
rm -rf $(OUTPUT_DIR)
.PHONY: lint
lint:
golangci-lint run ./...
.PHONY: full-rebuild
full-rebuild: clean build dump-swagger render
.PHONY: dump-swagger
dump-swagger: build
./hack/dump-swagger-specs.sh
.PHONY: render
render: build quickrender
hack/tidy-html.sh
.PHONY: quickrender
quickrender:
ASSET_STAMP=$(GIT_HEAD) _build/render
.PHONY: deploy
deploy:
rsync --delete --recursive public/ [email protected]:/srv/www/kube-api.ninja/public