-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
51 lines (38 loc) · 1.43 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
# SPDX-FileCopyrightText: © nobody
# SPDX-License-Identifier: CC0-1.0
GO?=$(shell which go)
BUILD_OPTS?=-trimpath -v
VERSION?=$(shell git describe --always --dirty || echo 0.2.1)
GO_LDFLAGS:=
GO_LDFLAGS+=-X main.Version=$(VERSION)
GO_LDFLAGS+=$(EXTRA_GO_LDFLAGS)
GOSRC!=find * -type f \( -name '*.go' -and -not -name '*_test.go' \)
GOSRC+=go.mod go.sum
DESTDIR?=
PREFIX?=/usr
BINDIR?=$(PREFIX)/bin
all: uniview univiewd
uniview: $(GOSRC) protocol/uniview.pb.go protocol/uniview_grpc.pb.go
$(GO) build $(BUILD_OPTS) -ldflags "$(GO_LDFLAGS)" -o $@
univiewd: uniview
ln -f $< $@
protocol/uniview.pb.go: protocol/uniview.proto tools/protoc-gen-go
protoc --plugin=tools/protoc-gen-go \
--go_out=./ \
--go_opt=paths=source_relative \
$<
protocol/uniview_grpc.pb.go: protocol/uniview.proto tools/protoc-gen-go-grpc
protoc --plugin=tools/protoc-gen-go-grpc \
--go-grpc_out=./ \
--go-grpc_opt=paths=source_relative \
$<
tools/protoc-gen-go: go.mod
$(GO) build -o $@ -v google.golang.org/protobuf/cmd/protoc-gen-go
tools/protoc-gen-go-grpc: go.mod
$(GO) build -o $@ -v google.golang.org/grpc/cmd/protoc-gen-go-grpc
.PHONY: install
install:
install -Dm755 uniview $(DESTDIR)$(BINDIR)/uniview
install -Dm755 uniview $(DESTDIR)$(BINDIR)/univiewd
install -Dm755 contrib/uniview.desktop $(DESTDIR)$(PREFIX)/share/applications/uniview.desktop
install -Dm755 contrib/icon.svg $(DESTDIR)$(PREFIX)/share/icons/hicolor/scalable/apps/uniview.svg