-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (34 loc) · 1.01 KB
/
Makefile
File metadata and controls
46 lines (34 loc) · 1.01 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
GO_BUILD_ENV :=
GO_BUILD_FLAGS := -tags no_cgo,osusergo,netgo
MODULE_BINARY := filtered-camera
ifeq ($(VIAM_TARGET_OS), windows)
GO_BUILD_ENV += GOOS=windows GOARCH=amd64
MODULE_BINARY = filtered-camera.exe
endif
ifeq ($(VIAM_TARGET_OS),linux)
GO_BUILD_FLAGS += -ldflags="-extldflags=-static -s -w"
endif
$(MODULE_BINARY): Makefile *.go */*.go cmd/module/*.go
$(GO_BUILD_ENV) go build $(GO_BUILD_FLAGS) -o $(MODULE_BINARY) cmd/module/cmd.go
module.tar.gz: meta.json $(MODULE_BINARY)
tar czf $@ meta.json $(MODULE_BINARY)
git checkout meta.json
ifeq ($(VIAM_TARGET_OS), windows)
module.tar.gz: fix-meta-for-win
else
module.tar.gz: strip-module
endif
strip-module:
strip filtered-camera
# TODO: Remove when viamrobotics/rdk#4969 is deployed
fix-meta-for-win:
jq '.entrypoint = "filtered-camera.exe"' meta.json > temp.json && mv temp.json meta.json
test:
go test ./...
lint:
gofmt -w .
go run github.com/rhysd/actionlint/cmd/actionlint@latest
all: module test
update:
go get go.viam.com/rdk@latest
go mod tidy