From f3fa3f0326d7c9c94584d939273fd49e4a15b91b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Fri, 26 Mar 2010 21:20:29 +0000 Subject: [PATCH] Use a different strategy for generating version tags --- Makefile | 16 +++++++++++----- src/version.c | 1 - support/version.sh | 8 +------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 465cbb93..5b33cb66 100644 --- a/Makefile +++ b/Makefile @@ -148,10 +148,14 @@ BUNDLE_OBJS=$(BUNDLE_SRCS:%.c=%.o) OBJDIRS+= $(sort $(dir $(BUNDLE_OBJS))) .PRECIOUS: ${BUNDLE_SRCS} +VERSION=$(shell support/version.sh) +CURVERSION=$(shell cat ${BUILDDIR}/ver || echo "0") + # Common CFLAGS for all files CFLAGS_com = -g -funsigned-char -O2 CFLAGS_com += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 CFLAGS_com += -I${BUILDDIR} -I${CURDIR}/src -I${CURDIR} +CFLAGS_com += -DHTS_VERSION=\"$(VERSION)\" all: ${PROG} @@ -174,17 +178,19 @@ ${BUILDDIR}/%.so: ${SRCS_EXTRA} ${CC} -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o $@ $< -ldl clean: - rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundles + rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundles ${BUILDDIR}/ver find . -name "*~" | xargs rm -f distclean: clean rm -rf build.* -# Create tvheadendversion.h -$(BUILDDIR)/tvheadendversion.h: - $(CURDIR)/support/version.sh $(CURDIR) $(BUILDDIR)/tvheadendversion.h +ifneq ($(VERSION), $(CURVERSION)) +.PHONY: src/version.c +$(info Version changed) +src/version.c: + echo $(VERSION) >${BUILDDIR}/ver +endif -src/version.c: $(BUILDDIR)/tvheadendversion.h # Include dependency files if they exist. -include $(DEPS) $(BUNDLE_DEPS) diff --git a/src/version.c b/src/version.c index b1eb24ee..118eb0c4 100644 --- a/src/version.c +++ b/src/version.c @@ -1,4 +1,3 @@ -#include "tvheadendversion.h" #include "config.h" #ifdef HTS_RELEASE_TAG diff --git a/support/version.sh b/support/version.sh index f26204bd..98035c68 100755 --- a/support/version.sh +++ b/support/version.sh @@ -20,10 +20,4 @@ fi # no version number found test $revision || revision=UNKNOWN -NEW_REVISION="#define HTS_VERSION \"$revision\"" -OLD_REVISION=`cat version.h 2> /dev/null` - -# Update version.h only on revision changes to avoid spurious rebuilds -if test "$NEW_REVISION" != "$OLD_REVISION"; then - echo "$NEW_REVISION" > "$2" -fi +echo $revision