Files
xen/docs/Makefile
T
iap10@labyrinth.cl.cam.ac.uk d2f5d53621 bitkeeper revision 1.1159.223.26 (41f2cdb6LNpheOtPoAKEUn-czlZFig)
Description: use DESTDIR correctly
Standard makefiles always attempt to install to the root(/).  Setting
DESTDIR is the normal way to install to an alternative location.
Setting prefix has the possibility of breaking programs, as the prefix
may have been embedded inside a compiled binary.

From: Adam Heath <doogie@brainfood.com>
Signed-off-by: ian.pratt@cl.cam.ac.uk
2005-01-22 22:03:34 +00:00

72 lines
1.6 KiB
Makefile

#!/usr/bin/make -f
INSTALL = install
INSTALL_DIR = $(INSTALL) -d -m0755
PS2PDF := ps2pdf
DVIPS := dvips
LATEX := latex
FIG2DEV := fig2dev
TGIF := tgif
LATEX2HTML := latex2html
package = xen
prefix = /usr
docdir = $(prefix)/share/doc
pkgdocdir = $(docdir)/$(package)
DOC_TEX := $(wildcard src/*.tex)
DOC_PS := $(patsubst src/%.tex,ps/%.ps,$(DOC_TEX))
DOC_PDF := $(patsubst src/%.tex,pdf/%.pdf,$(DOC_TEX))
DOC_HTML := $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX))
GFX = $(patsubst %.obj, %.eps, $(wildcard figs/*.obj))
GFX += $(patsubst %.fig, %.eps, $(wildcard figs/*.fig))
all: ps pdf html
rm -f *.aux *.dvi *.bbl *.blg *.glo *.idx *.ilg *.log *.ind *.toc
ps: $(DOC_PS)
pdf: $(DOC_PDF)
html: $(DOC_HTML)
clean:
rm -rf .word_count *.aux *.dvi *.bbl *.blg *.glo *.idx *~
rm -rf *.ilg *.log *.ind *.toc *.bak core
rm -rf $(GFX) ps pdf html
install: all
rm -rf $(DESTDIR)$(pkgdocdir)
$(INSTALL_DIR) $(DESTDIR)$(pkgdocdir)
cp -dR ps $(DESTDIR)$(pkgdocdir)
cp -dR pdf $(DESTDIR)$(pkgdocdir)
cp -dR html $(DESTDIR)$(pkgdocdir)
pdf/%.pdf: ps/%.ps
$(INSTALL_DIR) $(@D)
$(PS2PDF) $< $@.new
mv $@.new $@
ps/%.ps: %.dvi
$(INSTALL_DIR) $(@D)
$(DVIPS) -Ppdf -G0 -o $@.new $<
mv $@.new $@
%.dvi: src/%.tex $(GFX)
$(LATEX) $< >/dev/null
if [ -e $*.toc ] ; then $(LATEX) $< >/dev/null ; fi
%.eps: %.fig
$(FIG2DEV) -L eps $< $@
%.eps: %.obj
$(TGIF) -print -color -eps $<
html/%/index.html: src/%.tex
$(INSTALL_DIR) $(@D)
$(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \
-numbered_footnotes -local_icons -noinfo -math -dir $(@D) \
$< 1>/dev/null 2>/dev/null