[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Version-value-in-source alternative proposal

From: Matt England <mengland_at_mengland.net>
Date: 2006-01-26 06:29:20 CET

At 1/25/2006 10:02 PM, Matt England wrote:
>Here's another problem with the current
><http://subversion.tigris.org/faq.html#version-value-in-source> solution:

More problems: the above example will force a program re-link every time
'make' is run. Ouch. (Am I the only one doing this stuff? I'm quite
surprised that Subversion has gotten this far without these features.)

For those running more-advanced makefiles, I provide an excerpt of mine
below (haven't proved it to be completely working yet with the svnversion
stuff yet...but I think it's close) in the event this helps anyone else
doing this.

(I put the .cpp in the obj_dir...because it's nasty for my make process to
update the working copy/repo...it's just bad. That's why I try to enforce
a "read-only" policy on my source-file area, and only write to the bin,
obj, lib, and pkg dirs in my builds.)


SVN_VER_SRC := $(TGT_OBJ_DIR)/svn_version.cpp
SVN_VER_OBJ := $(TGT_OBJ_DIR)/svn_version.o

SVN_VER := $(shell svnversion -n .)
SVN_VER_SRC_FIRST_LINE := $(shell test -f $(SVN_VER_SRC) && (head -1

.PHONY: svnversion_check
    @echo $(SVN_VER_HEADER) > $(SVN_VER_SRC)
    @echo -n 'const char* svn_version(void) { const char* SVN_Version = "' \
    @echo -n $(SVN_VER) >> $(SVN_VER_SRC)
    @echo '"; return SVN_Version; }' >> $(SVN_VER_SRC)


define PROGRAM_template
$(call create_app_cpp_vars,$(1))
$(call create_obj_and_dfile_deps,$(1))
$(call program_naming,$(1)): $$($(1)_LIBS:%=-l%) $$($(1)_OBJS) \
                              svnversion_check $(SVN_VER_OBJ)
$(call add_to_all_vars,$(1))

## Do all the stuff -- this is the heart of it all.
$(foreach pgm,$(PROGRAMS),$(eval $(call PROGRAM_template,$(pgm))))

To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Thu Jan 26 06:30:48 2006

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.