Re-add the automatically generated version.h, so that modules can include for
authorRussell Bryant <russell@russellbryant.com>
Tue, 26 Feb 2008 20:19:03 +0000 (20:19 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 26 Feb 2008 20:19:03 +0000 (20:19 +0000)
making build time decisions for cross asterisk version compatibility

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104245 65c4cc65-6c06-0410-ace0-fbb531ad65f3

Makefile
build_tools/make_version_h [new file with mode: 0755]

index 0de8381..03c6a8a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -373,7 +373,7 @@ makeopts.embed_rules: menuselect.makeopts
        @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LDFLAGS)
        @$(MAKE) $(PRINT_DIR) $(MOD_SUBDIRS_EMBED_LIBS)
 
-$(SUBDIRS): main/version.c include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
+$(SUBDIRS): main/version.c include/asterisk/version.h include/asterisk/build.h include/asterisk/buildopts.h defaults.h makeopts.embed_rules
 
 ifeq ($(findstring $(OSARCH), mingw32 cygwin ),)
     # Non-windows:
@@ -409,6 +409,11 @@ main/version.c:
        @cmp -s $@.tmp $@ || mv $@.tmp $@
        @rm -f $@.tmp
 
+include/asterisk/version.h:
+       @build_tools/make_version_h > $@.tmp
+       @cmp -s $@.tmp $@ || mv $@.tmp $@
+       @rm -f $@.tmp
+
 include/asterisk/buildopts.h: menuselect.makeopts
        @build_tools/make_buildopts_h > $@.tmp
        @cmp -s $@.tmp $@ || mv $@.tmp $@
@@ -429,6 +434,7 @@ clean: $(SUBDIRS_CLEAN)
        rm -f defaults.h
        rm -f include/asterisk/build.h
        rm -f main/version.c
+       rm -f include/asterisk/version.h
        @$(MAKE) -C menuselect clean
        cp -f .cleancount .lastclean
 
@@ -716,7 +722,7 @@ spec:
 
 rpm: __rpm
 
-__rpm: main/version.c include/asterisk/buildopts.h spec
+__rpm: main/version.c include/asterisk/version.h include/asterisk/buildopts.h spec
        rm -rf /tmp/asterisk ; \
        mkdir -p /tmp/asterisk/redhat/RPMS/i386 ; \
        $(MAKE) DESTDIR=/tmp/asterisk install ; \
@@ -841,4 +847,4 @@ pdf: asterisk.pdf
 asterisk.pdf:
        $(MAKE) -C doc/tex asterisk.pdf
 
-.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c
+.PHONY: menuselect main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell main/version.c include/asterisk/version.h
diff --git a/build_tools/make_version_h b/build_tools/make_version_h
new file mode 100755 (executable)
index 0000000..0b651ad
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+if [ ! -f ../.flavor ]; then
+    cat << END
+/*
+ * version.h 
+ * Automatically generated
+ */
+#define ASTERISK_VERSION "${ASTERISKVERSION}"
+#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM}
+
+END
+else
+    aadkver=`cat ../.version`
+    aadkflavor=`cat ../.flavor`
+    cat << END
+/*
+ * version.h 
+ * Automatically generated
+ */
+#define ASTERISK_VERSION "${ASTERISKVERSION} (${aadkflavor} ${aadkver})"
+#define ASTERISK_VERSION_NUM ${ASTERISKVERSIONNUM}
+
+END
+fi
+