1# Copyright (C) 2011 Richard Levitte <richard@levitte.org> 2# 3# This program is made available under the GNU GPL version 2.0 or 4# greater. See the accompanying file COPYING for details. 5# 6# This program is distributed WITHOUT ANY WARRANTY; without even the 7# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 8# PURPOSE. 9 10# Makefile for monotone 11 12AUTOMAKE_OPTIONS = subdir-objects -Wno-portability 13ACLOCAL_AMFLAGS = -I m4 14 15CHECK_SRCDIR_EQ_BUILDDIR=[ "`cd \"$(srcdir)\"; pwd`" = "`pwd`" ] 16 17PDF_FIGURES= figures/branch-heads.pdf figures/cert.pdf \ 18 figures/difference-between-versions.pdf \ 19 figures/file-id-manifest-id.pdf figures/fork.pdf \ 20 figures/general-workflow.pdf figures/linear-history.pdf \ 21 figures/local-workflow.pdf figures/manifest.pdf \ 22 figures/merge.pdf figures/network-workflow.pdf \ 23 figures/parent-child-hashes.pdf \ 24 figures/parent-child-names-hashes.pdf figures/parent-child.pdf \ 25 figures/revision-chaining.pdf figures/revision.pdf \ 26 figures/statement.pdf figures/three-versions.pdf \ 27 figures/two-branches.pdf 28 29PNG_IMAGES= images/bg.png images/go-next.png \ 30 images/go-previous.png images/go-up.png \ 31 images/toc.png 32 33HTML_EXTRA = texinfo.css 34 35PNG_FIGURES=$(PDF_FIGURES:.pdf=.png) 36EPS_FIGURES=$(PDF_FIGURES:.pdf=.eps) 37 38# See the rules further down that does the work. 39PDF_FIGURES_copied = $(addprefix $(abs_builddir)/,$(PDF_FIGURES)) 40PNG_FIGURES_copied = $(addprefix $(abs_builddir)/,$(PNG_FIGURES)) 41PNG_IMAGES_copied = $(addprefix $(abs_builddir)/,$(PNG_IMAGES)) 42HTML_EXTRA_copied = $(addprefix $(abs_builddir)/,$(HTML_EXTRA)) 43 44TEXI_FRAGMENTS = pcrepattern.texi pcresyntax.texi 45 46info_TEXINFOS = monotone.texi 47 48monotone_TEXINFOS = $(top_srcdir)/src/std_hooks.lua $(TEXI_FRAGMENTS) 49 50EXTRA_DIST = \ 51 $(PDF_FIGURES) $(PNG_FIGURES) $(PNG_IMAGES) $(TEXI_FRAGMENTS) \ 52 figures/monotone-logo.svg figures/oo-figures.sxd \ 53 figures/pdfcrop.pl figures/README $(HTML_EXTRA) 54 55AM_MAKEINFOFLAGS= -I $(top_srcdir)/src -I $(srcdir) 56 57AM_MAKEINFOHTMLFLAGS= -I $(top_srcdir)/src -I $(srcdir) \ 58 --number-sections --no-split --no-headers --css-ref=texinfo.css 59 60figures/%.eps: figures/%.ps 61 $(MKDIR_P) figures 62 ps2eps <$< >$@ 63 64figures/%.ps: figures/%.pdf 65# acroread -toPostScript -pairs $< $@ 66 $(MKDIR_P) figures 67 pdftops $< $@ 68 69$(abs_builddir)/figures/%.pdf: figures/%.pdf 70 $(MKDIR_P) figures 71 cmp -s $< $@ || cp $< $@ 72 73$(abs_builddir)/figures/%.png: figures/%.png 74 $(MKDIR_P) figures 75 cmp -s $< $@ || cp $< $@ 76 77$(abs_builddir)/images/%.png: images/%.png 78 $(MKDIR_P) images 79 cmp -s $< $@ || cp $< $@ 80 81$(abs_builddir)/texinfo.css: texinfo.css 82 cmp -s $< $@ || cp $< $@ 83 84# Stealing code from automake and adapting, we want a HTML file tree as well 85AM_MAKEINFODOCHTMLFLAGS= -I $(top_srcdir)/src -I $(srcdir) \ 86 --number-sections --css-ref=texinfo.css 87 88# Because automake already generates a html target that produces a single file 89# HTML, we have to use a different target to make a multifile HTML. 90html-multifile: monotone.texi $(srcdir)/version.texi $(monotone_TEXINFOS) $(PNG_FIGURES) $(PNG_IMAGES) $(HTML_EXTRA) 91 $(MKDIR_P) html.htp && \ 92 cp $(addprefix $(srcdir)/,$(HTML_EXTRA)) html.htp 93 $(MKDIR_P) html.htp/figures && \ 94 cp $(addprefix $(srcdir)/,$(PNG_FIGURES)) html.htp/figures 95 $(MKDIR_P) html.htp/images && \ 96 cp $(addprefix $(srcdir)/,$(PNG_IMAGES)) html.htp/images 97 if $(MAKEINFOHTML) $(AM_MAKEINFODOCHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc -o html.htp `test -f 'monotone.texi' || echo '$(srcdir)/'`monotone.texi; \ 98 then \ 99 rm -rf html; \ 100 mv html.htp html; \ 101 else \ 102 rm -Rf html.htp; \ 103 exit 1; \ 104 fi 105html/$(am__dirstamp): 106 @$(MKDIR_P) html 107 @touch $@ 108# Then let's have the html target produce the multifile HTML as well. 109html-local: html-multifile 110 111htmldir = $(docdir)/html 112 113install-html-local: install-html-support install-html-multifile 114install-html-support: $(PNG_FIGURES) $(PNG_IMAGES) $(HTML_EXTRA) 115 test -n "$(htmldir)" 116 $(MKDIR_P) "$(DESTDIR)$(htmldir)" 117 $(INSTALL_DATA) $(HTML_EXTRA) $(DESTDIR)$(htmldir) 118 $(MKDIR_P) "$(DESTDIR)$(htmldir)/figures" 119 $(INSTALL_DATA) $(PNG_FIGURES) $(DESTDIR)$(htmldir)/figures 120 $(MKDIR_P) "$(DESTDIR)$(htmldir)/images" 121 $(INSTALL_DATA) $(PNG_IMAGES) $(DESTDIR)$(htmldir)/images 122install-html-multifile: html-multifile 123 test -n "$(htmldir)" 124 $(INSTALL_DATA) html/*.html $(DESTDIR)$(htmldir) 125 126# Because we don't want to have the different document targets depend on 127# irrelevant files, we have these dependencies lists. 128# NOTE: This wouldn't work if this Makefile had been part of the top Makefile, 129# because automake produces very different results when the main .texi is in 130# a subdirectory. 131# Also note that we need to specify everything that automake would specify, 132# since what we write overrides what automake would otherwise produce. 133# 134# For the info and html targets, '@verbatiminclude std_hooks.lua' 135# works with -I $(top_srcdir)/src. However the dvi target requires 136# '$(top_srcdir)/src' in TEXINPUTS. We can't specify a per-target 137# variable for 'dvi', because that would override the automake 138# definition. So we just set TEXINPUTS globally. 139export TEXINPUTS := $(top_srcdir)/src:$(TEXINPUTS) 140monotone.dvi: monotone.texi $(srcdir)/version.texi $(monotone_TEXINFOS) \ 141 $(EPS_FIGURES) 142monotone.pdf: monotone.texi $(srcdir)/version.texi $(monotone_TEXINFOS) \ 143 $(PDF_FIGURES_copied) 144monotone.html: monotone.texi $(srcdir)/version.texi $(monotone_TEXINFOS) \ 145 $(PNG_FIGURES_copied) $(PNG_IMAGES_copied) $(HTML_EXTRA_copied) 146# Note that we don't need anything for monotone.ps, as it's produced using 147# the generic rule .dvi.ps, and the monotone.dvi already has all the 148# dependencies. 149# Also, we don't need anything extra for htmldir, as it does things a bit 150# differently. 151 152 153# Things that should only be removed when the build dir is different from 154# the source dir are handled by the clean-local target below. 155CLEANFILES = $(EPS_FIGURES) 156 157# We have to be careful only to remove figures and images when they aren't 158# in the source directory. 159clean-local: 160 if $(CHECK_SRCDIR_EQ_BUILDDIR); then :; else \ 161 rm -f $(PDF_FIGURES_copied) $(PNG_FIGURES_copied) \ 162 $(PNG_IMAGES_copied) $(HTML_EXTRA_copied); \ 163 fi 164 rm -rf html 165