-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (27 loc) · 1.14 KB
/
Makefile
File metadata and controls
39 lines (27 loc) · 1.14 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
COMMIT:=$(shell git log -1 --pretty=format:%h)$(shell git diff --quiet || echo '_')
# Use linker flags to provide commit info
LDFLAGS=-ldflags "-X=github.com/foundriesio/fioconfig/internal.Commit=$(COMMIT)"
TARGETS=bin/fioconfig-linux-amd64 bin/fioconfig-linux-armv7 bin/fioconfig-linux-arm bin/fioconfig-nopkcs11
linter:=$(shell which golangci-lint 2>/dev/null || echo $(HOME)/go/bin/golangci-lint)
build: $(TARGETS)
@true
bin/fioconfig-linux-amd64:
bin/fioconfig-linux-armv7:
bin/fioconfig-linux-arm:
bin/fioconfig-%: FORCE
GOOS=$(shell echo $* | cut -f1 -d\- ) \
GOARCH=$(shell echo $* | cut -f2 -d\-) \
go build -tags vpn $(LDFLAGS) -o $@ main.go
.PHONY: bin/fioconfig-nopkcs11
bin/fioconfig-nopkcs11:
CGO_ENABLED=0 go build -tags vpn,disable_pkcs11 $(LDFLAGS) -o $@ main.go
FORCE:
format:
@gofmt -l -w ./
lint:
@test -z $(shell gofmt -d -l ./ | tee /dev/stderr) || (echo "[WARN] Fix formatting issues with 'make fmt'"; exit 1)
@test -x $(linter) || (echo "Please install linter from https://github.com/golangci/golangci-lint/releases/tag/v1.25.1 to $(HOME)/go/bin")
$(linter) run --build-tags vpn
check: test lint
test:
go test ./... -v