[Omake] Adding version control/time stamp info to the module
Aleksey Nogin
anogin at hrl.com
Thu May 17 10:12:15 PDT 2007
On 17.05.2007 02:49, Dmitry Bely wrote:
>> One option would be to have version.h depend on "all the source files",
>> so that it is rebuilt whenever something changes, and get rid of the
>> .BUILD_BEGIN rule.
>
> Maybe so... but after SVN check in no source file is changed but the
> version info is. I would like to rebuild the DLL then.
If you care about the SVN state, then make it depend on the .svn/entries
in all the project directories. Here is what we do for the similar
purpose in the MetaPRL theorem prover:
########################################################################
# Generate the mp_version.ml file
#
make_mp_version$(EXE): make_mp_version.ml
$(OCAMLC) $(OCAMLCFLAGS) -o $@ unix.cma $<
static. =
SVNVERSION_AVAILABLE = $(CheckProg svnversion)
if $(file-exists $(ROOT)/.svn/entries)
#
# Subversion revision potentially depends on all the directories
# in the project.
#
get-entries() =
return $(addsuffix /.svn/entries, $(project-directories))
digest-deps() =
return $(digest-optional $(get-entries))
if $(SVNVERSION_AVAILABLE)
svnversion.txt: $(MLDEBUG_PATH) :value: $(digest-deps)
svnversion $(ROOT) > $@
else
svnrevision(args) =
hi = false
lo =
FS = $'"'
foreach(ent, $(args))
if $(file-exists $(ent))
awk($(ent))
case $'[ \t]*revision="[0-9]*"/>$'
if $(hi)
hi = $(if $(gt $(hi), $2), $(hi), $2)
lo = $(if $(gt $(lo), $2), $2, $(lo))
export
else
hi = $2
lo = $2
export
export
export
export
if $(hi)
if $(eq $(hi), $(lo))
value $(hi)
else
value $"$(lo):$(hi)"
else
value unknown
write_svnversion(file) =
fprintln($(file), $(svnrevision $(get-entries)))
svnversion.txt: $(MLDEBUG_PATH) :value: $(digest-deps)
write_svnversion($@)
else
svnversion.txt:
fprintln($@, unknown)
mp_version.ml: make_mp_version$(EXE) svnversion.txt
./make_mp_version -version $(MP_VERSION) -refiner $(REFINER) -terms
$(TERMS) > $@
LocalOCamlGeneratedFiles(mp_version.ml)
--
Aleksey Nogin, Research Staff Member
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA
More information about the Omake
mailing list