This repository has been archived by the owner on Apr 21, 2021. It is now read-only.
forked from opencontainers/runtime-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (60 loc) · 2.32 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
68
69
70
71
72
73
74
75
76
77
PREFIX ?= $(DESTDIR)/usr
BINDIR ?= $(DESTDIR)/usr/bin
TAP ?= tap
BUILDTAGS=
RUNTIME ?= runc
COMMIT=$(shell git rev-parse HEAD 2> /dev/null || true)
VERSION := ${shell cat ./VERSION}
VALIDATION_TESTS ?= $(patsubst %.go,%.t,$(shell find ./validation/ -name *.go | grep -v util))
all: tool runtimetest validation-executables
tool:
go build -tags "$(BUILDTAGS)" -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -o oci-runtime-tool ./cmd/oci-runtime-tool
.PHONY: runtimetest
runtimetest:
CGO_ENABLED=0 go build -installsuffix cgo -tags "$(BUILDTAGS)" -ldflags "-X main.gitCommit=${COMMIT} -X main.version=${VERSION}" -o runtimetest ./cmd/runtimetest
.PHONY: man
man:
go-md2man -in "man/oci-runtime-tool.1.md" -out "oci-runtime-tool.1"
go-md2man -in "man/oci-runtime-tool-generate.1.md" -out "oci-runtime-tool-generate.1"
go-md2man -in "man/oci-runtime-tool-validate.1.md" -out "oci-runtime-tool-validate.1"
install: man
install -d -m 755 $(BINDIR)
install -m 755 oci-runtime-tool $(BINDIR)
install -d -m 755 $(PREFIX)/share/man/man1
install -m 644 *.1 $(PREFIX)/share/man/man1
install -d -m 755 $(PREFIX)/share/bash-completion/completions
install -m 644 completions/bash/oci-runtime-tool $(PREFIX)/share/bash-completion/completions
uninstall:
rm -f $(BINDIR)/oci-runtime-tool
rm -f $(PREFIX)/share/man/man1/oci-runtime-tool*.1
rm -f $(PREFIX)/share/bash-completion/completions/oci-runtime-tool
clean:
rm -f oci-runtime-tool runtimetest *.1 $(VALIDATION_TESTS)
localvalidation:
@for EXECUTABLE in runtimetest $(VALIDATION_TESTS); \
do \
if test ! -x "$${EXECUTABLE}"; \
then \
echo "missing test executable $${EXECUTABLE}; run 'make runtimetest validation-executables'" >&2; \
exit 1; \
fi; \
done
RUNTIME=$(RUNTIME) $(TAP) $(VALIDATION_TESTS)
.PHONY: validation-executables
validation-executables: $(VALIDATION_TESTS)
.PRECIOUS: $(VALIDATION_TESTS)
.PHONY: $(VALIDATION_TESTS)
$(VALIDATION_TESTS): %.t: %.go
go build -tags "$(BUILDTAGS)" ${TESTFLAGS} -o $@ $<
.PHONY: test .gofmt .govet .golint
PACKAGES = $(shell go list ./... | grep -v vendor)
test: .gofmt .govet .golint .gotest
.gofmt:
OUT=$$(go fmt $(PACKAGES)); if test -n "$${OUT}"; then echo "$${OUT}" && exit 1; fi
.govet:
go vet -x $(PACKAGES)
.golint:
golint -set_exit_status $(PACKAGES)
UTDIRS = ./filepath/... ./validate/...
.gotest:
go test $(UTDIRS)