Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit b1daa91

Browse files
committed
Makefile: use include for common variables
Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit fe23576) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 14beb3692f38384d9634599ae95b630771394cf1 Component: packaging
1 parent 55378e4 commit b1daa91

6 files changed

Lines changed: 23 additions & 28 deletions

File tree

components/packaging/Makefile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
SHELL:=/bin/bash
2-
ENGINE_DIR:=$(CURDIR)/../engine
1+
include common.mk
2+
33
CLI_DIR:=$(CURDIR)/../cli
4-
VERSION?=0.0.0-dev
5-
DOCKER_GITCOMMIT:=abcdefg
6-
ARCH=$(shell uname -m)
4+
ENGINE_DIR:=$(CURDIR)/../engine
75
STATIC_VERSION:=$(shell static/gen-static-ver $(ENGINE_DIR) $(VERSION))
8-
GO_VERSION:=1.12.8
9-
DEFAULT_PRODUCT_LICENSE:=Community Engine
10-
PLATFORM=Docker Engine - Community
11-
BUILDTIME=$(shell date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
12-
export DEFAULT_PRODUCT_LICENSE
13-
export PLATFORM
14-
export BUILDTIME
156

167
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
178
print-% : ; @echo $($*)

components/packaging/common.mk

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ARCH=$(shell uname -m)
2+
BUILDTIME=$(shell date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
3+
DEFAULT_PRODUCT_LICENSE:=Community Engine
4+
DOCKER_GITCOMMIT:=abcdefg
5+
GO_VERSION:=1.12.8
6+
PLATFORM=Docker Engine - Community
7+
SHELL:=/bin/bash
8+
VERSION?=0.0.0-dev
9+
10+
export BUILDTIME
11+
export DEFAULT_PRODUCT_LICENSE
12+
export PLATFORM

components/packaging/deb/Makefile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
SHELL:=/bin/bash
2-
ARCH:=$(shell uname -m)
1+
include ../common.mk
2+
33
CLI_DIR:=$(CURDIR)/../../cli
44
ENGINE_DIR:=$(CURDIR)/../../engine
55
GITCOMMIT?=$(shell cd $(CLI_DIR) && git rev-parse --short HEAD)
6-
VERSION?=0.0.0-dev
76
STATIC_VERSION:=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
87
GO_BASE_IMAGE=golang
9-
GO_VERSION:=1.12.8
108
GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)-stretch
119
DEB_VERSION=$(shell ./gen-deb-ver $(CLI_DIR) "$(VERSION)")
1210
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown

components/packaging/image/Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
SHELL:=/bin/bash
1+
include ../common.mk
2+
23
ENGINE_DIR:=$(CURDIR)/../../engine
34
CLI_DIR:=$(CURDIR)/../../cli
4-
VERSION?=0.0.0-dev
55
GO_BASE_IMAGE=golang
6-
GO_VERSION:=1.12.8
76
ENGINE_GO_IMAGE=$(GO_BASE_IMAGE):$(GO_VERSION)-stretch
87
STATIC_VERSION:=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
98
DOCKER_HUB_ORG?=dockereng
10-
ARCH=$(shell uname -m)
119
ENGINE_IMAGE?=engine-community
1210
CHOWN:=docker run --rm -v $(CURDIR):/v -w /v alpine chown
13-
DEFAULT_PRODUCT_LICENSE?=Community Engine
14-
PLATFORM?=Docker Engine - Community
15-
BUILDTIME?=$(shell date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
1611
IMAGE_WITH_TAG=$(DOCKER_HUB_ORG)/$(ENGINE_IMAGE):$(STATIC_VERSION)
1712
ifdef BASE_IMAGE
1813
# TODO: Clean this up to only set ENGINE_GO_IMAGE

components/packaging/rpm/Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
ARCH=$(shell uname -m)
1+
include ../common.mk
2+
23
ENGINE_DIR:=$(CURDIR)/../../engine
34
CLI_DIR:=$(CURDIR)/../../cli
45
GITCOMMIT=$(shell cd $(ENGINE_DIR) && git rev-parse --short HEAD)
5-
VERSION?=0.0.0-dev
66
STATIC_VERSION:=$(shell ../static/gen-static-ver $(ENGINE_DIR) $(VERSION))
77
GO_BASE_IMAGE=golang
8-
GO_VERSION:=1.12.8
98
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-stretch
109
GEN_RPM_VER=$(shell ./gen-rpm-ver $(CLI_DIR) $(VERSION))
1110
CHOWN=docker run --rm -i -v $(CURDIR):/v -w /v alpine chown

components/packaging/static/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
include ../common.mk
2+
13
SHELL:=/bin/bash
24
ENGINE_DIR:=$(CURDIR)/../../engine
35
CLI_DIR:=$(CURDIR)/../../cli
4-
VERSION?=0.0.0-dev
56
STATIC_VERSION:=$(shell ./gen-static-ver $(ENGINE_DIR) $(VERSION))
67
CHOWN=docker run --rm -v $(CURDIR):/v -w /v alpine chown
78
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
89
DIR_TO_HASH:=build/linux
9-
DEFAULT_PRODUCT_LICENSE?=Community Engine
1010
GO_VERSION=$(shell grep "ARG GO_VERSION" $(CLI_DIR)/dockerfiles/Dockerfile.dev | awk -F'=' '{print $$2}')
1111
DOCKER_CLI_GOLANG_IMG=golang:$(GO_VERSION)
1212

0 commit comments

Comments
 (0)