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