11GO15VENDOREXPERIMENT =1
22export GO15VENDOREXPERIMENT
3+ PREFIX ?= $(DESTDIR ) /usr
4+ BINDIR ?= $(DESTDIR ) /usr/bin
35
4- COMMIT =$(shell git rev-parse HEAD 2> /dev/null || true)
5-
6- EPOCH_TEST_COMMIT ?= v0.2.0
7- TOOLS := \
8- oci-create-runtime-bundle \
9- oci-image-validate \
10- oci-unpack
11- MAN := $(TOOLS:%=%.1 )
126
137default : all
148
159help :
1610 @echo " Usage: make <target>"
1711 @echo
18- @echo " * 'all' - Build the oci tools and manual pages"
12+ @echo " * 'all' - Build the oci tool and manual pages"
13+ @echo " * 'tool' - Build the oci tool"
1914 @echo " * 'install' - Install binaries and manual pages"
20- @echo " * 'install.tools' - Install tools needed for building this project"
21- @echo " * 'uninstall' - Remove the oci tools and manual pages"
22- @echo " * 'tools' - Build the oci image tools binaries"
15+ @echo " * 'install.tools' - Install tool needed for building this project"
16+ @echo " * 'uninstall' - Remove the oci tool and manual pages"
2317 @echo " * 'man' - Build the oci image manual pages"
2418 @echo " * 'check-license' - Check license headers in source files"
2519 @echo " * 'lint' - Execute the source code linter"
@@ -31,25 +25,33 @@ check-license:
3125 @echo " checking license headers"
3226 @./.tool/check-license
3327
34- tools : $(TOOLS )
28+ .PHONY : tool
29+ tool :
30+ go build -o oci-image-tool ./cmd/oci-image-tool
3531
36- man : $(MAN )
3732
38- all : $( TOOLS ) $( MAN )
33+ all : tool man
3934
40- $(TOOLS ) : oci-% :
41- go build -ldflags " -X main.gitCommit=${COMMIT} " ./cmd/$@
35+ .PHONY : man
36+ man :
37+ go-md2man -in " man/oci-image-tool.1.md" -out " oci-image-tool.1"
38+ go-md2man -in " man/oci-image-tool-create.1.md" -out " oci-image-tool-create.1"
39+ go-md2man -in " man/oci-image-tool-unpack.1.md" -out " oci-image-tool-unpack.1"
40+ go-md2man -in " man/oci-image-tool-validate.1.md" -out " oci-image-tool-validate.1"
4241
43- .SECONDEXPANSION :
44- $(MAN ) : % .1: cmd/$$* /$$* .1.md
45- go-md2man -in " $<" -out " $@ "
4642
47- install : $(TOOLS ) $(MAN )
48- install -m 755 $(TOOLS ) /usr/local/bin/
49- install -m 644 $(MAN ) /usr/local/share/man/man1
43+ install : man
44+ install -d -m 755 $(BINDIR )
45+ install -m 755 oci-image-tool $(BINDIR )
46+ install -d -m 755 $(PREFIX ) /share/man/man1
47+ install -m 644 * .1 $(PREFIX ) /share/man/man1
48+ install -d -m 755 $(PREFIX ) /share/bash-completion/completions
49+ install -m 644 completions/bash/oci-image-tool $(PREFIX ) /share/bash-completion/completionsn
5050
51- uninstall : clean
52- rm -f $(MAN:%=/usr/local/share/man/man1/% ) $(TOOLS:%=/usr/local/bin/% )
51+ uninstall :
52+ rm -f $(BINDIR ) /oci-image-tool
53+ rm -f $(PREFIX ) /share/man/man1/oci-image-tool* .1
54+ rm -f $(PREFIX ) /share/bash-completion/completions/oci-image-tool
5355
5456lint :
5557 @echo " checking lint"
5860test :
5961 go test -race -cover $(shell go list ./... | grep -v /vendor/)
6062
63+
6164# # this uses https://github.com/Masterminds/glide and https://github.com/sgotti/glide-vc
6265update-deps :
6366 @which glide > /dev/null 2> /dev/null || (echo " ERROR: glide not found. Consider 'make install.tools' target" && false)
@@ -98,12 +101,11 @@ install.tools: .install.gitvalidation .install.glide .install.glide-vc .install.
98101 go get github.com/cpuguy83/go-md2man
99102
100103clean :
101- rm -rf * ~ $( OUTPUT_DIRNAME ) $( TOOLS ) $( MAN )
104+ rm -rf oci-image-tool * .1
102105
103106.PHONY : \
104107 all \
105- tools \
106- $(TOOLS ) \
108+ tool \
107109 man \
108110 install \
109111 uninstall \
0 commit comments