047a348d20739bce94bed6dd36d40db03b68123c
[ghc-hetmet.git] / docs / man / Makefile
1 TOP = ../..
2 include $(TOP)/mk/boilerplate.mk
3
4 # The commands which should be mentioned in the man page
5 GHC_COMMANDS = ghc ghci
6
7 # The man page we are generating
8 MAN_PAGE = ghc
9
10 # The manual section
11 MAN_SECTION = 1
12
13 CLEAN_FILES += $(MAN_PAGE).$(MAN_SECTION) flags.xsl flags.xml
14
15 ifneq "$(DOING_BIN_DIST)" "YES"
16
17 $(MAN_PAGE).$(MAN_SECTION): flags.xsl flags.xml
18         $(XSLTPROC) $(XSLTPROC_OPTS) flags.xsl flags.xml > $@
19
20 # Insert the commands and the library directory into the man page
21 flags.xsl: gen_flags.xsl.pl
22         perl gen_flags.xsl.pl "$(GHC_COMMANDS)" "$(libdir)" > $@
23
24 # Re-use the flags documentation from the user's guide by injecting some
25 # entities after the XML declaration to make it a stand-alone document.
26 flags.xml: ../users_guide/flags.xml
27         $(RM) $@
28         head -n 1 $< >> $@
29         echo "<!DOCTYPE sect1 [<!ENTITY ndash  \"-\"> \
30                                <!ENTITY ldquo  \"\`\"> \
31                                <!ENTITY rdquo  \"'\">]>" >> $@
32         tail -n +2 $< >> $@
33
34 endif
35
36 install-docs:: $(MAN_PAGE).$(MAN_SECTION)
37         $(INSTALL_DIR) $(DESTDIR)$(mandir)
38         $(INSTALL_DIR) $(DESTDIR)$(mandir)/man$(MAN_SECTION)
39         $(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PAGE).$(MAN_SECTION) $(DESTDIR)$(mandir)/man$(MAN_SECTION)
40
41 binary-dist:: $(MAN_PAGE).$(MAN_SECTION)
42         $(MKDIRHIER) $(BIN_DIST_DIR)/docs/man
43         cp Makefile                   $(BIN_DIST_DIR)/docs/man/
44         cp $(MAN_PAGE).$(MAN_SECTION) $(BIN_DIST_DIR)/docs/man/
45
46 include $(TOP)/mk/target.mk