-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (60 loc) · 1.84 KB
/
Makefile
File metadata and controls
69 lines (60 loc) · 1.84 KB
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
63
64
65
66
67
68
69
# Check for OS
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
BUILD_CGO_ENABLED ?= 1
else
BUILD_CGO_ENABLED ?= 0
endif
.PHONY: all
all: tkey-runapp
DESTDIR=/
PREFIX=/usr/local
UDEVDIR=/etc/udev
destbin=$(DESTDIR)/$(PREFIX)/bin
destrules=$(DESTDIR)/$(UDEVDIR)/rules.d
.PHONY: install
install:
install -Dm755 tkey-runapp $(destbin)/tkey-runapp
install -Dm755 hidread $(destbin)/hidread
install -Dm755 run-tkey-qemu $(destbin)/run-tkey-qemu
install -Dm644 system/60-tkey.rules $(destrules)/60-tkey.rules
.PHONY: uninstall
uninstall:
rm -f \
$(destbin)/tkey-runapp \
$(destbin)/hidread \
$(destbin)/run-tkey-qemu \
$(destrules)/60-tkey.rules \
.PHONY: reload-rules
reload-rules:
udevadm control --reload
udevadm trigger
podman:
podman run --rm --mount type=bind,source=$(CURDIR),target=/src --mount type=bind,source=$(CURDIR)/../tkey-libs,target=/tkey-libs -w /src -it ghcr.io/tillitis/tkey-builder:5rc2 make -j
TKEY_DEVTOOLS_VERSION ?= $(shell git describe --dirty --always | sed -n "s/^v\(.*\)/\1/p")
TKEY_RUNAPP_VERSION ?= $(TKEY_DEVTOOLS_VERSION)
HIDREAD_VERSION ?= $(TKEY_DEVTOOLS_VERSION)
# .PHONY to let go-build handle deps and rebuilds
.PHONY: tkey-runapp
tkey-runapp:
cd cmd/tkey-runapp && \
CGO_ENABLED=$(BUILD_CGO_ENABLED) go build -ldflags "-w -X main.version=$(TKEY_RUNAPP_VERSION) -buildid=" -trimpath -buildvcs=false && \
mv tkey-runapp ../../
.PHONY: hidread
hidread:
cd cmd/hidread && \
go build -ldflags "-w -X main.version=$(HIDREAD_VERSION) -buildid=" -trimpath -buildvcs=false && \
mv hidread ../../
.PHONY: clean
clean:
rm -f tkey-runapp
rm -f hidread
.PHONY: lint
lint:
cd cmd/hidread && golangci-lint run
cd cmd/tkey-runapp && golangci-lint run
# Extra target just for CI that excludes hidread since we can't build
# CGO dependencies with current tkey-builder.
.PHONY: cilint
cilint:
cd cmd/tkey-runapp && golangci-lint run