forked from opencontainers/selinux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
67 lines (56 loc) · 1.49 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
GO ?= go
BUILDTAGS := selinux
all: build build-cross
define go-build
GOOS=$(1) GOARCH=$(2) $(GO) build -tags $(BUILDTAGS) ./...
endef
define go-build-noselinux
GOOS=$(1) GOARCH=$(2) $(GO) build ./...
endef
.PHONY: build
build:
$(call go-build,linux,amd64)
.PHONY: build-cross
build-cross:
$(call go-build,linux,386)
$(call go-build,linux,arm)
$(call go-build,linux,arm64)
$(call go-build,linux,ppc64le)
$(call go-build,linux,s390x)
$(call go-build,windows,amd64)
$(call go-build,windows,386)
$(call go-build-noselinux,linux,amd64)
$(call go-build-noselinux,linux,arm)
$(call go-build-noselinux,linux,arm64)
$(call go-build-noselinux,linux,ppc64le)
$(call go-build-noselinux,linux,s390x)
$(call go-build-noselinux,windows,amd64)
$(call go-build-noselinux,windows,386)
BUILD_PATH := $(shell pwd)/build
BUILD_BIN_PATH := ${BUILD_PATH}/bin
GOLANGCI_LINT := ${BUILD_BIN_PATH}/golangci-lint
.PHONY: check-gopath
check-gopath:
ifndef GOPATH
$(error GOPATH is not set)
endif
.PHONY: test
test: check-gopath
go test -timeout 3m -tags "${BUILDTAGS}" ${TESTFLAGS} -v ./...
go test -timeout 3m ${TESTFLAGS} -v ./...
${GOLANGCI_LINT}:
export \
VERSION=v1.23.7 \
URL=https://raw.githubusercontent.com/golangci/golangci-lint \
BINDIR=${BUILD_BIN_PATH} && \
curl -sfL $$URL/$$VERSION/install.sh | sh -s $$VERSION
.PHONY: lint
lint: ${GOLANGCI_LINT}
${GOLANGCI_LINT} version
${GOLANGCI_LINT} linters
${GOLANGCI_LINT} run
.PHONY: vendor
vendor:
$(GO) mod tidy
$(GO) mod vendor
$(GO) mod verify