View Source mix compile.elixir_make (elixir_make v0.7.3)
make in the current project.
This task runs
make in the current project; any output coming from
printed in real-time on stdout.
This compiler can be configured through the return value of the
mix.exs; for example:
def project() do [app: :myapp, make_executable: "make", make_makefile: "Othermakefile", compilers: [:elixir_make] ++ Mix.compilers, deps: deps()] end
The following options are available:
:make_executable- (binary or
:default) it's the executable to use as the
makeprogram. If not provided or if
:default, it defaults to
"gmake"on FreeBSD, OpenBSD and NetBSD, and
"make"on everything else. You can, for example, customize which executable to use on a specific OS and use
:defaultfor every other OS. If the
MAKEenvironment variable is present, that is used as the value of this option.
:make_makefile- (binary or
:default) it's the Makefile to use. Defaults to
"Makefile"for Unix systems and
"Makefile.win"for Windows systems if not provided or if
:make_targets- (list of binaries) it's the list of Make targets that should be run. Defaults to
makewill run the first target.
:make_clean- (list of binaries) it's a list of Make targets to be run when
mix cleanis run. It's only run if a non-
:make_cleanis provided. Defaults to
:make_cwd- (binary) it's the directory where
makewill be run, relative to the root of the project.
:make_env- (map of binary to binary) it's a map of extra environment variables to be passed to
make. You can also pass a function in here in case
make_envneeds access to things that are not available during project setup; the function should return a map of binary to binary. Many default environment variables are set, see section below
:make_error_message- (binary or
:default) it's a custom error message that can be used to give instructions as of how to fix the error (e.g., it can be used to suggest installing
gccif you're compiling a C dependency).
:make_args- (list of binaries) it's a list of extra arguments to be passed.
The following options configure precompilation:
:make_precompiler- a two-element tuple with the precompiled type and module to use. The precompile type is either
:portand then the precompilation module. If the type is a
:nif, it looks for a DDL or a shared object as precompilation target given by
:make_precompiler_filenameand the current NIF version is part of the precompiled archive. If
:port, it looks for an executable with
:make_precompiler_url- the download URL template. Defaults to none. Required when
:make_precompiler_filename- the filename of the compiled artefact without its extension. Defaults to the app name.
:make_force_build- if build should be forced even if precompiled artefacts are available. Defaults to true if the app has a
See the Precompilation guide for more information.
Default environment variables
There are also several default environment variables set:
MIX_BUILD_PATH- same as
MIX_APP_PATH- same as
MIX_COMPILE_PATH- same as
MIX_CONSOLIDATION_PATH- same as
MIX_DEPS_PATH- same as
MIX_MANIFEST_PATH- same as
These may also be overwritten with the
Compilation artifacts and working with priv directories
Generally speaking, compilation artifacts are written to the
directory, as that the only directory, besides
ebin, which are
available to Erlang/OTP applications.
However, note that Mix projects supports the
configuration, which controls if assets in the
are symlinked (when
false, the default) or copied (
In order to support both options for
:build_embedded, it is
important to follow the given guidelines:
- The "priv" directory must not exist in the source code
- The Makefile should copy any artifact to
$MIX_APP_PATH/privor, even better, to
- If there are static assets, the Makefile should copy them over from a directory at the project root (not named "priv")