Bryan O'Sullivan avatar Bryan O'Sullivan committed e6f4088

Generate a PDF file with a feedback link on each paragraph.

Comments (0)

Files changed (5)

 
 syntax: glob
 
+beta/*.tex
 build_id.tex
 *.aux
 *.bbl
 \usepackage{makeidx}
 \usepackage{ifpdf}
 \usepackage{graphicx}
-\usepackage{newcent}
+\usepackage{pslatex}
 \usepackage{fancyvrb}
 % leave hyperref until last
 \usepackage{hyperref}
 \pagenumbering{roman}
 \tableofcontents
 \listoffigures
-\listoftables
+%\listoftables
 
 \pagenumbering{arabic}
 
+# This makefile requires GNU make.
+
+hg_id := $(shell hg id 2>/dev/null | sed -e 's/ tip\>//' -e 's/ /,/g' || echo external)
+
 sources := \
 	00book.tex \
 	99book.bib \
 
 pdf: pdf/hgbook.pdf
 
-pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
+define pdf
 	mkdir -p $(dir $@)
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
 	cp 99book.bib $(dir $@)
 	cd $(dir $@) && makeindex $(basename $(notdir $@))
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
 	pdflatex $(call latex-options,$@) $< || (rm -f $@; exit 1)
+endef
+
+pdf/hgbook.pdf: $(sources) $(image-sources:%.svg=%_pdf.png) examples
+	$(call pdf)
 
 html: html/onepage/hgbook.html html/split/hgbook.html
 
+# This is a horrible hack to work around the fact that the htlatex
+# command in tex4ht is itself a horrible hack.  I really don't want to
+# include verbatim the big wad of TeX that is repeated in that script,
+# so instead I mangle the script itself.
+
 define htlatex
 	mkdir -p $(dir $(1))
 	head -2 $(shell which htlatex) > $(dir $(1))/htlatex.book
 	$(call htlatex,$@,$<,2)
 	cp $(image-sources:%.svg=%.png) $(dir $@)
 
+beta: beta/pdf/hgbook.pdf beta/html/onepage/hgbook.html beta/html/split/hgbook.html
+
+beta/%.tex: %.tex
+	./fblinks $(hg_id) $(dir $@) $<
+
+beta/pdf/hgbook.pdf: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%_pdf.png) examples fblinks
+	$(call pdf)
+
+beta/html/onepage/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
+	$(call htlatex,$@,$<)
+	cp $(image-sources:%.svg=%.png) $(dir $@)
+
+beta/html/split/hgbook.html: $(sources:%.tex=beta/%.tex) $(image-sources:%.svg=%.png) examples
+	$(call htlatex,$@,$<,2)
+	cp $(image-sources:%.svg=%.png) $(dir $@)
+
+# Produce 90dpi PNGs for the web.
+
 %.png: %.svg
 	inkscape -D -e $@ $<
 
+# Produce 300dpi PNGs for PDF.
+
 %_pdf.png: %.svg
 	inkscape -D -d 300 -e $@ $<
 
-%.eps: %.svg
-	inkscape -E $@ $<
-
 examples: examples/.run
 
 examples/.run: $(example-sources)
 	cd examples && ./run-example
 
-build_id.tex:
-	echo 'in-place build' > $@
-
-build_id:
-	hg id | sed -e 's/ tip\>//' > build_id.tex
+build_id.tex: $(wildcard ../.hg/00changelog.[id])
+	echo $(hg_id) > build_id.tex
 
 clean:
-	rm -rf html pdf *.eps *.png *.aux *.dvi *.log *.out examples/*.out examples/.run buildrev.tex
+	rm -rf beta html pdf *.eps *.png *.aux *.dvi *.log *.out \
+		examples/*.out examples/.run build_id.tex
 
 Here's an example that illustrates how you can use this ability.
 Let's say you're developing a new feature as two patches.  The first
-is a change to the core of your software, and the second--layered on
-top of the first--changes the user interface to use the code you just
+is a change to the core of your software, and the second---layered on
+top of the first---changes the user interface to use the code you just
 added to the core.  If you notice a bug in the core while you're
 working on the UI patch, it's easy to fix the core.  Simply
 \hgcmd{qrefresh} the UI patch to save your in-progress changes, and
 \begin{itemize}
 \item The context in the middle of a hunk has changed.
 \item A hunk is missing some context at the beginning or end.
-\item A large hunk might apply better--either entirely or in part--if
-  it was broken up into smaller hunks.
+\item A large hunk might apply better---either entirely or in
+  part---if it was broken up into smaller hunks.
 \item A hunk removes lines with slightly different content than those
   currently present in the file.
 \end{itemize}
 
 The \command{diffstat} command~\cite{web:diffstat} generates a
 histogram of the modifications made to each file in a patch.  It
-provides a good way to ``get a sense of'' a patch--which files it
+provides a good way to ``get a sense of'' a patch---which files it
 affects, and how much change it introduces to each file and as a
 whole.  (I find that it's a good idea to use \command{diffstat}'s
 \texttt{-p} option as a matter of course, as otherwise it will try to
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.