tools/version.h and Makefile.unix: Minor improvement to previous commit: Permit custom version strings that do not derive from the major and minor version number
This commit is contained in:
parent
d07666c85b
commit
5707d01cc3
@ -42,7 +42,7 @@ include $(TOPDIR)/tools/Config.mk
|
||||
|
||||
# In case .version file does not exist
|
||||
|
||||
CONFIG_VERSION_STRING ?= "0.0"
|
||||
CONFIG_VERSION_STRING ?= "Unversioned"
|
||||
CONFIG_VERSION_MAJOR ?= 0
|
||||
CONFIG_VERSION_MINOR ?= 0
|
||||
CONFIG_VERSION_BUILD ?= "0"
|
||||
@ -288,7 +288,7 @@ tools/mkversion$(HOSTEXEEXT):
|
||||
|
||||
$(TOPDIR)/.version:
|
||||
$(Q) echo "Create .version"
|
||||
$(Q) tools/version.sh -v $(CONFIG_VERSION_MAJOR).$(CONFIG_VERSION_MINOR) -b $(CONFIG_VERSION_BUILD) .version
|
||||
$(Q) tools/version.sh -s $(CONFIG_VERSION_STRING) -v $(CONFIG_VERSION_MAJOR).$(CONFIG_VERSION_MINOR) -b $(CONFIG_VERSION_BUILD) .version
|
||||
ifeq ($(GIT_DIR),y)
|
||||
$(Q) tools/gen_gitrev.sh -t $(TOPDIR) >> .version
|
||||
endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# version.sh
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Copyright (C) 2011, 2019 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -36,12 +36,13 @@ WD=`pwd`
|
||||
|
||||
# Get command line parameters
|
||||
|
||||
USAGE="USAGE: $0 [-d|-h] [-b <build>] -v <major.minor> <outfile-path>"
|
||||
USAGE="USAGE: $0 [-d|-h] [-b <build>] [-s <version-string>] -v <major.minor> <outfile-path>"
|
||||
ADVICE="Try '$0 -h' for more information"
|
||||
|
||||
unset VERSION
|
||||
unset BUILD
|
||||
unset OUTFILE
|
||||
unset VERSION_STRING
|
||||
|
||||
while [ ! -z "$1" ]; do
|
||||
case $1 in
|
||||
@ -52,6 +53,10 @@ while [ ! -z "$1" ]; do
|
||||
-d )
|
||||
set -x
|
||||
;;
|
||||
-s )
|
||||
shift
|
||||
VERSION_STRING=$1
|
||||
;;
|
||||
-v )
|
||||
shift
|
||||
VERSION=$1
|
||||
@ -101,6 +106,12 @@ if [ -z ${OUTFILE} ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the version string was not provided, then set it to the version
|
||||
|
||||
if [ -z "${VERSION_STRING}" ]; then
|
||||
VERSION_STRING=${VERSION}
|
||||
fi
|
||||
|
||||
# Get the major and minor version numbers
|
||||
|
||||
MAJOR=`echo ${VERSION} | cut -d'.' -f1`
|
||||
@ -132,7 +143,7 @@ fi
|
||||
|
||||
echo "#!/bin/bash" >${OUTFILE}
|
||||
echo "" >>${OUTFILE}
|
||||
echo "CONFIG_VERSION_STRING=\"${VERSION}\"" >>${OUTFILE}
|
||||
echo "CONFIG_VERSION_STRING=\"${VERSION_STRING}\"" >>${OUTFILE}
|
||||
echo "CONFIG_VERSION_MAJOR=${MAJOR}" >>${OUTFILE}
|
||||
echo "CONFIG_VERSION_MINOR=${MINOR}" >>${OUTFILE}
|
||||
echo "CONFIG_VERSION_BUILD=\"${BUILD}\"" >>${OUTFILE}
|
||||
|
Loading…
Reference in New Issue
Block a user