Makefile (3196B)
1 # Manual 2 3 # IMPORTANT! 4 # 5 # This file is portable and compatible with GNU Make, BSD make and 6 # Solaris (d)make. Do not make any changes in this file unless you 7 # are certain that the changes do not break this portability. 8 9 10 # a shorthand just for brevity 11 m = unison-manual 12 13 .PHONY: all 14 all: $(m).pdf $(m).html $(m).txt ../src/strings.ml 15 16 DRAFT = false 17 18 include ../src/Makefile.ProjectInfo 19 20 SOURCES = unison-manual.tex \ 21 local.tex short.tex \ 22 unisonversion.tex prefs.tmp prefsdocs.tmp 23 24 $(m).pdf $(m).html $(m).txt $(m).ps: $(SOURCES) 25 $(m).dtxt $(m).aux $(m).htoc $(m).toc: $(SOURCES) 26 27 HEVEA_FOUND = test -n "$$(command -v hevea > /dev/null 2>&1 && echo true)" 28 29 unisonversion.tex: ../src/Makefile.ProjectInfo 30 echo '\def\unisonversion{$(VERSION)}' > $@ 31 32 # Text versions: when using different directives then _must_ use different 33 # jobname (or, output name for hevea) so that files for non-text versions are 34 # not overwritten. Here, suffix -text is used. 35 36 $(m)-text-directives.tex: 37 printf '$(TEXDIRECTIVES)\\textversiontrue\\draft$(DRAFT)' > $@ 38 39 .SUFFIXES: 40 .SUFFIXES: .tex .pdf .ps .html .dtxt .txt 41 42 $(m).dtxt: $(m)-text-directives.tex 43 44 .tex.dtxt: 45 if $(HEVEA_FOUND) ; then \ 46 hevea -o $*-text.html $< ; \ 47 (TERM=vt100; export TERM; lynx -display_charset=utf8 -dump $*-text.html > $@) \ 48 ; fi 49 50 .dtxt.txt: 51 if $(HEVEA_FOUND) ; then \ 52 sed -e "/^----SNIP----/,+2 d" -e "/^Junk/,$$ d" $< > $@ \ 53 ; fi 54 55 ../src/strings.ml: $(m).dtxt docs.ml 56 if $(HEVEA_FOUND) ; then \ 57 ocaml docs.ml < $(m).dtxt > $@ \ 58 ; fi 59 60 $(m)-directives.tex: 61 printf '$(TEXDIRECTIVES)\\textversionfalse\\draft$(DRAFT)' > $@ 62 63 # (pdf)latex must be run multiple times to generate toc and correct references 64 65 $(m).aux $(m).htoc &: $(m).tex $(m)-directives.tex 66 pdflatex -draftmode $(m).tex && \ 67 pdflatex -draftmode $(m).tex 68 # &: is the GNU Make group target separator. Other make implementations do not 69 # support it but accept it nevertheless because it's treated as a target named & 70 # Without group targets, the same outcome is achieved by the following: 71 .ORDER: $(m).aux $(m).htoc # BSD make 72 .NO_PARALLEL$(.MAKE.PID): $(m).aux $(m).htoc # Solaris make 73 # BSD make interprets .NO_PARALLEL as the entire makefile not parallel. 74 # .MAKE.PID (which is only defined by BSD make) is in there just to prevent 75 # BSD make from interpreting this rule 76 77 $(m).pdf: $(m).tex $(m)-directives.tex $(m).aux 78 79 .tex.pdf: 80 pdflatex $< 81 82 .pdf.ps: 83 pdf2ps $< 84 85 $(m).html: $(m).tex $(m)-directives.tex $(m).htoc 86 87 .tex.html: 88 if $(HEVEA_FOUND) ; then \ 89 hevea $< \ 90 ; fi 91 92 # Listing of preferences 93 prefs.tmp: ../src/$(NAME) 94 -../src/$(NAME) -help > prefs.tmp 95 prefsdocs.tmp: ../src/$(NAME) 96 ../src/$(NAME) -prefsdocs 2> prefsdocs.tmp 97 98 ../src/$(NAME): 99 $(MAKE) -C ../src tui 100 101 RM = rm -f 102 103 .PHONY: clean 104 clean: 105 $(RM) -r \ 106 *.dtxt *.aux *.haux *.log *.out \ 107 *-directives.tex \ 108 junk.* *.htoc *.toc *.bak \ 109 prefs.tmp prefsdocs.tmp \ 110 docs docs.exe temp.dvi temp.html unison-manual.html \ 111 unison-manual.dvi unison-manual.ps unison-manual.pdf \ 112 unison-manual.txt unison-manual.info* unisonversion.tex \ 113 unison-manual-text.html \ 114 contact.html faq.html faq.haux index.html 115