2017-05-20 08:11:06 +03:00
|
|
|
SHELL:=/bin/bash
|
|
|
|
ENGINE_DIR:=$(CURDIR)/../engine
|
|
|
|
CLI_DIR:=$(CURDIR)/../cli
|
2017-12-08 01:25:41 +03:00
|
|
|
VERSION?=0.0.0-dev
|
2017-05-20 08:11:06 +03:00
|
|
|
DOCKER_GITCOMMIT:=abcdefg
|
2018-08-08 00:28:11 +03:00
|
|
|
ARCH=$(shell uname -m)
|
2019-08-15 00:27:03 +03:00
|
|
|
STATIC_VERSION:=$(shell static/gen-static-ver $(ENGINE_DIR) $(VERSION))
|
2019-08-14 04:13:24 +03:00
|
|
|
GO_VERSION:=1.12.8
|
2018-08-20 20:11:53 +03:00
|
|
|
DEFAULT_PRODUCT_LICENSE:=Community Engine
|
2018-08-25 03:05:42 +03:00
|
|
|
PLATFORM=Docker Engine - Community
|
2018-08-25 03:19:43 +03:00
|
|
|
BUILDTIME=$(shell date -u -d "@$${SOURCE_DATE_EPOCH:-$$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')
|
2018-08-20 20:11:53 +03:00
|
|
|
export DEFAULT_PRODUCT_LICENSE
|
2018-08-25 03:05:42 +03:00
|
|
|
export PLATFORM
|
2018-08-25 03:19:43 +03:00
|
|
|
export BUILDTIME
|
2017-05-20 08:11:06 +03:00
|
|
|
|
2018-08-02 21:32:44 +03:00
|
|
|
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
|
|
|
|
print-% : ; @echo $($*)
|
|
|
|
|
2017-12-28 03:26:04 +03:00
|
|
|
.PHONY: help
|
2017-05-20 08:11:06 +03:00
|
|
|
help: ## show make targets
|
|
|
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
|
|
|
2018-08-02 21:32:44 +03:00
|
|
|
.PHONY: clean-engine
|
|
|
|
clean-engine:
|
|
|
|
rm -rf $(ENGINE_DIR)
|
|
|
|
|
|
|
|
.PHONY: clean-image
|
|
|
|
clean-image:
|
|
|
|
$(MAKE) ENGINE_DIR=$(ENGINE_DIR) -C image clean
|
|
|
|
|
|
|
|
|
2017-12-28 03:26:04 +03:00
|
|
|
.PHONY: clean
|
2018-08-07 20:22:58 +03:00
|
|
|
clean: clean-image ## remove build artifacts
|
2017-05-20 08:11:06 +03:00
|
|
|
$(MAKE) -C rpm clean
|
|
|
|
$(MAKE) -C deb clean
|
|
|
|
$(MAKE) -C static clean
|
|
|
|
|
2017-12-28 03:26:04 +03:00
|
|
|
.PHONY: rpm
|
2017-05-20 08:11:06 +03:00
|
|
|
rpm: ## build rpm packages
|
2019-07-01 22:41:08 +03:00
|
|
|
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) rpm
|
2017-05-20 08:11:06 +03:00
|
|
|
|
2017-12-28 03:26:04 +03:00
|
|
|
.PHONY: deb
|
2017-05-20 08:11:06 +03:00
|
|
|
deb: ## build deb packages
|
2019-07-01 22:41:08 +03:00
|
|
|
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) deb
|
2017-05-20 08:11:06 +03:00
|
|
|
|
2017-12-28 03:26:04 +03:00
|
|
|
.PHONY: static
|
2017-05-20 08:11:06 +03:00
|
|
|
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm
|
|
|
|
static: ## build static-compiled packages
|
|
|
|
for p in $(DOCKER_BUILD_PKGS); do \
|
2018-05-22 01:53:53 +03:00
|
|
|
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
|
2017-05-20 08:11:06 +03:00
|
|
|
done
|
2018-07-11 03:04:55 +03:00
|
|
|
|
|
|
|
# TODO - figure out multi-arch
|
|
|
|
.PHONY: image
|
|
|
|
image: DOCKER_BUILD_PKGS:=image-linux
|
|
|
|
image: ## build static-compiled packages
|
|
|
|
for p in $(DOCKER_BUILD_PKGS); do \
|
|
|
|
$(MAKE) -C $@ VERSION=$(VERSION) ENGINE_DIR=$(ENGINE_DIR) CLI_DIR=$(CLI_DIR) GO_VERSION=$(GO_VERSION) $${p}; \
|
|
|
|
done
|
|
|
|
|
2018-08-08 00:28:11 +03:00
|
|
|
engine-$(ARCH).tar:
|
|
|
|
$(MAKE) -C image $@
|
|
|
|
|
2018-07-11 03:04:55 +03:00
|
|
|
.PHONY: release
|
|
|
|
release:
|
|
|
|
$(MAKE) -C image $@
|