Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#929 closed Bug (fixed)

version.h should reflect SVN status

Reported by: KyleK Owned by: charles
Priority: Normal Milestone: 1.20
Component: libtransmission Version: 1.11
Severity: Normal Keywords:
Cc: KyleK

Description

In the current build system version.h is only rebuilt when it doesn't exist yet. Since the project is very active with lots of check-ins, I would like it to be updated on a more regular basis, preferably every time the revision changes.

I tried several things to make this work but my Makefile skills aren't very good. Maybe someone has an idea on how to achieve this?

Change History (7)

comment:1 Changed 14 years ago by mezz

I have checked in libtransmission/Makefile.am and it looks ok to me. It shows that it will overwrite version.h at the each time when you rebuild in same directory. Are you sure it doesn't overwrite at the each time when rebuild?

version.h:
	echo '#define PEERID_PREFIX         "'@PEERID_PREFIX@'"' > version.h
	echo '#define USERAGENT_PREFIX      "'@USERAGENT_PREFIX@'"' >> version.h
	echo '#define SVN_REVISION          "'`svn info | grep "Revision" | awk -F': ' '{print $$2}'`'"' >> version.h
	echo '#define SHORT_VERSION_STRING  "'@USERAGENT_PREFIX@'"' >> version.h
	echo '#define LONG_VERSION_STRING   "'@USERAGENT_PREFIX@' ('`svn info | grep "Revision" | awk -F': ' '{print $$2}'`')"' >> version.h

I haven't test it, so if the overwrite doesn't work then you can try to add something like this:

version.h:
	if test -f version.h; then \
		rm -f version.h; \
	fi
	[...echo stuff...]

comment:2 Changed 14 years ago by mezz

Wish Trac has edit option. More correct solution would be add remove version.h in the 'make clean' target.

comment:3 follow-up: Changed 14 years ago by charles

mezz: if you did that, "make clean" would effectively make the directory unbuildable if you were building from a tarball instead of svn.

comment:5 Changed 14 years ago by charles

  • Milestone changed from None Set to 1.20
  • Status changed from new to assigned

comment:6 Changed 14 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:7 in reply to: ↑ 3 Changed 14 years ago by mezz

Replying to charles:

mezz: if you did that, "make clean" would effectively make the directory unbuildable if you were building from a tarball instead of svn.

Right, I didn't think about the tarball. I see you have gone with a better way in r5788.

Note: See TracTickets for help on using tickets.