-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (25 loc) · 843 Bytes
/
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
VERSION := $(shell git describe --tags --always --dirty)
BUILD := $(shell git rev-parse HEAD)
LDFLAGS := -ldflags "-X main.Version=$(VERSION) -X main.Build=$(BUILD) -extldflags '-static'"
MKCERT := $(shell command -v mkcert 2> /dev/null)
.PHONY: all
all: clean test build
.PHONY: test
test:
go test -v -cover -race
.PHONY: build
build:
CGO_ENABLED=0 go build $(LDFLAGS) -o $(PWD)/bin ./...
.PHONY: clean
clean:
rm -f $(PWD)/bin/*
.PHONY: certs
certs:
ifdef $(MKCERT)
openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout test-key.pem -out test-cert.pem -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=localhost" -addext "subjectAltName = DNS:localhost,IP:127.0.0.1,IP:::1"
else
mkcert -cert-file test-cert.pem -key-file test-key.pem localhost 127.0.0.1 ::1
endif
.PHONY: commandgen
commandgen:
go run $(PWD)/commandgen/main.go