From 852373b7f38344322964130295a73ed5ee8591e1 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Thu, 19 Nov 2009 14:08:11 +0000 Subject: [PATCH] Add support for the man page to the new build system --- docs/man/Makefile | 50 ----------------------------------------------- docs/man/ghc.mk | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ ghc.mk | 3 +++ 3 files changed, 59 insertions(+), 50 deletions(-) delete mode 100644 docs/man/Makefile create mode 100644 docs/man/ghc.mk diff --git a/docs/man/Makefile b/docs/man/Makefile deleted file mode 100644 index 21e60e2..0000000 --- a/docs/man/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -TOP = ../.. -include $(TOP)/mk/boilerplate.mk - -ifneq "$(strip $(XSLTPROC))" "" - -# 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 - -ifneq "$(DOING_BIN_DIST)" "YES" - -all:: $(MAN_PAGE).$(MAN_SECTION) - -$(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 " \ - \ - ]>" >> $@ - # "sed 1d" == "tail -n +2", but Solaris apparently rejects the latter - sed 1d $< >> $@ - -endif - -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) - -endif - -include $(TOP)/mk/bindist.mk - -include $(TOP)/mk/target.mk diff --git a/docs/man/ghc.mk b/docs/man/ghc.mk new file mode 100644 index 0000000..65ec327 --- /dev/null +++ b/docs/man/ghc.mk @@ -0,0 +1,56 @@ + +ifeq "$(BUILD_MAN)" "" +ifeq "$(strip $(XSLTPROC))" "" +BUILD_MAN = NO +else +BUILD_MAN = YES +endif +endif + +# The commands which should be mentioned in the man page +MAN_GHC_COMMANDS = ghc ghci + +# The man page we are generating +MAN_PAGE = ghc + +# The manual section +MAN_SECTION = 1 + +MAN_PATH = docs/man/$(MAN_PAGE).$(MAN_SECTION) + +ifneq "$(BINDIST)" "YES" +$(MAN_PATH): docs/man/flags.xsl docs/man/flags.xml + $(XSLTPROC) $(XSLTPROC_OPTS) $^ > $@ +endif + +# Insert the commands and the library directory into the man page +docs/man/flags.xsl: docs/man/gen_flags.xsl.pl + $(PERL) $< "$(MAN_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. +docs/man/flags.xml: docs/users_guide/flags.xml + "$(RM)" $(RM_OPTS) $@ + head -n 1 $< >> $@ + echo " \ + \ + ]>" >> $@ +# "sed 1d" == "tail -n +2", but Solaris apparently rejects the latter + sed 1d $< >> $@ + +ifeq "$(BUILD_MAN)" "YES" +$(eval $(call all-target,docs/man,$(MAN_PATH))) + +INSTALL_MANPAGES += $(MAN_PATH) + +install: install_man + +.PHONY: install_man +install_man: $(MAN_PATH) + $(INSTALL_DIR) "$(DESTDIR)$(mandir)" + $(INSTALL_DIR) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)" + $(INSTALL_MAN) $(INSTALL_OPTS) $(MAN_PATH) "$(DESTDIR)$(mandir)/man$(MAN_SECTION)" +endif + +$(eval $(call clean-target,docs/man,,$(MAN_PATH) docs/man/flags.xsl docs/man/flags.xml)) + diff --git a/ghc.mk b/ghc.mk index 471fb4f..346e561 100644 --- a/ghc.mk +++ b/ghc.mk @@ -492,6 +492,7 @@ endif BUILD_DIRS += \ docs/users_guide \ + docs/man \ libraries/Cabal/doc \ $(GHC_UNLIT_DIR) \ $(GHC_HP2PS_DIR) @@ -915,6 +916,7 @@ $(eval $(call bindist,.,\ $(INSTALL_TOPDIRS) \ $(INSTALL_TOPDIR_SCRIPTS) \ $(INSTALL_BINS) \ + $(INSTALL_MANPAGES) \ $(INSTALL_DOCS) \ $(INSTALL_LIBRARY_DOCS) \ $(addsuffix /*,$(INSTALL_HTML_DOC_DIRS)) \ @@ -946,6 +948,7 @@ unix-binary-dist-prep: echo "BUILD_DOCBOOK_HTML = $(BUILD_DOCBOOK_HTML)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_PS = $(BUILD_DOCBOOK_PS)" >> $(BIN_DIST_MK) echo "BUILD_DOCBOOK_PDF = $(BUILD_DOCBOOK_PDF)" >> $(BIN_DIST_MK) + echo "BUILD_MAN = $(BUILD_MAN)" >> $(BIN_DIST_MK) ln -s ../../distrib/configure-bin.ac $(BIN_DIST_PREP_DIR)/configure.ac cd $(BIN_DIST_PREP_DIR) && autoreconf "$(RM)" $(RM_OPTS) $(BIN_DIST_PREP_TAR) -- 1.7.10.4