11GO15VENDOREXPERIMENT =1
22export GO15VENDOREXPERIMENT
33
4- DOCKER ?= $(shell command -v docker 2>/dev/null)
5- PANDOC ?= $(shell command -v pandoc 2>/dev/null)
6-
7- ifeq "$(strip $(PANDOC ) ) " ''
8- ifneq "$(strip $(DOCKER))" ''
9- PANDOC = $(DOCKER) run \
10- -it \
11- --rm \
12- -v $(shell pwd)/:/input/:ro \
13- -v $(shell pwd)/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \
14- -u $(shell id -u) \
15- --workdir /input \
16- vbatts/pandoc
17- PANDOC_SRC := /input/
18- PANDOC_DST := /
19- endif
20- endif
21-
22- # These docs are in an order that determines how they show up in the PDF/HTML docs.
23- DOC_FILES := \
24- README.md \
25- code-of-conduct.md \
26- project.md \
27- media-types.md \
28- descriptor.md \
29- image-layout.md \
30- layer.md \
31- config.md \
32- manifest.md
33-
34- FIGURE_FILES := \
35- img/media-types.png
36-
37- OUTPUT_DIRNAME ?= output/
38- DOC_FILENAME ?= oci-image-spec
39-
404EPOCH_TEST_COMMIT ?= v0.2.0
415
426default : help
437
448help :
459 @echo " Usage: make <target>"
4610 @echo
47- @echo " * 'docs' - produce document in the $( OUTPUT_DIRNAME) directory"
48- @echo " * 'fmt' - format the json with indentation"
49- @echo " * 'validate-examples' - validate the examples in the specification markdown files"
50- @echo " * 'oci-image-tool' - build the oci-image-tool binary"
51- @echo " * 'schema-fs' - regenerate the virtual schema http/FileSystem"
11+ @echo " * 'tools' - build the oci image tools binaries"
5212 @echo " * 'check-license' - check license headers in source files"
5313 @echo " * 'lint' - Execute the source code linter"
5414 @echo " * 'test' - Execute the unit tests"
5515 @echo " * 'update-deps' - Update vendored dependencies"
56- @echo " * 'img/*.png' - Generate PNG from dot file"
57-
58- fmt :
59- for i in schema/* .json ; do jq --indent 2 -M . " $$ {i}" > xx && cat xx > " $$ {i}" && rm xx ; done
60-
61- docs : $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .html
62-
63- ifeq "$(strip $(PANDOC ) ) " ''
64- $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf : $(DOC_FILES ) $(FIGURE_FILES )
65- $(error cannot build $@ without either pandoc or docker)
66- else
67- $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf : $(DOC_FILES ) $(FIGURE_FILES )
68- @mkdir -p $(OUTPUT_DIRNAME ) / && \
69- $(PANDOC ) -f markdown_github -t latex -o $(PANDOC_DST ) $@ $(patsubst % ,$(PANDOC_SRC ) % ,$(DOC_FILES ) )
70- ls -sh $(shell readlink -f $@ )
71-
72- $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .html : $(DOC_FILES ) $(FIGURE_FILES )
73- @mkdir -p $(OUTPUT_DIRNAME ) / && \
74- cp -ap img/ $(shell pwd) /$(OUTPUT_DIRNAME ) /&& \
75- $(PANDOC ) -f markdown_github -t html5 -o $(PANDOC_DST ) $@ $(patsubst % ,$(PANDOC_SRC ) % ,$(DOC_FILES ) )
76- ls -sh $(shell readlink -f $@ )
77- endif
78-
79- code-of-conduct.md :
80- curl -o $@ https://raw.githubusercontent.com/opencontainers/tob/d2f9d68c1332870e40693fe077d311e0742bc73d/code-of-conduct.md
81-
82- validate-examples :
83- go test -run TestValidate ./schema
84-
85- oci-image-tool :
86- go build ./cmd/oci-image-tool
87-
88- schema-fs :
89- @echo " generating schema fs"
90- @cd schema && printf " %s\n\n%s\n" " $$ (cat ../.header)" " $$ (go generate)" > fs.go
9116
9217check-license :
9318 @echo " checking license headers"
9419 @./.tool/check-license
9520
21+ tools :
22+ go build ./cmd/oci-create-runtime-bundle
23+ go build ./cmd/oci-unpack
24+ go build ./cmd/oci-image-validate
25+
9626lint :
9727 @echo " checking lint"
9828 @./.tool/lint
@@ -108,9 +38,6 @@ update-deps:
10838 # see http://sed.sourceforge.net/sed1line.txt
10939 find vendor -type f -exec sed -i -e :a -e ' /^\n*$$/{$$d;N;ba' -e ' }' " {}" \;
11040
111- img/% .png : img/% .dot
112- dot -Tpng $^ > $@
113-
11441.PHONY : .gitvalidation
11542
11643# When this is running in travis, it will only check the travis commit range
12451
12552.PHONY : install.tools
12653
127- install.tools : .install.gitvalidation .install.glide .install.glide-vc
54+ install.tools : .install.gitvalidation .install.glide .install.glide-vc .install.gometalinter
12855
12956.install.gitvalidation :
13057 go get github.com/vbatts/git-validation
@@ -135,15 +62,19 @@ install.tools: .install.gitvalidation .install.glide .install.glide-vc
13562.install.glide-vc :
13663 go get github.com/sgotti/glide-vc
13764
65+ .install.gometalinter :
66+ go get github.com/alecthomas/gometalinter
67+ gometalinter --install --update
68+
13869clean :
13970 rm -rf * ~ $(OUTPUT_DIRNAME )
140- rm -f oci-image-tool
71+ rm -f oci-create-runtime-bundle
72+ rm -f oci-unpack
73+ rm -f oci-image-validate
14174
14275.PHONY : \
143- validate-examples \
144- oci-image-tool \
76+ tools \
14577 check-license \
14678 clean \
14779 lint \
148- docs \
14980 test
0 commit comments