-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (29 loc) · 1 KB
/
Makefile
File metadata and controls
37 lines (29 loc) · 1 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
GO_SRCS := $(shell find . -type f -name '*.go' -a ! \( -name 'zz_generated*' -o -name '*_test.go' \))
TAG_NAME = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
TAG_NAME_DEV = $(shell git describe --tags --abbrev=0 2>/dev/null)
GIT_COMMIT = $(shell git rev-parse --short=7 HEAD)
VERSION = $(or ${TAG_NAME},$(TAG_NAME_DEV)-dev)
bin/ipmi-api: $(GO_SRCS) set-version
CGO_ENABLED=0 go build -o "$@" ./main.go
bins := ipmi-api
bin/checksums.txt: $(addprefix bin/,$(bins))
sha256sum -b $(addprefix bin/,$(bins)) | sed 's/bin\///' > $@
bin/checksums.md: bin/checksums.txt
@echo "### SHA256 Checksums" > $@
@echo >> $@
@echo "\`\`\`" >> $@
@cat $< >> $@
@echo "\`\`\`" >> $@
.PHONY:
set-version:
@sed -Ei 's/Version:(\s+)".*",/Version:\1"$(VERSION)",/g' ./main.go
.PHONY: build-all
build-all: $(addprefix bin/,$(bins)) bin/checksums.md
$(golint):
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
.PHONY: lint
lint: $(golint)
$(golint) run ./...
.PHONY: clean
clean:
rm -rf bin/