[Omake] Adding version control/time stamp info to the module

Aleksey Nogin anogin at hrl.com
Tue May 29 10:21:11 PDT 2007


On 24.05.2007 06:27, Dmitry Bely wrote:

> Aleksey,
> 
> Thank you very much for you Subversion recipe, but one thing is still
> unclear for me. You wrote:
> 
>> One option would be to have version.h depend on "all the source files",
>> so that it is rebuilt whenever something changes
> 
> In the simplest case if I have something like
> 
> files = ...
> program = ...
> .DEFAULT: $(OcamlProgram(program, files))
> 
> How to make version.h depend on on "all the source files"? Should I
> duplicate all OcamlProgram() logic with
> 
> CMOFILES  = $(addsuffix .cmo, $(files))
> CMXFILES  = $(addsuffix .cmx, $(files))
> ...
> version.h.byte: $(CMOFILES) ...
> ...
> version.h.opt: $(CMXFILES) ...
> ...

Why do you want to do that - why do you want to have separate version 
files and why do you want a dependency on the intermediary binaries?

If you do not need version.h in order to build the program, then you can 
just do

.DEFAULT version.h: $(OcamlProgram(program, files))

If you do, then you can do something like

version.h: $(addsuffix .ml, $(files))

Alternatively, you could use "svn st" to find a list of all the source 
files and use that. Omitting the code for the cases when some of 
svn/svnversion/colrm are not available, you can probably do something like:

.SCANNER: scan-svnentries: :value: $(project-directories)
    section
       entries = $(filter-exists $(file $(addsuffix /.svn/entries, 
$(project-directories))))
       println($"svnversion.txt: $(entries)")
       println($"svnsources.txt: $(entries)")

svnsources.txt: :scanner: scan-svnentries
    svn st | colrm 1 40 > $@

.SCANNER: scan-svnsources: snvsources.txt
    section
       files = $(cat $<)
       println($"svnversion.txt: $(files)")

svnversion.txt: :scanner: scan-svnenries scan-svnsources
    svnversion $(ROOT) > $@

-- 
Aleksey Nogin, Research Scientist
Advanced Technologies Department, Information & System Sciences Lab
HRL Laboratories, LLC, Malibu, CA


More information about the Omake mailing list