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

@ -348,8 +348,22 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree
if test $$have_version = 1 ; then \ if test $$have_version = 1 ; then \
cat src/include/switch_version.h.in > src/include/switch_version.h ; \ cat src/include/switch_version.h.in > src/include/switch_version.h ; \
touch .version ; \ touch .version ; \
else \
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 \ else \
version=`svnversion . -n || echo hacked` ; \ 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"` ; \ oldversion=`cat .version 2>/dev/null || echo "0"` ; \
if test "$$oldversion" != "$$version" || test $$force = 1 ; then \ 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 ; \ 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)$(sysconfdir) || $(MAKE) samples-conf
test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs
is-svn: is-scm:
@if [ ! -d .svn ] ; then \ @if [ ! -d .svn -a ! -d .git ] ; then \
echo ; echo ; \ echo ; echo ; \
echo "**************************************************************************************************" ; \ echo "*****************************************************************************************************" ; \
echo "You can not update a release tarball or without a svn working copy, please checkout fresh from svn" ; \ echo "You can not update a release tarball or without a git or svn working copy please clone our git tree: " ; \
echo "**************************************************************************************************" ; \ 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 ; \ echo ; echo ; \
exit 1; \ exit 1; \
fi fi
update: is-svn update: is-scm
@if test -d .svn ; then \ @if test -d .svn ; then \
test ! -f .version || rm -f .version ; \ test ! -f .version || rm -f .version ; \
echo Updating... ; \ echo Updating... ; \
svn update ; \ svn update ; \
elif test -d .git ; then \
echo "Pulling updates..." ; \
git pull ; \
else \ 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 fi
.nodepends: .nodepends:
@ -483,18 +503,18 @@ core_install: install_core
everything: install everything: install
up: is-svn clean up: is-scm clean
svn update $(MAKE) update
$(MAKE) -j core $(MAKE) -j core
$(MAKE) -j modules $(MAKE) -j modules
$(MAKE) install $(MAKE) install
sync: is-svn sync: is-scm
svn update $(MAKE) update
$(MAKE) install $(MAKE) install
speedy-sync: is-svn speedy-sync: is-scm
svn update $(MAKE) update
$(MAKE) -j install $(MAKE) -j install
libs/openzap/Makefile: libs/openzap/Makefile:
@ -570,15 +590,15 @@ cluecon:
@echo @echo
@echo http://www.cluecon.com @echo http://www.cluecon.com
@sleep 5 @sleep 5
current: cluecon is-svn update-clean current: cluecon update-clean is-scm
svn update $(MAKE) update
$(MAKE) all $(MAKE) all
$(MAKE) install $(MAKE) install
installall: current installall: current
speedy-current: is-svn update-clean speedy-current: update-clean is-scm
svn update $(MAKE) update
$(MAKE) speedy-sure $(MAKE) speedy-sure
$(MAKE) install $(MAKE) install

View File

@ -3,11 +3,11 @@
# Must change all of the below together # Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment # 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_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0]) AC_SUBST(SWITCH_VERSION_MINOR, [0])
AC_SUBST(SWITCH_VERSION_MICRO, [trunk]) AC_SUBST(SWITCH_VERSION_MICRO, [head])
#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here]) #AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template]) AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
AC_CONFIG_FILES([.version:.version.in]) AC_CONFIG_FILES([.version:.version.in])

View File

@ -35,6 +35,7 @@ fi
sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ 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_MINOR, \[\).*\(\])\)|\1$minor\2|" \
-e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\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 -i configure.in
if [ -n "$rev" ]; then if [ -n "$rev" ]; then