Browse Source

build: generate version.c during configure

The TOOLSVERSION was inconsistent in configure.ac and Makefile:
* Rename the second parameter to AC_INIT() into short_version
* Calculate TOOLSVERSION during configure and use it to
  generate version.c from version.c.in
* For now, leave duplicate TOOLSVERSION in Makefile (for make dist)

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
master
Oron Peled 7 years ago
committed by Tzafrir Cohen
parent
commit
41532ca8a1
  1. 7
      Makefile
  2. 10
      build_tools/make_version_c
  3. 11
      configure.ac
  4. 6
      version.c.in

7
Makefile

@ -143,13 +143,6 @@ programs: libs utils
utils: $(BINS) utils-subdirs
version.c: FORCE
@TOOLSVERSION="${TOOLSVERSION}" build_tools/make_version_c > $@.tmp
@if cmp -s $@.tmp $@ ; then :; else \
mv $@.tmp $@ ; \
fi
@rm -f $@.tmp
tests: $(TEST_BINS)
$(UTILS): %: %.o

10
build_tools/make_version_c

@ -1,10 +0,0 @@
#!/bin/sh
cat << END
/*
* version.c
* Automatically generated
*/
const char dahdi_tools_version[] = "DAHDI Tools Version - ${TOOLSVERSION}";
END

11
configure.ac

@ -2,11 +2,11 @@
AC_PREREQ(2.59)
m4_define([TOOLSVERSION],
m4_define([short_version],
m4_bpatsubst(m4_esyscmd([build_tools/make_version . dahdi/tools]),
[\([0-9.]*\)\(\w\|\W\)*],
[\1]))
AC_INIT(dahdi, TOOLSVERSION, www.asterisk.org)
AC_INIT(dahdi, short_version, www.asterisk.org)
# check existence of the package
AC_CONFIG_SRCDIR([dahdi_cfg.c])
@ -211,7 +211,12 @@ fi
AC_SUBST(PPPD_VERSION)
AC_CONFIG_FILES([makeopts])
AC_SUBST([TOOLSVERSION], m4_esyscmd([build_tools/make_version . dahdi/tools]))
AC_CONFIG_FILES([
makeopts
version.c
])
AC_OUTPUT
AC_MSG_NOTICE(*** dahdi-tools build successfully configured ***)

6
version.c.in

@ -0,0 +1,6 @@
/*
* version.c.in
*/
const char dahdi_tools_version[] = "DAHDI Tools Version - @TOOLSVERSION@";
Loading…
Cancel
Save