Generate version.c based on output of "hg id".

This commit is contained in:
Micah Cowan 2007-10-09 16:03:07 -07:00
parent 0b0893fabe
commit 181c613814
2 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,7 @@ src/wget
src/tags
src/TAGS
src/libunittest.a
src/version.c
doc/stamp-vti
doc/wget.1
doc/wget.pod

View File

@ -47,6 +47,14 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c ftp-basic.c \
EXTRA_wget_SOURCES = mswindows.c
LDADD = $(ALLOCA) $(LIBOBJS)
# version.c's not really _phony_, but it does need to be generated each run.
HG_ID = $(shell hg id 2>/dev/null | cut -f 1 -d ' ')
.PHONY: version.c
version.c:
printf '%s' 'const char *version_string = "@VERSION@' > $@
[ "$(HG_ID)" ] && printf '%s' ' ($(HG_ID))' >> $@
printf '%s\n' '";' >> $@
check_LIBRARIES = libunittest.a
libunittest_a_SOURCES = $(wget_SOURCES) test.c test.h
libunittest_a_CPPFLAGS = -DTESTING