diff --git a/src/scripts/generate_version_h b/src/scripts/generate_version_h index cdcdf5dd42a..e8379550186 100755 --- a/src/scripts/generate_version_h +++ b/src/scripts/generate_version_h @@ -1,6 +1,7 @@ #!/usr/bin/env bash : ${VPP_BUILD_USER:=$(whoami)} : ${VPP_BUILD_HOST:=$(hostname)} +: ${VPP_BUILD_TOPDIR:=$(git rev-parse --show-toplevel 2> /dev/null)} DATE_FMT="+%Y-%m-%dT%H:%M:%S" SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}" VPP_BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$DATE_FMT" 2>/dev/null || date -u "$DATE_FMT") @@ -27,7 +28,7 @@ cat > ${1} << __EOF__ #define VPP_BUILD_DATE "$VPP_BUILD_DATE" #define VPP_BUILD_USER "$VPP_BUILD_USER" #define VPP_BUILD_HOST "$VPP_BUILD_HOST" -#define VPP_BUILD_TOPDIR "$(git rev-parse --show-toplevel 2> /dev/null)" +#define VPP_BUILD_TOPDIR "$VPP_BUILD_TOPDIR" #define VPP_BUILD_VER "$(scripts/version)" #endif __EOF__