...
1
2EPOCH_TEST_COMMIT := 78e6667ae2d67aad100b28ee9580b41b7a24e667
3OUTPUT_DIRNAME ?= output
4DOC_FILENAME ?= oci-runtime-spec
5DOCKER ?= $(shell command -v docker 2>/dev/null)
6PANDOC ?= $(shell command -v pandoc 2>/dev/null)
7PANDOC_IMAGE ?= ghcr.io/opencontainers/pandoc:2.9.2.1-9.fc34.x86_64@sha256:590c5c7aaa6e8e7a4debae7e9102c837daa0c8a76f8f5b5c9831ea5f755e3e95
8ifeq "$(strip $(PANDOC))" ''
9 ifneq "$(strip $(DOCKER))" ''
10 PANDOC = $(DOCKER) run \
11 --security-opt label=disable \
12 --rm \
13 -v $(shell pwd)/:/input/:ro \
14 -v $(shell pwd)/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \
15 -u $(shell id -u) \
16 $(PANDOC_IMAGE)
17 PANDOC_SRC := /input/
18 PANDOC_DST := /
19 endif
20endif
21
22# These docs are in an order that determines how they show up in the PDF/HTML docs.
23DOC_FILES := \
24 version.md \
25 spec.md \
26 principles.md \
27 bundle.md \
28 runtime.md \
29 runtime-linux.md \
30 config.md \
31 config-linux.md \
32 config-solaris.md \
33 features.md \
34 features-linux.md \
35 glossary.md
36
37default: docs
38
39docs: $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html
40
41ifeq "$(strip $(PANDOC))" ''
42$(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html:
43 $(error cannot build $@ without either pandoc or docker)
44else
45$(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf: $(DOC_FILES)
46 mkdir -p $(OUTPUT_DIRNAME)/ && \
47 $(PANDOC) -f markdown_github -t latex -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES))
48
49$(OUTPUT_DIRNAME)/$(DOC_FILENAME).html: $(DOC_FILES)
50 mkdir -p $(OUTPUT_DIRNAME)/ && \
51 $(PANDOC) -f markdown_github -t html5 -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES))
52endif
53
54version.md: ./specs-go/version.go
55 go run ./.tool/version-doc.go > $@
56
57HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
58# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
59ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' = '$(1)' && echo 'true')
60
61test: .govet .golint .gitvalidation
62
63.govet:
64 go vet -x ./...
65
66# When this is running in GitHub, it will only check the GitHub commit range
67.gitvalidation:
68 @which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
69ifdef GITHUB_SHA
70 git-validation -q -run DCO,short-subject,dangling-whitespace -range $(GITHUB_SHA)..HEAD
71else
72 git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
73endif
74
75install.tools: .install.gitvalidation
76
77.install.gitvalidation:
78 go install github.com/vbatts/git-validation@v1.2.0
79
80clean:
81 rm -rf $(OUTPUT_DIRNAME) *~
82 rm -f version.md
83
View as plain text