forked from moby/sys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (34 loc) · 1019 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
35
36
37
38
39
40
.SHELLFLAGS = -ec
PACKAGES ?= mountinfo mount signal symlink
BINDIR ?= _build/bin
CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \
freebsd/amd64 openbsd/amd64 darwin/amd64 darwin/arm64 windows/amd64
SUDO ?= sudo -n
.PHONY: all
all: lint test cross
.PHONY: test
test: RUN_VIA_SUDO = $(shell $(SUDO) true && echo -exec \"$(SUDO)\")
test:
for p in $(PACKAGES); do \
(cd $$p && go test $(RUN_VIA_SUDO) -v .); \
done
.PHONY: lint
lint: $(BINDIR)/golangci-lint
$(BINDIR)/golangci-lint version
for p in $(PACKAGES); do \
(cd $$p && go mod download \
&& ../$(BINDIR)/golangci-lint run); \
done
$(BINDIR)/golangci-lint: $(BINDIR)
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(BINDIR) v1.41.1
$(BINDIR):
mkdir -p $(BINDIR)
.PHONY: cross
cross:
for osarch in $(CROSS); do \
export GOOS=$${osarch%/*} GOARCH=$${osarch#*/}; \
echo "# building for $$GOOS/$$GOARCH"; \
for p in $(PACKAGES); do \
(cd $$p && go build .); \
done; \
done