diff en/Makefile @ 177:c54f4c106fd5

Record the version of Mercurial used.
author Bryan O'Sullivan <bos@serpentine.com>
date Wed, 28 Mar 2007 23:01:57 -0700
parents 5f305adeb584
children 5fc4a45c069f
line wrap: on
line diff
--- a/en/Makefile	Wed Mar 28 22:55:13 2007 -0700
+++ b/en/Makefile	Wed Mar 28 23:01:57 2007 -0700
@@ -1,7 +1,5 @@
 # This makefile requires GNU make.
 
-hg_id := $(shell hg parents --template '{node|short}\n')
-
 sources := \
 	00book.tex \
 	99book.bib \
@@ -12,6 +10,7 @@
 	concepts.tex \
 	daily.tex \
 	filenames.tex \
+	hg_id.tex \
 	hook.tex \
 	intro.tex \
 	mq.tex \
@@ -91,6 +90,13 @@
 	-output-directory $(dir $(1)) \
 	-jobname $(basename $(notdir $(1)))
 
+hg = $(shell which hg)
+
+hg-id = $(shell hg parents --template '{node|short}\n')
+
+hg-version = $(shell hg version -q | \
+		     sed 's,.*(version \(unknown\|[a-f0-9]*\)),\1,')
+
 all: pdf html
 
 pdf: pdf/hgbook.pdf
@@ -173,7 +179,10 @@
 	cd examples && ./run-example $(notdir $<)
 
 build_id.tex: $(wildcard ../.hg/00changelog.[id])
-	echo -n $(hg_id) > build_id.tex
+	echo -n $(hg-id) > build_id.tex
+
+hg_id.tex: $(hg)
+	echo -n $(hg-version) > hg_id.tex
 
 clean:
 	rm -rf dist html pdf \
@@ -181,7 +190,7 @@
 		$(image-dot:%.dot=%.png) \
 		$(image-svg:%.svg=%.pdf) \
 		$(image-svg:%.svg=%.png) \
-		examples/*.{lxo,run} examples/.run build_id.tex
+		examples/*.{lxo,run} examples/.run build_id.tex hg_id.tex
 
 install: pdf split $(dist-sources)
 	rm -rf dist