@@ -109,8 +109,21 @@ defmodule Mix.Tasks.Compile.ElixirMake do
109109 Generally speaking, compilation artifacts are written to the `priv`
110110 directory, as that the only directory, besides `ebin`, which are
111111 available to Erlang/OTP applications. Therefore, we recommend the
112- Makefile top copy any artifact to `$MIX_APP_PATH/priv` or, even
113- better, to `$MIX_APP_PATH/priv/$MIX_TARGET`.
112+ Makefile top copy any artifact to `$MIX_APP_PATH/priv` and to have
113+ no top-level `priv` directory.
114+
115+ In case you create a top-level `priv` directory, it gets symlinked
116+ to all build directories, in which case you should rather copy the
117+ artifacts to `$MIX_APP_PATH/priv/$MIX_TARGET`. This is relevant for
118+ projects like Nerves that build for several targets and may involve
119+ cross-compilation, so the user ends up with one _build subdirectory
120+ per target and we don't want artifacts in the symlinked `priv` to
121+ override each other. The downside of shared `priv` is that creating
122+ a release would copy all its contents, even with the artifacts not
123+ related to the given target. So, if your compilation is expensive
124+ it may be better to never create top-level `priv` and manage your
125+ own `cache` directory with per-target artifacts and copy them to
126+ `$MIX_APP_PATH/priv`.
114127 """
115128
116129 use Mix.Task
0 commit comments