-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
34 lines (26 loc) · 827 Bytes
/
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
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Robin Jarry
version = $(shell git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.1)
src = $(shell find * -type f -name '*.go') go.mod go.sum
go_ldflags :=
go_ldflags += -X main.version=$(version)
bin_dir = ./bin
.PHONY: all
all: env
env: $(src) cmd/env/main.go
go build -trimpath -ldflags='$(go_ldflags)' -o $(bin_dir)/$@ cmd/env/main.go
.PHONY: debug
debug: env
env.debug: $(src) cmd/env/main.go
go build -ldflags='$(go_ldflags)' -gcflags=all="-N -l" -o $(bin_dir)/$@ cmd/env/main.go
.PHONY: format
format:
gofmt -w .
.PHONY: lint
lint:
@gofmt -d . | grep ^ \
&& echo The above files need to be formatted. Please run make format. && exit 1 \
|| echo All files formated.
.PHONY: run
run: env
OVS_NODE_EXPORTER_CONFIG=etc/dev.conf ./$<