Commit 37681f0e authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Improve handling of git version.

parent b7b4e75e
GITVERSION_FILE=liblinphone_gitversion.h GITVERSION_FILE=liblinphone_gitversion.h
GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp GITVERSION_FILE_TMP=liblinphone_gitversion.h.tmp
GITDESCRIBE=$(shell git describe)
GITREVISION=$(shell git rev-parse HEAD)
ECHO=/bin/echo ECHO=/bin/echo
...@@ -107,15 +109,17 @@ endif ...@@ -107,15 +109,17 @@ endif
AM_CXXFLAGS=$(AM_CFLAGS) AM_CXXFLAGS=$(AM_CFLAGS)
$(GITVERSION_FILE): make_gitversion_h:
if test -d $(top_srcdir)/.git ; then \ if test "$(GITDESCRIBE)" != "" ; then \
$(ECHO) -n "#define LIBLINPHONE_GIT_VERSION " > $(GITVERSION_FILE_TMP) &&\ $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(GITDESCRIBE)\"" > $(GITVERSION_FILE_TMP) ; \
$(ECHO) \"`cd $(top_srcdir) && git describe`\" >> $(GITVERSION_FILE_TMP) &&\ elif test "$(GITREVISION)" != "" ; then \
if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \ $(ECHO) -n "#define LIBLINPHONE_GIT_VERSION \"$(LINPHONE_VERSION)_$(GITREVISION)\"" > $(GITVERSION_FILE_TMP) ; \
cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \ else \
fi \ $(ECHO) -n "" > $(GITVERSION_FILE_TMP) ; \
&& rm -f $(GITVERSION_FILE_TMP) ;\
fi fi
if ! test -f $(srcdir)/$(GITVERSION_FILE) ; then \ if test "`cat $(GITVERSION_FILE_TMP)`" != "`cat $(srcdir)/$(GITVERSION_FILE)`" ; then \
$(ECHO) -n "" > $(srcdir)/$(GITVERSION_FILE) ;\ cp -f $(GITVERSION_FILE_TMP) $(srcdir)/$(GITVERSION_FILE) ; \
fi fi
rm -f $(GITVERSION_FILE_TMP) ;
$(GITVERSION_FILE): make_gitversion_h
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment