# Include from a project Makefile. Sets VERSION (canonical, no leading v) # and IMAGE_TAG (Docker rendering) via builder version.sh. # # Command-line / environment VERSION= is passed as --version (official X.Y.Z # only when HEAD exact-matches that tag). Unset or empty VERSION is derived. # # include $(HOME)/.pouch/skills/builder/scripts/version.mk _builder_scripts_dir := $(dir $(lastword $(MAKEFILE_LIST))) ifeq ($(BUILDER_VERSION_SH),) BUILDER_VERSION_SH := $(wildcard $(_builder_scripts_dir)version.sh) endif ifeq ($(BUILDER_VERSION_SH),) ifneq ($(BUILDER_SKILL_DIR),) BUILDER_VERSION_SH := $(wildcard $(BUILDER_SKILL_DIR)/scripts/version.sh) endif endif ifeq ($(BUILDER_VERSION_SH),) BUILDER_VERSION_SH := $(wildcard $(HOME)/.pouch/skills/builder/scripts/version.sh) endif ifeq ($(BUILDER_VERSION_SH),) BUILDER_VERSION_SH := $(wildcard $(HOME)/.skills/skills/builder/scripts/version.sh) endif ifeq ($(BUILDER_VERSION_SH),) $(error version.sh not found; set BUILDER_SKILL_DIR or clone pouch to ~/.pouch) endif ifeq ($(filter command line environment,$(origin VERSION)),) VERSION := $(shell "$(BUILDER_VERSION_SH)") else ifeq ($(strip $(VERSION)),) VERSION := $(shell "$(BUILDER_VERSION_SH)") else VERSION := $(shell "$(BUILDER_VERSION_SH)" --version "$(VERSION)") endif ifeq ($(strip $(VERSION)),) $(error version.sh produced an empty version) endif ifeq ($(origin IMAGE_TAG),undefined) IMAGE_TAG := $(shell "$(BUILDER_VERSION_SH)" --docker --version "$(VERSION)") endif