diff --git a/Makefile b/Makefile index 4015b58..5f9d874 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,10 @@ IDN_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --cflags IDN_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_IDN $(PKG_CONFIG) --libs libidn` CT_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --cflags libnetfilter_conntrack` CT_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_CONNTRACK $(PKG_CONFIG) --libs libnetfilter_conntrack` -LUA_CFLAGS=`echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1` -LUA_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` +LUA_CFLAGS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --cflags lua5.1` +LUA_LIBS= `echo $(COPTS) | ../bld/pkg-wrapper HAVE_LUASCRIPT $(PKG_CONFIG) --libs lua5.1` SUNOS_LIBS= `if uname | grep SunOS 2>&1 >/dev/null; then echo -lsocket -lnsl -lposix4; fi` +VERSION= -DVERSION='\"`../bld/get-version`\"' OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \ dnsmasq.o dhcp.o lease.o rfc2131.o netlink.o dbus.o bpf.o \ @@ -48,7 +49,7 @@ OBJS = cache.o rfc1035.o util.o option.o forward.o network.o \ all : @cd $(SRC) && $(MAKE) \ - BUILD_CFLAGS="$(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \ + BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(IDN_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS)" \ BUILD_LIBS="$(DBUS_LIBS) $(IDN_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS)" \ -f ../Makefile dnsmasq @@ -65,8 +66,8 @@ install-common : all-i18n : @cd $(SRC) && $(MAKE) \ - I18N=-DLOCALEDIR='\"$(LOCALEDIR)\"' \ - BUILD_CFLAGS="$(DBUS_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \ + I18N=-DLOCALEDIR=\'\"$(LOCALEDIR)\"\' \ + BUILD_CFLAGS="$(VERSION) $(DBUS_CFLAGS) $(CT_CFLAGS) $(LUA_CFLAGS) `$(PKG_CONFIG) --cflags libidn`" \ BUILD_LIBS="$(DBUS_LIBS) $(CT_LIBS) $(LUA_LIBS) $(SUNOS_LIBS) `$(PKG_CONFIG) --libs libidn`" \ -f ../Makefile dnsmasq @cd $(PO); for f in *.po; do \ diff --git a/bld/get-version b/bld/get-version new file mode 100755 index 0000000..42849ce --- /dev/null +++ b/bld/get-version @@ -0,0 +1,28 @@ +#!/bin/sh + +# Determine the version string to build into a binary. +# When building in the git repository, we can use the output +# of "git describe" which gives an unequivocal answer. +# +# Failing that, we use the contents of the VERSION file +# which has a set of references substituted into it by git. +# If we can find one which matches $v[0-9].* then we assume it's +# a version-number tag, else we just use the whole string. + +# we're called with pwd == src +cd .. + +if [ -d .git ]; then + git describe +else + vers=`cat VERSION | sed 's/[(), ]/\n/ g' | grep -m 1 $v[0-9]` + + if [ $? -eq 0 ]; then + echo ${vers#v} + else + cat VERSION + fi +fi + +exit 0 + diff --git a/src/config.h b/src/config.h index a36b84b..ca8e298 100644 --- a/src/config.h +++ b/src/config.h @@ -14,8 +14,6 @@ along with this program. If not, see . */ -#define VERSION "2.60test7" - #define FTABSIZ 150 /* max number of outstanding requests (default) */ #define MAX_PROCS 20 /* max no children for TCP requests */ #define CHILD_LIFETIME 150 /* secs 'till terminated (RFC1035 suggests > 120s) */