Make a ghc/ghci manpage
[ghc-hetmet.git] / docs / man / Makefile
1 TOP = ../..
2 include $(TOP)/mk/boilerplate.mk
3
4 GHC_COMMANDS=ghc ghci
5
6 UNCENSORED_MANPAGES=ghc.1
7
8 ifeq '$(GhcManpages)' 'YES'
9 MANPAGES=$(UNCENSORED_MANPAGES)
10 else
11 MANPAGES=
12 endif
13
14 boot:
15         @:
16
17 all: $(MANPAGES)
18         @:
19
20 install: $(addprefix install-,$(MANPAGES))
21         @:
22
23 clean:
24         rm -f flags.xml flags.xsl $(UNCENSORED_MANPAGES)
25
26 # The work for building
27
28 ghc.1: flags.xsl flags.xml
29         $(XSLTPROC) $(XSLTPROC_OPTS) flags.xsl flags.xml > $@
30
31 flags.xsl: gen_flags.xsl.pl
32         perl gen_flags.xsl.pl "$(GHC_COMMANDS)" "$(libdir)" > $@
33
34 flags.xml: ../users_guide/flags.xml
35         rm -f $@
36         head -1 $< >> $@
37         echo "<!DOCTYPE sect1 [<!ENTITY ndash  \"-\"> \
38                                <!ENTITY ldquo  \"\`\"> \
39                                <!ENTITY rdquo  \"'\">]>" >> $@
40         tail -n +2 $< >> $@
41
42 # The work for installing
43
44 .PHONY: install-%
45
46 install-mandir:
47         $(INSTALL_DIR) $(mandir)
48
49 install-%: install-mandir $*
50         $(INSTALL_MAN) $* $(mandir)
51