Include git branch and hash in image filename 140/head
authorPiotr Dymacz <pepe2k@gmail.com>
Mon, 6 Feb 2017 09:21:31 +0000 (10:21 +0100)
committerPiotr Dymacz <pepe2k@gmail.com>
Mon, 6 Feb 2017 09:21:31 +0000 (10:21 +0100)
Makefile

index c894b803116a32984d2b3d6e2060ea31c522a680..10863b36308ee6fffea00a537251b5a5d5bb7e4c 100644 (file)
--- 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