[project @ 2001-10-26 00:53:27 by sof]
authorsof <unknown>
Fri, 26 Oct 2001 00:53:27 +0000 (00:53 +0000)
committersof <unknown>
Fri, 26 Oct 2001 00:53:27 +0000 (00:53 +0000)
commit114470474d2e037d16b736354070fa03181e8348
tree040fbcceebe7509e6b4531a4a14eaa28f58e8056
parent32e87ecff1350bbc88acf01c9397e9af77a21233
[project @ 2001-10-26 00:53:27 by sof]
Added support for a custom pre-processor pass:

  ghc -F -pgmF/path/to/a/pre/processor ...

will now run /path/to/a/pre/processor over Haskell
input sources. It is positioned in the compilation
pipeline just before the compiler proper, but after
unlit'ing and CPP'ing. The pre-processor is passed
the following command-line when invoked:

   /path/to/a/pre/processor orig_input_source_file_path
        input_source_file
    output_source_file
    <other options>

Additionally options can be fed directly to the
pre-processor via -optF<option> options.

The -F option causes the pre-processor to run _iff_ one
has been specified via -pgmF (there's some redundancy
here, but I went for this cmd-line interface as it's
consistent with the general -pgm<Foo> story).

Motivation:

 * hooking in a pre-processor is occasionally useful;
   e.g., cheap&cheerful way to integrate language
   extensions with GHC, compile-time syntax/style
   checking etc.

 * Artfully re-using the CPP phase (by specifying your
   own via -pgmP) doesn't really work as the driver
   really assumes that GNU cpp is what's being invoked
   (and path mangling is also performed on Win32 platforms).

   Additionally, there are cases when you want to be
   able to run CPP _and_ a pre-processor.

 * The alternative of running the pre-processor as a
   separate program in a Makefile (say) doesn't work
   in interpreted mode, and this approach also forces
   you to give up on recompilation checking when in
   batch mode.
ghc/compiler/main/CmdLineOpts.lhs
ghc/compiler/main/DriverFlags.hs
ghc/compiler/main/DriverPhases.hs
ghc/compiler/main/DriverPipeline.hs
ghc/compiler/main/DriverState.hs
ghc/compiler/main/Main.hs
ghc/compiler/main/SysTools.lhs