From 6b408ebd03cca1825d4b206428c674e5fc907e0c Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Sun, 10 Aug 2008 01:44:51 +0000 Subject: [PATCH] Fixed revision info with or without .svn tree. Added rpm targets. git-svn-id: https://proxytunnel.svn.sourceforge.net/svnroot/proxytunnel/trunk/proxytunnel@242 bc163920-b10d-0410-b2c5-a5491ca2ceef --- Makefile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0ebc140..006b5b1 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,19 @@ # # Please uncomment the appropriate settings +name = proxytunnel +version = $(shell awk 'BEGIN { FS="\"" } /^\#define VERSION / { print $$2 }' config.h) + +ifneq ($(wildcard .svn),) +revision = $(shell svnversion | awk 'BEGIN { RS=":" } { next } END { print $$1 }') +else +revision = $(shell echo '$$Revision$$' | sed -e 's/\$$Revision: \([0-9]\+\) \$$$$/\1/') +endif + CC ?= cc CFLAGS ?= -Wall -O2 -ggdb -#OPTFLAGS = -DREVISION=\"$(shell svnversion | awk 'BEGIN { RS=":" } { next } END { print $$1 }')\" -OPTFLAGS = -DREVISION=\"$(shell echo '$$Revision$$' | sed -e 's/\$$Revision: \([0-9]\+\)\$$$$/\1/')\" +OPTFLAGS = -DREVISION=\"$(revision)\" # Comment on non-gnu systems OPTFLAGS += -DHAVE_GETOPT_LONG @@ -47,9 +55,6 @@ SSL_LIBS := -lssl -lcrypto endif LDFLAGS += $(SSL_LIBS) -name = proxytunnel -version = $(shell awk 'BEGIN { FS="\"" } /^\#define VERSION / { print $$2 }' config.h) - prefix = /usr/local bindir = $(prefix)/bin datadir = $(prefix)/share @@ -95,3 +100,9 @@ install: dist: clean docs sed -i -e 's/^Version:.*$$/Version: $(version)/' contrib/proxytunnel.spec find . ! -wholename '*/.svn*' | pax -d -w -x ustar -s ,^./,$(name)-$(version)/, | bzip2 >../$(name)-$(version).tar.bz2 + +rpm: dist + rpmbuild -tb --clean --rmsource --rmspec --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" --define "_rpmdir ../" ../$(name)-$(version).tar.bz2 + +srpm: dist + rpmbuild -ts --clean --rmsource --rmspec --define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" --define "_srcrpmdir ../" ../$(name)-$(version).tar.bz2