diff --git a/Cabal/doc/cabal-commands.rst b/Cabal/doc/cabal-commands.rst index c19df8b3570..c8eae80a716 100644 --- a/Cabal/doc/cabal-commands.rst +++ b/Cabal/doc/cabal-commands.rst @@ -86,6 +86,16 @@ A target can take any of the following forms: - ``tests``, - ``benches``, ``benchmarks``. +- A module target: ``[package:][ctype:]module``, which specifies that the + component of which the given module is a part of will be built. If the + target is ambiguous, e.g. only ``module`` is specified and the module name + is part of multiple components, all of these component will be built. + +- A filepath target: ``[package:][ctype:]filepath``, which specifies that the + component of which the given filepath is a part of will be built. If the + target is ambiguous, e.g. only ``filepath`` is specified and the filepath + is part of multiple components, all of these component will be built. + In component targets, ``package:`` and ``ctype:`` (valid component types are ``lib``, ``flib``, ``exe``, ``test`` and ``bench``) can be used to disambiguate when multiple packages define the same component, or the @@ -99,6 +109,12 @@ Some example targets: $ cabal v2-build lib:foo-pkg # build the library named foo-pkg $ cabal v2-build foo-pkg:foo-tests # build foo-tests in foo-pkg + $ cabal v2-build src/Lib.s # build the library component to + # which "src/Lib.hs" belongs + $ cabal v2-build app/Main.hs # build the executable component of + # "app/Main.hs" + $ cabal v2-build Lib # build the library component to + # which the module "Lib" belongs (There is also syntax for specifying module and file targets, but it doesn't currently do anything.)