e82c172140b278e238931a03b26715f819248c0f
[sbcl.git] / doc / manual / Makefile
1 SBCLTEXI:=sbcl.texinfo
2 ASDFTEXI:=asdf.texinfo
3 DOCFILES:=*.texinfo $(ASDFTEXI)
4 TMPTYPES:=aux cp cps fn fns ky log pg toc tp tps vr vrs
5 TMPFILES:=$(foreach target,asdf sbcl,$(foreach type,$(TMPTYPES),$(target).$(type)))
6 PSFILES=sbcl.ps asdf.ps
7 PDFFILES=sbcl.pdf asdf.pdf
8 INFOFILES=sbcl.info asdf.info
9 HTMLDIRS=$(basename $(SBCLTEXI)) $(basename $(ASDFTEXI))
10 HTMLFILES=sbcl.html asdf.html
11 # Place where generated documentation ends up. The value of
12 # DOCSTRINGDIR has to end with a slash or you lose (it's passed to
13 # Lisp's `pathname' function).
14 DOCSTRINGDIR="docstrings/"
15 CONTRIBDIR="../../contrib/"
16 I_FLAGS=-I $(DOCSTRINGDIR) -I $(CONTRIBDIR)
17 # List of contrib modules that docstring docs will be created for.
18 MODULES=':sb-md5 :sb-queue :sb-concurrency :sb-rotate-byte :sb-grovel \
19          :sb-sprof :sb-bsd-sockets :sb-cover :sb-posix'
20 # List of package names that docstring docs will be created for.
21 PACKAGES=":COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP \
22           :SB-PCL :SB-SYS :SB-SEQUENCE \
23           :SB-PROFILE :SB-THREAD :SB-MD5 :SB-QUEUE :SB-ROTATE-BYTE  \
24           :SB-SPROF :SB-BSD-SOCKETS :SB-COVER :SB-POSIX :SB-CONCURRENCY"
25
26 # SBCL_SYSTEM is an optional argument to this make program. If this
27 # variable is set, its contents are used as the command line for
28 # invoking SBCL.
29
30 # When passing a non-standard SBCL_SYSTEM, be sure to set the
31 # environment variable SBCL_HOME to a useful value, as well.
32
33 ifeq ($(MAKEINFO),)
34   MAKEINFO:=makeinfo
35 endif
36
37 ifeq ($(TEXI2PDF),)
38   TEXI2PDF:=texi2dvi -p
39 endif
40
41 ifeq ($(DVIPS),)
42   DVIPS:=dvips
43 endif
44
45 .PHONY: all
46 all: asdf.texinfo ps pdf info html
47
48 .PHONY: dist
49 dist: html pdf
50
51 asdf.texinfo:
52         rm -f asdf.texinfo
53         ln -s ../../contrib/asdf/asdf.texinfo
54
55 # html documentation; output in $(HTMLDIRS)
56 .PHONY: html
57 html: html-stamp
58
59 html-stamp: $(DOCFILES) docstrings
60         @rm -rf $(HTMLDIRS)
61         @rm -f $(HTMLFILES)
62 #       $(MAKEINFO) $(I_FLAGS) --html --css-include=style-multi.css $(SBCLTEXI)
63 #       $(MAKEINFO) --html --css-include=style-multi.css $(ASDFTEXI)
64         $(MAKEINFO) $(I_FLAGS) --html --no-split --css-include=style-single.css $(SBCLTEXI)
65         $(MAKEINFO) --html --no-split --css-include=style-single.css $(ASDFTEXI)
66         touch html-stamp
67
68 # Postscript documentation
69 .PHONY: ps
70 ps: $(PSFILES)
71
72 %.ps: %.dvi
73         dvips -o $@ $<
74
75 # DVI generation
76 %.dvi: %.texinfo $(DOCFILES) docstrings
77         texi2dvi $(I_FLAGS) $<
78
79 # PDF documentation
80 .PHONY: pdf
81 pdf: $(PDFFILES)
82
83 %.pdf: %.texinfo $(DOCFILES) docstrings
84         $(TEXI2PDF) $(I_FLAGS) $<
85
86 # info docfiles
87 .PHONY: info
88 info: $(INFOFILES)
89
90 %.info: %.texinfo $(DOCFILES) docstrings
91         $(MAKEINFO) $(I_FLAGS) $<
92
93 # Texinfo docstring snippets
94 # Note: assumes contrib module names are the same as the names of
95 # directories containing the modules, and that these directories
96 # are in $(CONTRIBDIR).
97 CONTRIB_FASLS=$(shell find $(shell echo $(MODULES) | sed "s|:|$(CONTRIBDIR)|g") -name '*.fasl')
98 docstrings: $(CONTRIB_FASLS) tempfiles-stamp
99         for module in $(shell echo $(MODULES)); do \
100                 test -f $(CONTRIBDIR)/`echo $$module | tr -d :`/test-passed \
101                 || { echo "The documented contrib $$module seems \
102                            to have failed its tests." && exit 1; } \
103         done
104         DOCSTRINGDIR=$(DOCSTRINGDIR) \
105         PACKAGES=$(PACKAGES) \
106         MODULES=$(MODULES) \
107         sh make-tempfiles.sh "$(SBCL_SYSTEM)" && touch $(DOCSTRINGDIR)
108
109 tempfiles-stamp:
110         touch tempfiles-stamp
111
112 .PHONY: clean
113 clean:
114         rm -f *~ *.bak *.orig \#*\# .\#* texput.log *.fasl
115         rm -rf $(HTMLDIRS) $(DOCSTRINGDIR)
116         rm -f  $(HTMLFILES)
117         rm -f contrib-docs.texi-temp
118         rm -f package-locks.texi-temp
119         rm -f variables.texinfo
120         rm -f $(PSFILES) $(PDFFILES) html-stamp tempfiles-stamp
121         rm -f $(TMPFILES) $(INDEXFILES)
122         rm -f sbcl.info sbcl.info-* asdf.info
123
124 .PHONY: distclean
125 distclean: clean