Add a static build target to Makefile
This allows us to build a static binary for all three binaries, from the make file using ``make static``. Signed-off-by: Ken Cochrane <KenCochrane@gmail.com>
This commit is contained in:
parent
f7a3546d96
commit
d4efc0411a
1 changed files with 14 additions and 3 deletions
17
Makefile
17
Makefile
|
@ -2,7 +2,7 @@ BUILDTAGS=
|
|||
|
||||
GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null || true)
|
||||
|
||||
LDFLAGS := "-X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS}"
|
||||
LDFLAGS := -X github.com/docker/containerd.GitCommit=${GIT_COMMIT} ${LDFLAGS}
|
||||
|
||||
# if this session isn't interactive, then we don't want to allocate a
|
||||
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||
|
@ -19,6 +19,8 @@ export GOPATH:=$(CURDIR)/vendor:$(GOPATH)
|
|||
|
||||
all: client daemon shim
|
||||
|
||||
static: client-static daemon-static shim-static
|
||||
|
||||
bin:
|
||||
mkdir -p bin/
|
||||
|
||||
|
@ -26,14 +28,23 @@ clean:
|
|||
rm -rf bin
|
||||
|
||||
client: bin
|
||||
cd ctr && go build -ldflags ${LDFLAGS} -o ../bin/ctr
|
||||
cd ctr && go build -ldflags "${LDFLAGS}" -o ../bin/ctr
|
||||
|
||||
client-static:
|
||||
cd ctr && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/ctr
|
||||
|
||||
daemon: bin
|
||||
cd containerd && go build -ldflags ${LDFLAGS} -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||
cd containerd && go build -ldflags "${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||
|
||||
daemon-static:
|
||||
cd containerd && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd
|
||||
|
||||
shim: bin
|
||||
cd containerd-shim && go build -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
||||
|
||||
shim-static:
|
||||
cd containerd-shim && go build -ldflags "-w -extldflags -static ${LDFLAGS}" -tags "$(BUILDTAGS)" -o ../bin/containerd-shim
|
||||
|
||||
dbuild:
|
||||
@docker build --rm --force-rm -t "$(DOCKER_IMAGE)" .
|
||||
|
||||
|
|
Loading…
Reference in a new issue