make_version_c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. GREP=${GREP:-grep}
  3. if test ! -f .flavor ; then
  4. EXTRA=""
  5. elif test ! -f .version ; then
  6. aadkflavor=`cat .flavor`
  7. EXTRA=" (${aadkflavor})"
  8. else
  9. aadkver=`cat .version`
  10. aadkflavor=`cat .flavor`
  11. EXTRA=" (${aadkflavor} ${aadkver})"
  12. fi
  13. if ${GREP} "AST_DEVMODE" makeopts | ${GREP} -q "yes"
  14. then
  15. BUILDOPTS="AST_DEVMODE"
  16. fi
  17. TMP=`${GREP} -e "^MENUSELECT_CFLAGS" menuselect.makeopts | sed 's/MENUSELECT_CFLAGS\=//g' | sed 's/-D//g'`
  18. for x in ${TMP}; do
  19. if test "x${BUILDOPTS}" != "x" ; then
  20. BUILDOPTS="${BUILDOPTS}, ${x}"
  21. else
  22. BUILDOPTS="${x}"
  23. fi
  24. done
  25. cat << END
  26. /*
  27. * version.c
  28. * Automatically generated
  29. */
  30. #include "asterisk.h"
  31. #include "asterisk/ast_version.h"
  32. static const char asterisk_version[] = "${ASTERISKVERSION}${EXTRA}";
  33. static const char asterisk_version_num[] = "${ASTERISKVERSIONNUM}";
  34. static const char asterisk_build_opts[] = "${BUILDOPTS}";
  35. const char *ast_get_version(void)
  36. {
  37. return asterisk_version;
  38. }
  39. const char *ast_get_version_num(void)
  40. {
  41. return asterisk_version_num;
  42. }
  43. const char *ast_get_build_opts(void)
  44. {
  45. return asterisk_build_opts;
  46. }
  47. END