21881753b5553e4e672a06e595b27e659ab0059f
[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-rotate-byte :sb-grovel :sb-sprof :sb-bsd-sockets :sb-cover :sb-posix'
19 # List of package names that docstring docs will be created for.
20 PACKAGES=":COMMON-LISP :SB-ALIEN :SB-DEBUG :SB-EXT :SB-GRAY :SB-MOP :SB-PROFILE :SB-THREAD :SB-MD5 :SB-QUEUE :SB-ROTATE-BYTE :SB-SPROF :SB-BSD-SOCKETS :SB-COVER :SB-POSIX"
21
22 # SBCL_SYSTEM is an optional argument to this make program. If this
23 # variable is set, its contents are used as the command line for
24 # invoking SBCL.
25
26 # When passing a non-standard SBCL_SYSTEM, be sure to set the
27 # environment variable SBCL_HOME to a useful value, as well.
28
29 ifeq ($(MAKEINFO),)
30   MAKEINFO:=makeinfo
31 endif
32
33 ifeq ($(TEXI2PDF),)
34   TEXI2PDF:=texi2dvi -p
35 endif
36
37 ifeq ($(DVIPS),)
38   DVIPS:=dvips
39 endif
40
41 .PHONY: all
42 all: asdf.texinfo ps pdf info html
43
44 .PHONY: dist
45 dist: html pdf
46
47 asdf.texinfo:
48         rm -f asdf.texinfo
49         ln -s ../../contrib/asdf/asdf.texinfo
50
51 # html documentation; output in $(HTMLDIRS)
52 .PHONY: html
53 html: html-stamp
54
55 html-stamp: $(DOCFILES) docstrings
56         @rm -rf $(HTMLDIRS)
57         @rm -f $(HTMLFILES)
58         $(MAKEINFO) $(I_FLAGS) --html --css-include=style-multi.css $(SBCLTEXI)
59         $(MAKEINFO) --html --css-include=style-multi.css $(ASDFTEXI)
60         $(MAKEINFO) $(I_FLAGS) --html --no-split --css-include=style-single.css $(SBCLTEXI)
61         $(MAKEINFO) --html --no-split --css-include=style-single.css $(ASDFTEXI)
62         touch html-stamp
63
64 # Postscript documentation
65 .PHONY: ps
66 ps: $(PSFILES)
67
68 %.ps: %.dvi
69         dvips -o $@ $<
70
71 # DVI generation
72 %.dvi: %.texinfo $(DOCFILES) docstrings
73         texi2dvi $(I_FLAGS) $<
74
75 # PDF documentation
76 .PHONY: pdf
77 pdf: $(PDFFILES)
78
79 %.pdf: %.texinfo $(DOCFILES) docstrings
80         $(TEXI2PDF) $(I_FLAGS) $<
81
82 # info docfiles
83 .PHONY: info
84 info: $(INFOFILES)
85
86 %.info: %.texinfo $(DOCFILES) docstrings
87         $(MAKEINFO) $(I_FLAGS) $<
88
89 # Texinfo docstring snippets
90 # Note: assumes contrib module names are the same as the names of
91 # directories containing the modules, and that these directories
92 # are in $(CONTRIBDIR).
93 CONTRIB_FASLS=$(shell find $(shell echo $(MODULES) | sed "s|:|$(CONTRIBDIR)|g") -name '*.fasl')
94 docstrings: $(CONTRIB_FASLS) tempfiles-stamp
95         for module in $(shell echo $(MODULES)); do test -e $(CONTRIBDIR)/$${module#:}/test-passed || { echo "The documented contrib $$module seems to have failed its tests." && exit 1; }; done
96         DOCSTRINGDIR=$(DOCSTRINGDIR) PACKAGES=$(PACKAGES) MODULES=$(MODULES) sh make-tempfiles.sh "$(SBCL_SYSTEM)" && touch $(DOCSTRINGDIR)
97
98 tempfiles-stamp:
99         touch tempfiles-stamp
100
101 .PHONY: clean
102 clean: 
103         rm -f *~ *.bak *.orig \#*\# .\#* texput.log *.fasl
104         rm -rf $(HTMLDIRS) $(DOCSTRINGDIR)
105         rm -f  $(HTMLFILES)
106         rm -f contrib-docs.texi-temp
107         rm -f package-locks.texi-temp
108         rm -f variables.texinfo
109         rm -f $(PSFILES) $(PDFFILES) html-stamp tempfiles-stamp
110         rm -f $(TMPFILES) $(INDEXFILES)
111         rm -f sbcl.info sbcl.info-* asdf.info
112
113 .PHONY: distclean
114 distclean: clean