I'm using mercurial
as a SCM, and an output from the hg parents
command in my makefile
to store build number and version information in my program. However, mercurial
is not always present on machines where I try to build the program. Thus, hg parent
fails.
I'd like to use a substitute string (hard-coded or output from other program) when mercurial
is not available. But I'm no good in makefile
scripting.
Can you provide a hint how to compose a makefile
-command that would store the output from a hg parents
if it's available, or output from date
if hg
is not available, in the internal variable.
views:
24answers:
1Cranky how? This is how I'd do it, with the possible exception of making a small shell script to do a test for `hg` first, then `hg parents` or `date`. That way, you don't have command not found messages.
Jack Kelly
2010-10-10 20:16:48