From 501f3c52a3fd0ce238d6be1bcc72a6c53c8e9d37 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 5 Dec 2006 23:52:44 +0000 Subject: [PATCH] Make a ghc/ghci manpage Set GhcManpages=YES in mk/build.mk if you want to build the manpage. --- docs/Makefile | 2 +- docs/man/Makefile | 51 ++++++++ docs/man/gen_flags.xsl.pl | 284 +++++++++++++++++++++++++++++++++++++++++++++ mk/config.mk.in | 1 + 4 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 docs/man/Makefile create mode 100644 docs/man/gen_flags.xsl.pl diff --git a/docs/Makefile b/docs/Makefile index 267de1d..99b6d68 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,7 +1,7 @@ TOP = .. include $(TOP)/mk/boilerplate.mk -SUBDIRS = building docbook-cheat-sheet ext-core storage-mgt users_guide +SUBDIRS = man building docbook-cheat-sheet ext-core storage-mgt users_guide PAGES = index.html diff --git a/docs/man/Makefile b/docs/man/Makefile new file mode 100644 index 0000000..63875da --- /dev/null +++ b/docs/man/Makefile @@ -0,0 +1,51 @@ +TOP = ../.. +include $(TOP)/mk/boilerplate.mk + +GHC_COMMANDS=ghc ghci + +UNCENSORED_MANPAGES=ghc.1 + +ifeq '$(GhcManpages)' 'YES' +MANPAGES=$(UNCENSORED_MANPAGES) +else +MANPAGES= +endif + +boot: + @: + +all: $(MANPAGES) + @: + +install: $(addprefix install-,$(MANPAGES)) + @: + +clean: + rm -f flags.xml flags.xsl $(UNCENSORED_MANPAGES) + +# The work for building + +ghc.1: flags.xsl flags.xml + $(XSLTPROC) $(XSLTPROC_OPTS) flags.xsl flags.xml > $@ + +flags.xsl: gen_flags.xsl.pl + perl gen_flags.xsl.pl "$(GHC_COMMANDS)" "$(libdir)" > $@ + +flags.xml: ../users_guide/flags.xml + rm -f $@ + head -1 $< >> $@ + echo " \ + \ + ]>" >> $@ + tail -n +2 $< >> $@ + +# The work for installing + +.PHONY: install-% + +install-mandir: + $(INSTALL_DIR) $(mandir) + +install-%: install-mandir $* + $(INSTALL_MAN) $* $(mandir) + diff --git a/docs/man/gen_flags.xsl.pl b/docs/man/gen_flags.xsl.pl new file mode 100644 index 0000000..a331792 --- /dev/null +++ b/docs/man/gen_flags.xsl.pl @@ -0,0 +1,284 @@ +#!/usr/bin/perl -w + +use strict; + +if ($#ARGV ne 1) { + die "Usage: $0 \n" +} + +my @ghc_commands = split / /, $ARGV[0]; +my $libdir = $ARGV[1]; + +print <<'EOF'; + + + + + + + +.\" +.\" This is a generated file. Changes might get clobbered. Edit at own's risk. +.\" +.TH GHC 1 "2002-10-25" "Glasgow FP Suite" "Glasgow Haskell Compiler" +.SH NAME +GHC \- the Glasgow Haskell Compiler + + +.SH SYNOPSIS +EOF + +my $started = 0; + +for my $ghc_command (@ghc_commands) { + print ".br\n" if $started; + $started = 1; + print <<"EOF"; +.B $ghc_command +.RI [ option | filename ]... +EOF +} + +print <<'EOF'; + +.SH DESCRIPTION +This manual page documents briefly the +.B ghc +and +.B ghci +commands. +Note that +.B ghci +is not yet available on all architectures. +Extensive documentation is available in various other formats +including DVI, PostScript and HTML; see below. + +.PP +Each of GHC's command line options is classified as either +.IR static " or " dynamic . +A static flag may only be specified on the command line, whereas a +dynamic flag may also be given in an \f(CROPTIONS\fP pragma in a +source file or set from the GHCi command-line with \f(CR:set\fP. + +As a rule of thumb, all the language options are dynamic, as are the +warning options and the debugging options. + +The rest are static, with the notable exceptions of +.BR \-v ", " \-cpp ", " \-fasm ", " \-fvia\-C ", and " \-#include . +The OPTIONS sections lists the status of each flag. + +.PP +Common suffixes of file names for Haskell are: +.TP +.B .hs +Haskell source code; preprocess, compile +.TP +.B .lhs +literate Haskell source; unlit, preprocess, compile +.TP +.B .hi +Interface file; contains information about exported +symbols +.TP +.B .hc +intermediate C files +.TP +.BI . x _o +way +.I x +object files; common ways are: +.BR p ", " u ", " s +.TP +.BI . x _hi +way +.I x +interface files + + +.SH OPTIONS + + + + + + +.SH FILES +EOF +print ".I $libdir"; +print <<'EOF'; + +.SH COPYRIGHT + +Copyright 2002, The University Court of the University of Glasgow. +.br +All rights reserved. + + +.SH AUTHOR + +This manual page was generated from the XML documentation of GHC with blood, +sweat, tears and a breaks-if-you-look-at-it-the-wrong-way XSL +stylesheet originally written by Michael Weber <michaelw@debian.org> +for the Debian GNU/Linux system (but may be used by others). + +.\" End + + + + + + +.SS + + +.SS + + +.nh + +.hy + + + + + + + +.SH + + + + +.SH + + + + + + + + + + + + + + +.TP + + + + + + +.rj +[] + + + + + + + + + + + + + + + + + + + + + + + + \fB + + \fP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \fI + + \fP + + + + + \f(CR + + \fP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +EOF + diff --git a/mk/config.mk.in b/mk/config.mk.in index 67875e1..021d1fc 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -595,6 +595,7 @@ INSTALL_PROGRAM = $(INSTALL) -m 755 INSTALL_SCRIPT = $(INSTALL) -m 755 INSTALL_SHLIB = $(INSTALL) -m 755 INSTALL_DATA = $(INSTALL) -m 644 +INSTALL_MAN = $(INSTALL) -m 644 INSTALL_DIR = $(MKDIRHIER) # ----------------------------------------------------------------------------- -- 1.7.10.4