05c197623faba5f44434d16e5aa4615062bac18a
[fw/sdcc] / doc / Makefile
1 include ../Makefile.common
2
3 ifdef $(LYX_SYSDIR)
4   LYXFLAGS += -sysdir $(LYX_SYSDIR)
5 endif
6
7 MANUAL = sdccman
8 TSS = test_suite_spec
9 CDB = cdbfileformat
10
11 SOURCES = $(MANUAL).lyx $(TSS).lyx $(CDB).lyx
12
13 TXT  = $(SOURCES:.lyx=.txt)
14 PDF  = $(SOURCES:.lyx=.pdf)
15 TEX  = $(SOURCES:.lyx=.tex)
16 HTML_DIR   = $(SOURCES:.lyx=.html)
17 HTML_INDEX = $(SOURCES:.lyx=.html/index.html)
18
19 all: $(TXT) $(PDF) $(HTML_INDEX)
20
21 install:
22         $(INSTALL) -d $(DESTDIR)$(docdir)
23         cp -rf *.txt z80 avr $(DESTDIR)$(docdir)
24         if [ -f $(MANUAL).html/index.html ]; then cp -rf $(MANUAL).html $(DESTDIR)$(docdir); fi
25         if [ -f $(TSS).html/index.html    ]; then cp -rf $(TSS).html    $(DESTDIR)$(docdir); fi
26         if [ -f $(CDB).html/index.html    ]; then cp -rf $(CDB).html    $(DESTDIR)$(docdir); fi
27         if [ -f $(MANUAL).pdf             ]; then cp -rf $(MANUAL).pdf  $(DESTDIR)$(docdir); fi
28         if [ -f $(TSS).pdf                ]; then cp -rf $(TSS).pdf     $(DESTDIR)$(docdir); fi
29         if [ -f $(CDB).pdf                ]; then cp -rf $(CDB).pdf     $(DESTDIR)$(docdir); fi
30         rm -rf `find $(DESTDIR)$(docdir) -name .svn -type d`
31         rm -f $(DESTDIR)$(docdir)/*/WARNINGS $(DESTDIR)$(docdir)/*/*.pl $(DESTDIR)$(docdir)/*/images.*
32
33 uninstall:
34         rm -rf $(DESTDIR)$(docdir)
35
36 $(MANUAL).html/index.html: $(MANUAL).tex $(MANUAL).ind
37         rm -rf $(MANUAL).html 
38         mkdir -p `dirname $@`
39         # fixes latex2html problems with two consecutive dashes for long-options: --stack-auto
40         # fixes latex2html problems with \tabularnewline
41         mv $< `basename $< .tex`.orig.tex
42         sed 's,-\\/-,-\\/-\\/-,g' < `basename $< .tex`.orig.tex | \
43         sed 's,\\tabularnewline$$,\\\\,g' > $<
44         -latex2html -show_section_numbers -split 5 -local_icons -dir $(MANUAL).html `basename $<`
45         mv `basename $< .tex`.orig.tex $<
46         rm -f $(MANUAL).html/WARNINGS $(MANUAL).html/labels.pl
47
48 $(TSS).html/index.html: $(TSS).tex
49         rm -rf `dirname $@`
50         mkdir -p `dirname $@`
51         # fixes latex2html problems with two consecutive dashes for long-options: --stack-auto
52         # fixes latex2html problems with \tabularnewline
53         mv $< `basename $< .tex`.orig.tex
54         sed 's,-\\/-,-\\/-\\/-,g' < `basename $< .tex`.orig.tex | \
55         sed 's,\\tabularnewline$$,\\\\,g' > $<
56         -latex2html -split 0 -local_icons -dir $(TSS).html `basename $<`
57         mv `basename $< .tex`.orig.tex $<
58         rm -f $(TSS).html/WARNINGS $(TSS).html/labels.pl
59
60 $(CDB).html/index.html: $(CDB).tex
61         rm -rf `dirname $@`
62         mkdir -p `dirname $@`
63         # fixes latex2html problems with two consecutive dashes for long-options: --stack-auto
64         # fixes latex2html problems with \tabularnewline
65         mv $< `basename $< .tex`.orig.tex
66         sed 's,-\\/-,-\\/-\\/-,g' < `basename $< .tex`.orig.tex | \
67         sed 's,\\tabularnewline$$,\\\\,g' > $<
68         -latex2html -show_section_numbers -split 0 -local_icons -dir $(CDB).html `basename $<`
69         mv `basename $< .tex`.orig.tex $<
70         rm -f $(CDB).html/WARNINGS $(CDB).html/labels.pl
71
72 %.txt: %.lyx
73         lyx -e text $(LYXFLAGS) $<
74
75 %.pdf: %.tex
76         @echo "### Create pdf from tex: $< -> $@"
77         pdflatex $*
78         -makeindex $*
79         pdflatex $*
80         pdflatex $*
81         pdfopt $*.pdf tmp.pdf
82         rm $*.pdf
83         mv tmp.pdf $*.pdf
84
85 #%.ps:  %.pdf
86 #       dvips $*
87
88 %.dvi: %.tex
89         latex $<
90
91 %.tex: %.lyx
92         lyx -e latex $< $(LYXFLAGS)
93
94 #%.ind: %.dvi
95 #       latex $*
96 #       -makeindex $*
97 ##      -makeindex -s l2hidx.ist $*
98         #latex $*
99 #       latex $*
100
101 #%.glo: %.dvi
102 #       # the glossary, not implemented yet
103 #       # makeindex -s l2hglo.ist -o $@ $<
104
105 archive: all
106         rm -rf sdcc-doc sdcc-doc.tar.bz2
107         mkdir sdcc-doc
108         rsync -rCt avr z80 *.pdf *.txt sdcc-doc
109
110         for doc in $(MANUAL) $(TSS) $(CDB); do \
111           rsync -Rt $$doc.html/*.html $$doc.html/*.png $$doc.html/*.css sdcc-doc/; \
112         done
113
114         mkdir sdcc-doc/as
115         rsync -rCt ../as/doc/* sdcc-doc/as/
116
117         mkdir sdcc-doc/ucsim
118         cd ../sim/ucsim/doc; rsync *.html *.jpg *.gif *.fig ../../../doc/sdcc-doc/ucsim/
119
120         tar -c sdcc-doc | bzip2 -9 > sdcc-doc.tar.bz2
121
122 include clean.mk