- if [ -n "$${git_version}" ]; then \
- ##
- ## We remove the leading "v" for the version number
- ##
- git_version="$$(echo "$${git_version}" | sed -r "s/^v([0-9])/\1/")"; \
- ##
- ## If we have a git version, we verify that it isn't the same
- ## as the one currently in the file (if there is one), as we
- ## don't want to update the file if it is already up to date
- ##
- if [ $$(grep -cE "^#define GIT_VERSION_SED \"?$${git_version}\"?$$" "$${version_h}") -eq 0 ]; then \
- sed -i "s'^#define GIT_VERSION_SED.*$$'#define GIT_VERSION \"$${git_version}\"'" "$${version_h}"; \
- fi; \
+ echo $(ECHO_N) "git version: \"$${git_version}\"$(ECHO_C)"; \
+ ##
+ ## We verify that git_version isn't the same as the one
+ ## currently in the file (if there is one), as we don't
+ ## want to update the file if it is already up to date.
+ ##
+ version_match='^#define GIT_VERSION.*'; \
+ old_version=$$($(GREP) "$${version_match}" "$${version_h}"); \
+ new_version="#define GIT_VERSION \"$${git_version}\""; \
+ if [ x"$${old_version}" != x"$${new_version}" ]; then \
+ $(SED) -i -e "s'$${version_match}'$${new_version}'" "$${version_h}"; \
+ else \
+ echo $(ECHO_N) " (cached)$(ECHO_C)"; \