5 echo "usage: $0 <toplevel-source-dir>"
11 VERSION_FILE
="${src_top_dir}/version.h"
12 PREV_MC_VERSION
="unknown"
13 CURR_MC_VERSION
="${PREV_MC_VERSION}"
15 if [ -r "${VERSION_FILE}" ]
17 PREV_MC_VERSION
=`sed -n 's/^#define MC_CURRENT_VERSION "\(.*\)"$/\1/p' "${VERSION_FILE}"`
18 CURR_MC_VERSION
="${PREV_MC_VERSION}"
23 if [ ! -f "${VERSION_FILE}" \
24 -o "${PREV_MC_VERSION}" != "${CURR_MC_VERSION}" ]
26 cat >"${VERSION_FILE}" <<EOF
27 #ifndef MC_CURRENT_VERSION
28 /* This is an autogenerated file. Don't edit! */
29 #define MC_CURRENT_VERSION "${CURR_MC_VERSION}"
36 git_head
=`git --git-dir "${src_top_dir}/.git" rev-parse --verify HEAD 2>/dev/null`
37 [ -z "${git_head}" ] && mc_print_version
40 CURR_MC_VERSION
="${git_head}"
42 new_version
=`git --git-dir "${src_top_dir}/.git" describe 2>/dev/null`
43 [ -z "${new_version}" ] && mc_print_version
45 # store pretty tagged version
46 CURR_MC_VERSION
="${new_version}"