git log -n1 HEAD --pretty=format:"#define GIT_VERSION \"-g%h\"%n" > $1

#!/bin/sh

# Input parameters
file_to_write="$1"

# Test if we are in a repo
if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ];
then
	#echo "In a repo"
	# Get the version of the last commit of the repo
	version=`git log -n1 HEAD --pretty=format:%h`
else
	#echo "Not in a repo"
	version="unknown"
fi

#echo "version: [$version]"

# Create the C definition
definition="#define GIT_VERSION \"-g$version\""

#echo "definition: [$definition]"

# Write definition to file
echo "$definition" > "$file_to_write"

Support build of the project from a tarball
Support build of the project from a tarball

Signed-off-by: Franck LENORMAND <a1f87c74375f8fe45b8adf8cbbd750bc53e76513@nxp.com>
