From 54bc2c20b66d919f1df26faa637774ad40b343f1 Mon Sep 17 00:00:00 2001 From: Russell Bryant Date: Sat, 5 Jan 2008 22:09:06 +0000 Subject: Now that the version.h file was getting properly regenerated every time the svn revision changed, every module that used the version was getting rebuilt after every svn update. This severly annoyed me pretty quickly, so I have improved the situation. Now, instead of generating version.h, main/version.c is generated. version.c includes the version information, as well as a couple of API calls for modules to retrieve the version. So now, only version.c will get rebuilt, and the main asterisk binary relinked, which is must faster than rebuilding http.c, manager.c, asterisk.c, relinking the asterisk binary, chan_sip.c, func_version.c, res_agi ... The only minor change in behavior here is that the version information reported by chan_sip, for example, is the version of the Asterisk core, and not necessarily the Asterisk version that the chan_sip module came from. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@96717 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- build_tools/make_version_c | 33 +++++++++++++++++++++++++++++++++ build_tools/make_version_h | 17 ----------------- 2 files changed, 33 insertions(+), 17 deletions(-) create mode 100755 build_tools/make_version_c delete mode 100755 build_tools/make_version_h (limited to 'build_tools') diff --git a/build_tools/make_version_c b/build_tools/make_version_c new file mode 100755 index 000000000..291290ddd --- /dev/null +++ b/build_tools/make_version_c @@ -0,0 +1,33 @@ +#!/bin/sh +if [ ! -f ../.flavor ]; then + EXTRA="" +else + aadkver=`cat ../.version` + aadkflavor=`cat ../.flavor` + EXTRA=" (${aadkflavor} ${aadkver})" +fi +cat << END +/* + * version.c + * Automatically generated + */ + +#include "asterisk.h" + +#include "asterisk/version.h" + +static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}"; + +static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}"; + +const char *ast_get_version(void) +{ + return asterisk_version; +} + +const char *ast_get_version_num(void) +{ + return asterisk_version_num; +} + +END diff --git a/build_tools/make_version_h b/build_tools/make_version_h deleted file mode 100755 index 6d901c2fa..000000000 --- a/build_tools/make_version_h +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -if [ ! -f ../.flavor ]; then - EXTRA="" -else - aadkver=`cat ../.version` - aadkflavor=`cat ../.flavor` - EXTRA=" (${aadkflavor} ${aadkver})" -fi -cat << END -/* - * version.h - * Automatically generated - */ -#define ASTERISK_VERSION "${ASTERISKVERSION}${EXTRA}" -#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM} - -END -- cgit v1.2.3