mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-21 22:23:05 +00:00
Makefile: Add multiple methods of determining the version number
This fixes m1n1 stage2 version numbers (for .tar.gz downloads) as long as the directory name is left intact, and also supports packagers passing their own version number if needed. Signed-off-by: Hector Martin <marcan@marcan.st>
This commit is contained in:
parent
db93de58b8
commit
4c2c4085f1
2 changed files with 18 additions and 1 deletions
2
Makefile
2
Makefile
|
@ -203,7 +203,7 @@ build/$(NAME).bin: build/$(NAME)-raw.elf
|
|||
|
||||
update_tag:
|
||||
@mkdir -p build
|
||||
@echo "#define BUILD_TAG \"$$(git describe --tags --always --dirty)\"" > build/build_tag.tmp
|
||||
@./version.sh > build/build_tag.tmp
|
||||
@cmp -s build/build_tag.h build/build_tag.tmp 2>/dev/null || \
|
||||
( mv -f build/build_tag.tmp build/build_tag.h && echo " TAG build/build_tag.h" )
|
||||
|
||||
|
|
17
version.sh
Executable file
17
version.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
dirbase="$(basename "$(pwd)")"
|
||||
|
||||
if [ -n "$M1N1_VERSION_TAG" ]; then
|
||||
version="$M1N1_VERSION_TAG"
|
||||
elif [ -e ".git" ]; then
|
||||
version="$(git describe --tags --always --dirty)"
|
||||
elif [ "${dirbase:0:5}" == "m1n1-" ]; then
|
||||
version="${dirbase:5}"
|
||||
version="v${version##v}"
|
||||
else
|
||||
version="unknown"
|
||||
fi
|
||||
|
||||
echo "#define BUILD_TAG \"$version\""
|
Loading…
Reference in a new issue