Skip to content

Commit 8cd69c5

Browse files
committed
static: Makefile cleanup and reformatting
- re-format some parts - clean up intermediate directories Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent bea66a5 commit 8cd69c5

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

static/Makefile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
include ../common.mk
22

3-
CLI_DIR=$(realpath $(CURDIR)/../src/github.com/docker/cli)
4-
ENGINE_DIR=$(realpath $(CURDIR)/../src/github.com/docker/docker)
5-
BUILDX_DIR=$(realpath $(CURDIR)/../src/github.com/docker/buildx)
3+
CLI_DIR = $(realpath $(CURDIR)/../src/github.com/docker/cli)
4+
ENGINE_DIR = $(realpath $(CURDIR)/../src/github.com/docker/docker)
5+
BUILDX_DIR = $(realpath $(CURDIR)/../src/github.com/docker/buildx)
66

77
GEN_STATIC_VER=$(shell ./gen-static-ver $(CLI_DIR) $(VERSION))
88
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
@@ -40,12 +40,16 @@ static: static-linux cross-mac cross-win cross-arm ## create all static packages
4040

4141
.PHONY: static-linux
4242
static-linux: static-cli static-engine static-buildx-plugin ## create tgz
43+
# docker cli binaries
4344
mkdir -p build/linux/docker
4445
cp $(CLI_DIR)/build/docker build/linux/docker/
46+
47+
# docker engine binaries
4548
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do \
4649
cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker/$$f; \
4750
done
4851
tar -C build/linux -c -z -f build/linux/docker-$(GEN_STATIC_VER).tgz docker
52+
$(RM) -r build/linux/docker
4953

5054
# extra binaries for running rootless
5155
mkdir -p build/linux/docker-rootless-extras
@@ -55,8 +59,9 @@ static-linux: static-cli static-engine static-buildx-plugin ## create tgz
5559
fi \
5660
done
5761
tar -C build/linux -c -z -f build/linux/docker-rootless-extras-$(GEN_STATIC_VER).tgz docker-rootless-extras
62+
$(RM) -r build/linux/docker-rootless-extras
5863

59-
# buildx
64+
# docker buildx
6065
tar -C $(BUILDX_DIR)/bin -c -z -f build/linux/docker-buildx-plugin-$(DOCKER_BUILDX_REF:v%=%).tgz docker-buildx
6166

6267
.PHONY: hash_files
@@ -70,32 +75,42 @@ buildx:
7075

7176
.PHONY: cross-mac
7277
cross-mac: buildx
78+
# docker cli binaries
7379
cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=darwin/amd64,darwin/arm64 binary
7480
dest=$$PWD/build/mac; cd $(CLI_DIR)/build && for platform in *; do \
7581
arch=$$(echo $$platform | cut -d_ -f2); \
7682
mkdir -p $$dest/$$arch/docker; \
7783
cp $$platform/docker-darwin-* $$dest/$$arch/docker/docker && \
7884
tar -C $$dest/$$arch -c -z -f $$dest/$$arch/docker-$(GEN_STATIC_VER).tgz docker; \
85+
$(RM) -r $$dest/$$arch/docker
7986
done
8087

8188
.PHONY: cross-win
8289
cross-win: cross-win-engine
83-
cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=windows/amd64 binary
90+
# docker cli binaries
8491
mkdir -p build/win/amd64/docker
92+
cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=windows/amd64 binary
8593
cp $(CLI_DIR)/build/docker-windows-amd64.exe build/win/amd64/docker/docker.exe
94+
95+
# docker engine binaries
8696
cp $(ENGINE_DIR)/bundles/cross/windows/amd64-daemon/dockerd.exe build/win/amd64/docker/dockerd.exe
8797
cp $(ENGINE_DIR)/bundles/cross/windows/amd64-daemon/docker-proxy.exe build/win/amd64/docker/docker-proxy.exe
8898
docker run --rm -v $(CURDIR)/build/win/amd64:/v -w /v alpine sh -c 'apk update&&apk add zip&&zip -r docker-$(GEN_STATIC_VER).zip docker'
8999
$(CHOWN) -R $(shell id -u):$(shell id -g) build
90100

101+
# clean up temporary directories
102+
$(RM) -r build/win/amd64/docker
103+
91104
.PHONY: cross-arm
92105
cross-arm: cross-all-cli ## create tgz with linux armhf client only
93106
mkdir -p build/arm/docker
94107
cp $(CLI_DIR)/build/docker-linux-arm build/arm/docker/docker
95108
tar -C build/arm -c -z -f build/arm/docker-$(GEN_STATIC_VER).tgz docker
109+
$(RM) -r build/arm/docker
96110

97111
.PHONY: static-cli
98112
static-cli:
113+
# TODO(thaJeztah) check if CGO_ENABLED variable is correct here
99114
cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=$(TARGETPLATFORM) --set binary.args.CGO_ENABLED=$(CGO_ENABLED) binary
100115

101116
.PHONY: static-engine

0 commit comments

Comments
 (0)