[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-27 03:33:21 CET

I left out a key line from my Makefile excerpt (the line with the
foreach-eval statement, found at the end). I re-include the excerpt with
said line below.

-Matt

##
## Automatically generate code value for
## the subversion repository version number.
##

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

SVN_WC_REV := $(shell svnversion -n $(CURRNT_DIR))
SVN_WC_REV_FROM_SRC := $(shell test -f $(SVN_VER_SRC) && sed
's,^.*SVN_Version = "\(.*\)".*$$,\1,' < $(SVN_VER_SRC))

ifneq '$(SVN_WC_REV_FROM_SRC)' '$(SVN_WC_REV)'
$(shell rm -f $(SVN_VER_SRC))
# Debugging stuff
#$(shell echo 'rm -f $(SVN_VER_SRC)' 1>&2)
#$(shell echo SVN_WC_REV = \'$(SVN_WC_REV)\' 1>&2)
#$(shell echo SVN_WC_REV_FROM_SRC = \'$(SVN_WC_REV_FROM_SRC)\' 1>&2)
endif

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

$(SVN_VER_OBJ): $(SVN_VER_SRC)

ALL_OBJS += $(SVN_VER_OBJ)

##
## Create the canned-command sequences (aka "templates)
## that automatically create the rules for programs
## and libraries.
##

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) $(SVN_VER_OBJ)
$(call add_to_all_vars,$(1))
endef

##
## Create the dependency rules as per the program-and-library
## lists specified by the application-specific makefiles.
##
## *** This is the heart of where all the dependencies get created. ***
##

$(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 Fri Jan 27 03:34:50 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.