[[project @ 2000-06-12 11:41:00 by simonmar]
simonmar**20000612114100
Update docs on mkdependHS: it isn't a separate utility, so document it
under "Using GHC".
Also update section on Happy.
] {
hunk ./ghc/docs/users_guide/using.sgml 1150
-
-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:
-
+
hunk ./ghc/docs/users_guide/using.sgml 1152
-
+ 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:
hunk ./ghc/docs/users_guide/using.sgml 1164
- mkdependHS -- $(HC_OPTS) -- $(SRCS)
+ ghc -M $(HC_OPTS) $(SRCS)
hunk ./ghc/docs/users_guide/using.sgml 1167
-
+ 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:
hunk ./ghc/docs/users_guide/using.sgml 1225
-
-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 .
-
+
+ghc -M -optdep-f optdep.depend ...
+
+
+ The full list of options accepted by
+ mkdependHS is:
hunk ./ghc/docs/users_guide/using.sgml 1232
-
-A few caveats about this simple scheme:
-
+
hunk ./ghc/docs/users_guide/using.sgml 1234
-
+
+
+
+ Turn off warnings about interface file shadowing.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1241
-
-
+
+
+
+ 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.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1257
-
- 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).
+
+
+
+ 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.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1269
-
-
-
+
+
+
+ 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".)
+
+
hunk ./ghc/docs/users_guide/using.sgml 1290
-
- 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.”
+
+
+
+ Regard <file> as
+ "stable"; i.e., exclude it from having dependencies on
+ it.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1299
-
-
-
+
+
+
+ same as
+
+
hunk ./ghc/docs/users_guide/using.sgml 1306
-
- This scheme will work with mutually-recursive modules but,
-again, it may take multiple iterations to “settle.”
+
+
+
+ Regard the colon-separated list of directories
+ <dirs> as containing stable,
+ don't generate any dependencies on modules therein.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1315
-
-
+
+
+
+ same as .
+
+
hunk ./ghc/docs/users_guide/using.sgml 1322
-
+
+
+
+ Regard <file> as not
+ "stable"; i.e., generate dependencies on it (if any). This
+ option is normally used in conjunction with the
+ option.
+
+
hunk ./ghc/docs/users_guide/using.sgml 1332
-
+
+
+
+ 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.
+
+
+
hunk ./ghc/docs/users_guide/utils.sgml 12
-
-Makefile dependencies in Haskell: using mkdependHS
-
-
-
-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.
-
-
-
-
-
-
-
-
hunk ./ghc/docs/users_guide/utils.sgml 89
-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.
}