From 8f320598066b0b22e6a1d8f485b5ace7f87578fa Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 12 Jun 2000 11:41:00 +0000 Subject: [PATCH] [project @ 2000-06-12 11:41:00 by simonmar] Update docs on mkdependHS: it isn't a separate utility, so document it under "Using GHC". Also update section on Happy. --- ghc/docs/users_guide/using.sgml | 241 ++++++++++++++++++++++++++++--------- ghc/docs/users_guide/utils.sgml | 250 +-------------------------------------- 2 files changed, 190 insertions(+), 301 deletions(-) diff --git a/ghc/docs/users_guide/using.sgml b/ghc/docs/users_guide/using.sgml index 4819a99..e3f63e9 100644 --- a/ghc/docs/users_guide/using.sgml +++ b/ghc/docs/users_guide/using.sgml @@ -1147,65 +1147,200 @@ a rule to do so; one of the preceding suffix rules does the job nicely. - -Putting inter-dependencies of the form Foo.o : Bar.hi into your -Makefile by hand is rather error-prone. Don't worry—never fear, -mkdependHS is here! (and is distributed as part of GHC) Add the -following to your Makefile: - + - + Dependency generation + dependencies in Makefiles + Makefile dependencies + + Putting inter-dependencies of the form Foo.o : + Bar.hi into your Makefile by hand + is rather error-prone. Don't worry, GHC has support for + automatically generating the required dependencies. Add the + following to your Makefile: depend : - mkdependHS -- $(HC_OPTS) -- $(SRCS) + ghc -M $(HC_OPTS) $(SRCS) - - - -Now, before you start compiling, and any time you change the imports -in your program, do make depend before you do make cool_pgm. -mkdependHS will append the needed dependencies to your Makefile. -mkdependHS is fully described in . - - - -A few caveats about this simple scheme: - - - - - - - - - You may need to compile some modules explicitly to create their -interfaces in the first place (e.g., make Bar.o to create Bar.hi). - - - - - - - You may have to type make more than once for the dependencies -to have full effect. However, a make run that does nothing -does mean “everything's up-to-date.” - - - - - - - This scheme will work with mutually-recursive modules but, -again, it may take multiple iterations to “settle.” - - - - - - - + Now, before you start compiling, and any time you change + the imports in your program, do make + depend before you do make + cool_pgm. GHC will append + the needed dependencies to your + Makefile. + + In general, if module A contains the + line + + +import B ...blah... + + + then mkdependHS will generate a dependency + line of the form: + + +A.o : B.hi + + + If module A contains the line + + +import {-# SOURCE #-} B ...blah... + + + then mkdependHS will generate a dependency + line of the form: + + +A.o : B.hi-boot + + + (See for details of interface files.) + If A imports multiple modules, then there + will be multiple lines with A.o as the + target. + + By default, GHC generates all the + dependencies, and then concatenates them onto the end of + makefile (or Makefile + if makefile doesn't exist) bracketed by the + lines "# DO NOT DELETE: Beginning of Haskell + dependencies" and "# DO NOT DELETE: End + of Haskell dependencies". If these lines already + exist in the makefile, then the old + dependencies are deleted first. + + Internally, GHC uses a script to generate the + dependencies, called mkdependHS. This script + has some options of its own, which you might find useful. + Options can be passed directly to mkdependHS + with GHC's -optdep option. For example, to + generate the dependencies into a file called + .depend instead of + Makefile: + + +ghc -M -optdep-f optdep.depend ... + + + The full list of options accepted by + mkdependHS is: + + + + + + + Turn off warnings about interface file shadowing. + + + + + + + Use blah as the makefile, + rather than makefile or + Makefile. If + blah doesn't exist, + mkdependHS creates it. We often use + to put the dependencies in + .depend and then + include the file + .depend into + Makefile. + + + + + + + Use .<osuf> as the + "target file" suffix ( default: o). + Multiple flags are permitted (GHC2.05 + onwards). Thus "" will + generate dependencies for .hc and + .o files. + + + + + + + Make extra dependencies that declare that files with + suffix + .<suf>_<osuf> + depend on interface files with suffix + .<suf>_hi, or (for + {-# SOURCE #-} + imports) on .hi-boot. Multiple + flags are permitted. For example, + will make dependencies + for .hc on .hi, + .a_hc on + .a_hi, and + .b_hc on + .b_hi. (Useful in conjunction + with NoFib "ways".) + + + + + + + Regard <file> as + "stable"; i.e., exclude it from having dependencies on + it. + + + + + + + same as + + + + + + + Regard the colon-separated list of directories + <dirs> as containing stable, + don't generate any dependencies on modules therein. + + + + + + + same as . + + + + + + + Regard <file> as not + "stable"; i.e., generate dependencies on it (if any). This + option is normally used in conjunction with the + option. + + + + + + + Regard prelude libraries as unstable, i.e., generate + dependencies on the prelude modules used (including + Prelude). This option is normally only + used by the various system libraries. If a + option is used, dependencies will + also be generated on the library's interfaces. + + + diff --git a/ghc/docs/users_guide/utils.sgml b/ghc/docs/users_guide/utils.sgml index 4bd99a1..67547c3 100644 --- a/ghc/docs/users_guide/utils.sgml +++ b/ghc/docs/users_guide/utils.sgml @@ -9,252 +9,6 @@ This section describes other program(s) which we distribute, that help with the Great Haskell Programming Task. - -Makefile dependencies in Haskell: using <Command>mkdependHS</Command> - - - -mkdependHS -Makefile dependencies -dependencies in Makefiles - - - -You run mkdependHS like this: - - -mkdependHS [mkdependHS options] [-- GHC options --] srcfile1 [srcfile2 ...] - - -or - - -ghc -M [mkdependHS options(prefix with -optdep)] [ GHC options ] srcfile1 [srcfile2 ...] - - -To see mkdependHS's command-line flags, give it a duff flag, -e.g., mkdependHS -help. - - - -In general, if module A contains the line - - -import B ...blah... - - -then mkdependHS will generate a dependency line of the form: - - -A.o : B.hi - - -If module A contains the line - - -import {-# SOURCE #-} B ...blah... - - -then mkdependHS will generate a dependency line of the form: - - -A.o : B.hi-boot - - -(See for details of interface files.) -If A imports multiple modules, then there will be multiple lines with A.o as the -target. - - - -By default, mkdependHS generates all the dependencies, and then -concatenates them onto the end of -makefile (or Makefile if makefile doesn't exist) bracketed by -the lines "# DO NOT DELETE: Beginning of Haskell dependencies" and -"# DO NOT DELETE: End of Haskell dependencies". If these lines -already exist in the makefile, mkdependHS deletes the old -dependencies first. - - - -mkdependHS takes GHC options between -- brackets. -It understands the following ones. Any options between -- brackets -that it doesn't understand are simply ignored; this way you can feed your -Makefile's standard GHC options to mkdependHS un-filtered. - - - - - - -Run the C pre-processor over the input files. The -default is not to. - - - - - - - -A cpp ; usual meaning. - - - - - - - -Add <dirs> (colon-separated) to list of directories -to search for "import"ed modules. - - - - - - - -Add <dir> to list of directories to search for -.h files (i.e., usual meaning). - - - - - - - -This program uses this GHC system library; take -appropriate action (e.g., recognise when they are -"import"ing a module from that library). - - - - - - - -Here are the mkdependHS-specific options (not between --'s): - - - - - - -Be verbose. - - - - - - - -Be very verbose. - - - - - - - -Turn off warnings about interface file shadowing. - - - - - - - -Use blah as the makefile, rather than makefile -or Makefile. If blah doesn't exist, mkdependHS creates it. -We often use to put the dependencies in .depend and -then include the file .depend into Makefile. - - - - - - - -Use .<osuf> as the "target file" suffix ( default: o). -Multiple flags are permitted (GHC2.05 onwards). Thus "" -will generate dependencies for .hc and .o files. - - - - - - - -Make extra dependencies that declare that files with -suffix .<suf>_<osuf> depend on interface files with suffix .<suf>_hi, or -(for {-# SOURCE #-} imports) on .hi-boot. -Multiple flags are permitted. -For example, will -make dependencies for .hc on .hi, .a_hc on .a_hi, and .b_hc on .b_hi. -(Useful in conjunction with NoFib "ways".) - - - - - - - -Regard <file> as "stable"; i.e., exclude it from having -dependencies on it. - - - - - - - -same as - - - - - - - -Regard the colon-separated list of directories <dirs> as containing stable, -don't generate any dependencies on modules therein. - - - - - - - -same as . - - - - - - - -Regard <file> as not "stable"; i.e., generate dependencies -on it (if any). This option is normally used in conjunction -with the option. - - - - - - - -Regard prelude libraries as unstable, i.e., generate dependencies -on the prelude modules used (including Prelude). -This option is normally only used by the various system libraries. If -a option is used, dependencies will also be -generated on the library's interfaces. - - - - - - - - Emacs `TAGS' for Haskell: <Command>hstags</Command> @@ -332,8 +86,8 @@ is to Haskell what Yacc is to C. -You can get happy by FTP from ftp.dcs.gla.ac.uk in -pub/haskell/happy, the file happy-1.5-src.tar.gz. +You can get happy from the Happy Homepage. -- 1.7.10.4