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