-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (44 loc) · 1.76 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
55
56
57
58
59
60
61
62
PROG:=tapir-slogger
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}
# ../tapir/tapir.pb.go: ../tapir/tapir.proto
# make -C ../tapir tapir.pb.go
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
# gen-mqtt-msg-new-qname.go: checkout/events-mqtt-message-new_qname.json
# go-jsonschema checkout/events-mqtt-message-new_qname.json --package main --tags json --only-models --output gen-mqtt-msg-new-qname.go
# gen-mqtt-msg.go: checkout/events-mqtt-message.json
# go-jsonschema checkout/events-mqtt-message.json --package main --tags json --only-models --output gen-mqtt-msg.go
# checkout/events-mqtt-message-new_qname.json: checkout
# cd checkout; python schemasplit.py events-mqtt-message-new_qname.yaml
# checkout/events-mqtt-message.json: checkout
# cd checkout; python schemasplit.py events-mqtt-message.yaml
# checkout:
# git clone [email protected]:dnstapir/protocols.git checkout
clean:
@rm -f $(PROG) *~ version.go
install:
mkdir -p /usr/local/libexec
install -b -c -s ${PROG} /usr/local/libexec/
.PHONY: build clean generate