summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6a6d3400b34bc6cb7bc1f0f0b679491973354b09 (plain)
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
.PHONY: build

VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%s)

all: portmap.pb.go goimports vet
	@echo This GO code passes the compile checks

portmap.pb.go: portmap.proto
	make generate

generate: clean
	go mod init
	go mod tidy
	go generate

go-generate:
	rm -f *.pb.go *.patch

gocui: build
	./gus --gui gocui --config /etc/gus/gus.text >/tmp/gocui.log 2>&1

build: goimports vet
	GO111MODULE=off go build -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME}"

install: goimports vet
	GO111MODULE=off go install \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME}"

install-verbose: goimports vet
	GO111MODULE=off go install -v -x \
		-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME}"

goimports:
	goimports -w *.go

vet:
	@GO111MODULE=off go vet

clean:
	rm -f *.pb.go *.patch *.deb
	-rm -f go.*
	go-mod-clean purge

# fixes your numbers if you move things around
# THIS TOTALLY BREAKS THE POINT OF PROTOBUF
# To work around that breaking, you must change the version
# also, all the wrapping code must support this. which it doesn't
proto-renumber: clean
	autogenpb --renumber --proto portmap.proto
	make goimports vet