mirror of
https://github.com/status-im/sshfp-generator.git
synced 2025-01-31 14:54:51 +00:00
add Makefile for building releases
Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
39310262b7
commit
3d707c9fc9
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,6 +4,7 @@
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
/bin
|
||||
/sshfp-updater
|
||||
|
||||
# Test binary, built with `go test -c`
|
||||
|
47
Makefile
Normal file
47
Makefile
Normal file
@ -0,0 +1,47 @@
|
||||
VERSION = $(shell cat VERSION)
|
||||
BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
GIT_HASH = $(shell git rev-parse HEAD)
|
||||
|
||||
PACKAGE = sshfp-updater
|
||||
BUILDS = linux-amd64 linux-386 linux-arm64 linux-mips64 windows-amd64.exe freebsd-amd64 darwin-amd64 darwin-arm64
|
||||
BINARIES = $(addprefix bin/$(PACKAGE)-$(VERSION)-, $(BUILDS))
|
||||
CHECKSUMS = bin/$(PACKAGE)-$(VERSION).sha256
|
||||
|
||||
LDFLAGS=-ldflags "-X main.Version=$(VERSION) -X main.BuildDate=$(BUILD_DATE) -X main.GitHash=$(GIT_HASH)"
|
||||
|
||||
$(PACKAGE): cmd/$(PACKAGE)
|
||||
go build -v -o $@ ./$^
|
||||
|
||||
release: $(BINARIES) checksums
|
||||
checksums: $(CHECKSUMS)
|
||||
|
||||
bin:
|
||||
mkdir $@
|
||||
|
||||
bin/$(PACKAGE)-$(VERSION)-linux-%: bin
|
||||
env GOOS=linux GOARCH=$* CGO_ENABLED=0 go build $(LDFLAGS) -o $@ ./cmd/$(PACKAGE)
|
||||
|
||||
bin/$(PACKAGE)-$(VERSION)-darwin-%: bin
|
||||
env GOOS=darwin GOARCH=$* CGO_ENABLED=0 go build $(LDFLAGS) -o $@ ./cmd/$(PACKAGE)
|
||||
|
||||
bin/$(PACKAGE)-$(VERSION)-windows-%.exe: bin
|
||||
env GOOS=windows GOARCH=$* CGO_ENABLED=0 go build $(LDFLAGS) -o $@ ./cmd/$(PACKAGE)
|
||||
|
||||
bin/$(PACKAGE)-$(VERSION)-freebsd-%: bin
|
||||
env GOOS=freebsd GOARCH=$* CGO_ENABLED=0 go build $(LDFLAGS) -o $@ ./cmd/$(PACKAGE)
|
||||
|
||||
$(CHECKSUMS):
|
||||
sha256sum $(BINARIES) > $@
|
||||
|
||||
compile-analysis: cmd/$(PACKAGE)
|
||||
go build -gcflags '-m' ./$^
|
||||
|
||||
code-quality:
|
||||
-go vet ./cmd/$(PACKAGE)
|
||||
-gofmt -s -d ./cmd/$(PACKAGE)
|
||||
-golint ./cmd/$(PACKAGE)
|
||||
-gocyclo ./cmd/$(PACKAGE)
|
||||
-ineffassign ./cmd/$(PACKAGE)
|
||||
|
||||
test:
|
||||
go test -v ./cmd/$(PACKAGE)
|
Loading…
x
Reference in New Issue
Block a user