2017-02-01 00:45:59 +00:00
|
|
|
|
|
|
|
EPOCH_TEST_COMMIT := 78e6667ae2d67aad100b28ee9580b41b7a24e667
|
2017-04-12 23:12:04 +00:00
|
|
|
OUTPUT_DIRNAME ?= output
|
2017-02-01 00:45:59 +00:00
|
|
|
DOC_FILENAME ?= oci-runtime-spec
|
|
|
|
DOCKER ?= $(shell command -v docker 2>/dev/null)
|
|
|
|
PANDOC ?= $(shell command -v pandoc 2>/dev/null)
|
|
|
|
ifeq "$(strip $(PANDOC))" ''
|
|
|
|
ifneq "$(strip $(DOCKER))" ''
|
|
|
|
PANDOC = $(DOCKER) run \
|
|
|
|
-it \
|
|
|
|
--rm \
|
|
|
|
-v $(shell pwd)/:/input/:ro \
|
|
|
|
-v $(shell pwd)/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \
|
|
|
|
-u $(shell id -u) \
|
|
|
|
vbatts/pandoc
|
|
|
|
PANDOC_SRC := /input/
|
|
|
|
PANDOC_DST := /
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
# These docs are in an order that determines how they show up in the PDF/HTML docs.
|
|
|
|
DOC_FILES := \
|
|
|
|
version.md \
|
2017-04-12 23:12:04 +00:00
|
|
|
spec.md \
|
2017-02-01 00:45:59 +00:00
|
|
|
principles.md \
|
|
|
|
bundle.md \
|
|
|
|
runtime.md \
|
|
|
|
runtime-linux.md \
|
|
|
|
config.md \
|
|
|
|
config-linux.md \
|
|
|
|
config-solaris.md \
|
|
|
|
glossary.md
|
|
|
|
|
|
|
|
default: docs
|
|
|
|
|
|
|
|
.PHONY: docs
|
|
|
|
docs: $(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html
|
|
|
|
|
|
|
|
ifeq "$(strip $(PANDOC))" ''
|
|
|
|
$(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf $(OUTPUT_DIRNAME)/$(DOC_FILENAME).html:
|
|
|
|
$(error cannot build $@ without either pandoc or docker)
|
|
|
|
else
|
|
|
|
$(OUTPUT_DIRNAME)/$(DOC_FILENAME).pdf: $(DOC_FILES)
|
|
|
|
mkdir -p $(OUTPUT_DIRNAME)/ && \
|
|
|
|
$(PANDOC) -f markdown_github -t latex -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES))
|
|
|
|
|
|
|
|
$(OUTPUT_DIRNAME)/$(DOC_FILENAME).html: $(DOC_FILES)
|
|
|
|
mkdir -p $(OUTPUT_DIRNAME)/ && \
|
|
|
|
$(PANDOC) -f markdown_github -t html5 -o $(PANDOC_DST)$@ $(patsubst %,$(PANDOC_SRC)%,$(DOC_FILES))
|
|
|
|
endif
|
|
|
|
|
|
|
|
version.md: ./specs-go/version.go
|
|
|
|
go run ./.tool/version-doc.go > $@
|
|
|
|
|
|
|
|
HOST_GOLANG_VERSION = $(shell go version | cut -d ' ' -f3 | cut -c 3-)
|
|
|
|
# this variable is used like a function. First arg is the minimum version, Second arg is the version to be checked.
|
2017-04-12 23:12:04 +00:00
|
|
|
ALLOWED_GO_VERSION = $(shell test '$(shell /bin/echo -e "$(1)\n$(2)" | sort -V | head -n1)' = '$(1)' && echo 'true')
|
2017-02-01 00:45:59 +00:00
|
|
|
|
|
|
|
.PHONY: test .govet .golint .gitvalidation
|
|
|
|
|
|
|
|
test: .govet .golint .gitvalidation
|
|
|
|
|
|
|
|
.govet:
|
|
|
|
go vet -x ./...
|
|
|
|
|
|
|
|
# `go get github.com/golang/lint/golint`
|
|
|
|
.golint:
|
2017-04-12 23:12:04 +00:00
|
|
|
ifeq ($(call ALLOWED_GO_VERSION,1.6,$(HOST_GOLANG_VERSION)),true)
|
2017-02-01 00:45:59 +00:00
|
|
|
@which golint > /dev/null 2>/dev/null || (echo "ERROR: golint not found. Consider 'make install.tools' target" && false)
|
|
|
|
golint ./...
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# When this is running in travis, it will only check the travis commit range
|
|
|
|
.gitvalidation:
|
|
|
|
@which git-validation > /dev/null 2>/dev/null || (echo "ERROR: git-validation not found. Consider 'make install.tools' target" && false)
|
2017-04-12 23:12:04 +00:00
|
|
|
ifdef TRAVIS_COMMIT_RANGE
|
2017-02-01 00:45:59 +00:00
|
|
|
git-validation -q -run DCO,short-subject,dangling-whitespace
|
|
|
|
else
|
|
|
|
git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..HEAD
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: install.tools
|
2017-04-12 23:12:04 +00:00
|
|
|
install.tools: .install.golint .install.gitvalidation
|
2017-02-01 00:45:59 +00:00
|
|
|
|
2017-04-12 23:12:04 +00:00
|
|
|
# golint does not even build for <go1.6
|
2017-02-01 00:45:59 +00:00
|
|
|
.install.golint:
|
2017-04-12 23:12:04 +00:00
|
|
|
ifeq ($(call ALLOWED_GO_VERSION,1.6,$(HOST_GOLANG_VERSION)),true)
|
|
|
|
go get -u github.com/golang/lint/golint
|
2017-02-01 00:45:59 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
.install.gitvalidation:
|
2017-04-12 23:12:04 +00:00
|
|
|
go get -u github.com/vbatts/git-validation
|
2017-02-01 00:45:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUT_DIRNAME) *~
|
2017-04-12 23:12:04 +00:00
|
|
|
rm -f version.md
|
2017-02-01 00:45:59 +00:00
|
|
|
|