Ver código fonte

inject git-describe version and date into org manual

	* doc/Makefile: introduce target for git-describe.texi, which is an
	  automatically generated file that records the output of git-describe
	  and date; remove this file during make clean
	* doc/org.texi: remove @set for VERSION and DATE and do an @include
	  git-describe.texi instead
Achim Gratz 13 anos atrás
pai
commit
306c748f63
2 arquivos alterados com 17 adições e 4 exclusões
  1. 16 2
      doc/Makefile
  2. 1 2
      doc/org.texi

+ 16 - 2
doc/Makefile

@@ -2,6 +2,14 @@ ifeq ($(MAKELEVEL), 0)
   $(error This make needs to be started as a sub-make from the toplevel directory.)
 endif
 
+GITVERSION	= $(shell git describe --abbrev=6 HEAD)
+ORGVERSION	= $(subst release_,,$(shell git describe --abbrev=0 HEAD))
+GITSTATUS	= $(shell git status -uno --porcelain)
+DATE            = $(shell date +%Y-%m-%d)
+ifneq ("$(GITSTATUS)", "")
+  GITVERSION := $(GITVERSION).dirty
+endif
+
 .PHONY:		all info html pdf card manual guide install clean cleanall clean-install
 
 all:		info html pdf card
@@ -23,6 +31,11 @@ guide::		orgguide.texi
 	$(TEXI2HTML) -o $@ $<
 	../UTILITIES/guidesplit.pl $@/*
 
+git-describe.texi: org.texi
+	@echo "@c automatically generated, do not edit"  > git-describe.texi
+	@echo "@set VERSION $(ORGVERSION) ($(GITVERSION))" >> git-describe.texi
+	@echo "@set DATE $(DATE)" >> git-describe.texi
+
 
 install:	org
 	if [ ! -d $(infodir) ]; then $(MKDIR) $(infodir); else true; fi ;
@@ -32,7 +45,7 @@ install:	org
 clean:
 	$(RM) org *.pdf *.html *_letter.tex \
 	      *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.pg *.pgs \
-	      *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps
+	      *.toc *.tp *.tps *.vr *.vrs *.log *.html *.ps git-describe.texi
 cleanall:	clean
 	$(RMR) guide manual
 
@@ -44,6 +57,7 @@ clean-install:
 .SUFFIXES:	.texi .tex .txt
 
 %:		%.texi
+	$(MAKE) git-describe.texi
 	$(MAKEINFO) --no-split $< -o $@
 
 %.pdf:		LC_ALL=C	# work around a bug in texi2dvi
@@ -61,5 +75,5 @@ clean-install:
 	perl ../UTILITIES/orgcard2txt.pl $< > $@
 
 %_letter.tex:	%.tex
-	perl -pe 's/\\pdflayout=\(0l\)/\\pdflayout=(1l)/' \
+	$(SED) -e 's/\\pdflayout=(0l)/\\pdflayout=(1l)/' \
                    $< > $@

+ 1 - 2
doc/org.texi

@@ -4,8 +4,7 @@
 @setfilename ../../info/org
 @settitle The Org Manual
 
-@set VERSION 7.8.09
-@set DATE April 2012
+@include git-describe.texi
 
 @c Use proper quote and backtick for code sections in PDF output
 @c Cf. Texinfo manual 14.2