# Overriding package locations

override(P, D) Use the version of package `P` in directory `D/P` instead of the one in `/pkg/P`. While `D` must be an absolute path, a relative path `RD` may be used with the `path_of` function as `override(P, path_of(RD))`.

`override` alters the behaviour of the `include_pkg` and `import` procedures, and must be executed prior to any such calls to have an effect.

To help ensure that the public repositories are consistent, `m3ship` will refuse to install any package built using overrides.

When the `-O` option is specified, `m3build` looks for a file named `m3overrides` in the `src` directory and, if one exists, executes it immediately prior to executing `m3makefile`. By keeping all `override` calls in an `m3overrides` file and not in an `m3makefile`, you can build both private and public versions of packages without editting any files.

The overrides in effect when a package was built are automatically carried forward into importers of the package, so there is no need to restate the complete set of overrides at every level, only of those packages that are directly imported into a given package.