Makefile 1.99 KB
Newer Older
1 2 3
# Makefile for the HOWTO directory
# LaTeX HOWTOs can be turned into HTML, PDF, PS, DVI or plain text output.
# reST HOWTOs can only be turned into HTML.
4

5 6 7 8 9 10
# Variables to change

# Paper size for non-HTML formats (letter or a4)
PAPER=letter

# Arguments to rst2html.py, and location of the script
11
RSTARGS = --input-encoding=utf-8
12
RST2HTML = rst2html.py
13

14 15 16 17
# List of HOWTOs that aren't to be processed.  This should contain the
# base name of the HOWTO without any extension (e.g. 'advocacy',
# 'unicode').
REMOVE_HOWTOS =
18

19 20 21 22
MKHOWTO=../tools/mkhowto
WEBDIR=.
PAPERDIR=../paper-$(PAPER)
HTMLDIR=../html
23 24

# Determine list of files to be built
25 26 27 28 29 30 31 32
TEX_SOURCES = $(wildcard *.tex)
RST_SOURCES = $(wildcard *.rst)
TEX_NAMES = $(filter-out $(REMOVE_HOWTOS),$(patsubst %.tex,%,$(TEX_SOURCES)))

PAPER_PATHS=$(addprefix $(PAPERDIR)/,$(TEX_NAMES))
DVI  =$(addsuffix .dvi,$(PAPER_PATHS))
PDF  =$(addsuffix .pdf,$(PAPER_PATHS))
PS   =$(addsuffix .ps,$(PAPER_PATHS))
33

34 35 36
ALL_HOWTO_NAMES = $(TEX_NAMES) $(patsubst %.rst,%,$(RST_SOURCES))
HOWTO_NAMES = $(filter-out $(REMOVE_HOWTOS),$(ALL_HOWTO_NAMES))
HTML = $(addprefix $(HTMLDIR)/,$(HOWTO_NAMES))
37 38

# Rules for building various formats
39 40 41 42 43 44 45 46

# reST to HTML
$(HTMLDIR)/%: %.rst
	if [ ! -d $@ ] ; then mkdir $@ ; fi
	$(RST2HTML) $(RSTARGS) $< >$@/index.html

# LaTeX to various output formats
$(PAPERDIR)/%.dvi : %.tex
47
	$(MKHOWTO) --dvi $<
48
	mv $*.dvi $@
49

50
$(PAPERDIR)/%.pdf : %.tex
51
	$(MKHOWTO) --pdf $<
52
	mv $*.pdf $@
53

54
$(PAPERDIR)/%.ps : %.tex
55
	$(MKHOWTO) --ps $<
56 57 58 59
	mv $*.ps $@

$(HTMLDIR)/% : %.tex
	$(MKHOWTO) --html --iconserver="." --dir $@ $<
60

61 62
# Rule that isn't actually used -- we no longer support the 'txt' target.
$(PAPERDIR)/%.txt : %.tex
63 64 65 66 67
	$(MKHOWTO) --text $<
	mv $@ txt

default:
	@echo "'all'    -- build all files"
68
	@echo "'dvi', 'pdf', 'ps', 'html' -- build one format"
69

70
all: dvi pdf ps html
71

72 73 74 75 76
.PHONY : dvi pdf ps html
dvi:  $(DVI)
pdf:  $(PDF)
ps:   $(PS)
html: $(HTML)
77 78

clean:
79 80
	rm -f *~ *.log *.ind *.l2h *.aux *.toc *.how *.bkm
	rm -f *.dvi *.pdf *.ps
81 82

clobber:
83 84
	rm -rf $(HTML)
	rm -rf $(DVI) $(PDF) $(PS)