-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
45 lines (32 loc) · 1 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
PROG:=tapir-pop
VERSION:=`cat ./VERSION`
COMMIT:=`git describe --dirty=+WiP --always`
APPDATE=`date +"%Y-%m-%d-%H:%M"`
GOFLAGS:=-v -ldflags "-X app.version=$(VERSION)-$(COMMIT)"
GOOS ?= $(shell uname -s | tr A-Z a-z)
GO:=GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go
# GO:=GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 go
default: ${PROG}
${PROG}: build
version.go:
/bin/sh make-version.sh $(VERSION)-$(COMMIT) $(APPDATE) $(PROG)
build: version.go # ../tapir/tapir.pb.go
$(GO) build $(GOFLAGS) -o ${PROG}
lint:
go fmt ./...
go vet ./...
staticcheck ./...
gosec ./...
golangci-lint run
linux:
/bin/sh make-version.sh $(VERSION)-$(COMMIT) $(APPDATE) $(PROG)
GOOS=linux GOARCH=amd64 go build $(GOFLAGS) -o ${PROG}.linux
netbsd:
/bin/sh make-version.sh $(VERSION)-$(COMMIT) $(APPDATE) $(PROG)
GOOS=netbsd GOARCH=amd64 go build $(GOFLAGS) -o ${PROG}.netbsd
clean:
@rm -f $(PROG) *~ version.go
install:
mkdir -p /usr/local/libexec
install -b -c -s ${PROG} /usr/local/libexec/
.PHONY: build clean generate