update makefile and version generation to work with git working copy too

This commit is contained in:
Michael Jerris 2010-04-02 00:07:02 -04:00
parent 0b10cd7c63
commit 8e76877a26
3 changed files with 42 additions and 21 deletions

View File

@ -349,7 +349,21 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree
cat src/include/switch_version.h.in > src/include/switch_version.h ; \
touch .version ; \
else \
version=`svnversion . -n || echo hacked` ; \
if [ -d .git ] ; then \
version=`git log --format="%h %ci" -1 HEAD | head -1 || echo hacked` ; \
if [ "x$$version" == "xhacked" ] ; then \
version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \
else \
version="git-$$version" ; \
fi ;\
else \
version=`svnversion . -n || echo hacked` ; \
if [ "x$$version" == "xhacked" ] ; then \
version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \
else \
version="svn-$$version" ; \
fi ;\
fi ; \
oldversion=`cat .version 2>/dev/null || echo "0"` ; \
if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
@ -437,23 +451,29 @@ install-data-local:
test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf
test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs
is-svn:
@if [ ! -d .svn ] ; then \
is-scm:
@if [ ! -d .svn -a ! -d .git ] ; then \
echo ; echo ; \
echo "**************************************************************************************************" ; \
echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \
echo "**************************************************************************************************" ; \
echo "*****************************************************************************************************" ; \
echo "You can not update a release tarball or without a git or svn working copy please clone our git tree: " ; \
echo "git clone git://git.freeswitch.org/freeswitch.git " ; \
echo "or check out our read only svn mirror: " ; \
echo "svn checkout http://svn.freeswitch.org/svn/freeswitch/trunk " ; \
echo "*****************************************************************************************************" ; \
echo ; echo ; \
exit 1; \
fi
update: is-svn
update: is-scm
@if test -d .svn ; then \
test ! -f .version || rm -f .version ; \
echo Updating... ; \
svn update ; \
elif test -d .git ; then \
echo "Pulling updates..." ; \
git pull ; \
else \
echo "This source directory is not an svn working copy" ; \
echo "This source directory is not a git tree or svn working copy" ; \
fi
.nodepends:
@ -483,18 +503,18 @@ core_install: install_core
everything: install
up: is-svn clean
svn update
up: is-scm clean
$(MAKE) update
$(MAKE) -j core
$(MAKE) -j modules
$(MAKE) install
sync: is-svn
svn update
sync: is-scm
$(MAKE) update
$(MAKE) install
speedy-sync: is-svn
svn update
speedy-sync: is-scm
$(MAKE) update
$(MAKE) -j install
libs/openzap/Makefile:
@ -570,15 +590,15 @@ cluecon:
@echo
@echo http://www.cluecon.com
@sleep 5
current: cluecon is-svn update-clean
svn update
current: cluecon update-clean is-scm
$(MAKE) update
$(MAKE) all
$(MAKE) install
installall: current
speedy-current: is-svn update-clean
svn update
speedy-current: update-clean is-scm
$(MAKE) update
$(MAKE) speedy-sure
$(MAKE) install

View File

@ -3,11 +3,11 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
AC_INIT([freeswitch], [1.0.trunk], BUG-REPORT-ADDRESS)
AC_INIT([freeswitch], [1.0.head], BUG-REPORT-ADDRESS)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0])
AC_SUBST(SWITCH_VERSION_MICRO, [trunk])
#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
AC_SUBST(SWITCH_VERSION_MICRO, [head])
#AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
AC_CONFIG_FILES([.version:.version.in])

View File

@ -35,6 +35,7 @@ fi
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
-e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
-i configure.in
if [ -n "$rev" ]; then