summaryrefslogtreecommitdiff
path: root/docs/man/Makefile
blob: ab20fde7b18ccb35ae575f5e290e58a23fc85ae6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
TOP = ../..
include $(TOP)/mk/boilerplate.mk

# The commands which should be mentioned in the man page
GHC_COMMANDS = ghc ghci

# The man page we are generating
MAN_PAGE = ghc

# The manual section
MAN_SECTION = 1

CLEAN_FILES += $(MAN_PAGE).$(MAN_SECTION) flags.xsl flags.xml

$(MAN_PAGE).$(MAN_SECTION): flags.xsl flags.xml
	$(XSLTPROC) $(XSLTPROC_OPTS) flags.xsl flags.xml > $@

# Insert the commands and the library directory into the man page
flags.xsl: gen_flags.xsl.pl
	perl gen_flags.xsl.pl "$(GHC_COMMANDS)" "$(libdir)" > $@

# Re-use the flags documentation from the user's guide by injecting some
# entities after the XML declaration to make it a stand-alone document.
flags.xml: ../users_guide/flags.xml
	$(RM) $@
	head -n 1 $< >> $@
	echo "<!DOCTYPE sect1 [<!ENTITY ndash  \"-\"> \
	                       <!ENTITY ldquo  \"\`\"> \
	                       <!ENTITY rdquo  \"'\">]>" >> $@
	tail -n +2 $< >> $@

install-docs:: $(MAN_PAGE).$(MAN_SECTION)
	$(INSTALL_DIR) $(DESTDIR)$(mandir)
	$(INSTALL_DIR) $(DESTDIR)$(mandir)/man$(MAN_SECTION)
	$(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PAGE).$(MAN_SECTION) $(DESTDIR)$(mandir)/man$(MAN_SECTION)

include $(TOP)/mk/target.mk