From: Piotr Dymacz Date: Mon, 6 Feb 2017 09:21:31 +0000 (+0100) Subject: Include git branch and hash in image filename X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=refs%2Fpull%2F140%2Fhead;p=oweals%2Fu-boot_mod.git Include git branch and hash in image filename --- diff --git a/Makefile b/Makefile index c894b80..10863b3 100644 --- a/Makefile +++ b/Makefile @@ -89,9 +89,21 @@ $(if $(IMG_LZMA),\ ) endef +define git_branch +$(shell git symbolic-ref --short -q HEAD 2>/dev/null || echo "unknown") +endef + +define git_hash +$(shell git rev-parse --short=8 -q HEAD 2>/dev/null || echo "unknown") +endef + +define git_branch_hash +git_$(call git_branch)-$(call git_hash) +endef + # $(1): file extension define img_name -u-boot_mod__$(shell date +"%Y%m%d")__$@$(if \ +u-boot_mod__$(shell date +"%Y%m%d")__$(call git_branch_hash)__$@$(if \ $(filter $(IMG_RAM),1),__RAM-LOAD-ONLY)$(if $(1),.$(1)) endef