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

Dmitry Bely dmitry.bely at gmail.com
Thu May 17 02:49:39 PDT 2007


On 5/16/07, Aleksey Nogin <nogin at metaprl.org> wrote:
>
> > I need to attach a resource file to the DLL built by omake. The
> > resource file is generated from the version control info and the
> > current time stamp. How to properly set dependencies between the DLL
> > and the resource file, not rebuilding everything all the time? My best
> > try is (simplified Omakefile):
> >
> > version.h: version.h.in
> >  <version control tool> $< $@
> > VersInfo.res: VersInfo.rc version.h
> >  <resource compiler> $<
>
> Is the current date given explicitly in the command line? Or is it used
> implicitly by the "version control tool"?

OK, here are the details. "Version control tool" is subwcrev - part of
TortoiseSVN software which is Subversion Windows client.

version.h.in:
#define VC_REVISION       $WCREV$
#define VC_LOCAL_MODS     "+$WCNOW$"
#define VC_REVISION_STR   "$WCREV$" $WCMODS?VC_LOCAL_MODS:$

Omakefile:
version.h: version.h.in
  subwcrev .. $< $@

If no local modification is found,  version.h will be something like this:

#define VC_REVISION       273
#define VC_LOCAL_MODS     "+2007/05/17 13:36:26"
#define VC_REVISION_STR   "273"

If there are local modifications:

#define VC_REVISION       273
#define VC_LOCAL_MODS     "+2007/05/17 13:36:26"
#define VC_REVISION_STR   "273" "+2007/05/17 13:36:26"

VC_REVISION_STR is what I like to put into the version info.

> > .BUILD_BEGIN: VersInfo.res
> >  rm -f version.h
>
> Why is this here? Note that .BUILD_BEGIN is built first whenever you run
> OMake, so this would case version.h to be deleted every time.

Exactly. If I don't remove the file it won't be rebuild and so the
time stamp (in case local modifications are present) won't be updated.
If you know how to rebuild it conditionally please tell me that.

> > But this way VersInfo.res is rebuild on every omake invocation
> > (although the DLL itself does not).
>
> Of course - your .BUILD_BEGIN deletes version.h, then the regular build
> phase starts, version.h is rebuilt, it's now different (as the time
> stamp have changed), so the VersInfo.res is then rebuilt as well.
>
> 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.

- Dmitry Bely


More information about the Omake mailing list