Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Put NIF build products under the _build directory
The Makefile was storing build products in the source directory. This causes issues on Nerves when switching target processors since the NIF won't be built for the right architecture and the Makefile won't know to rebuild it. Building under the _build directory fixes this since there's a different subdirectory for every target processor (this uses the mix targets feature). This also addresses a source of confusion on Apple M1 Macs where you can switch between Intel and M1 modes. Since mix targets aren't used, you still need to be aware that you need to build clean when switching modes. It seems less confusing that building clean involves deleting files from `_build` rather both `_build` and `deps`. Notes about this change: 1. The `Makefile` now depends on environment variables set by `elixir_make` for the location of the `_build` directory and `erl_nif.h`. This means that calling `make` to only build the NIF won't work. See next commit. 2. This change works with Nerves. The Nerves infrastructure uses the same `elixir_make` environment variables, so the `erl_nif.h` include directory will come from Erlang source directory that matches the Nerves target. This didn't happen before, but `erl_nif.h` must not change enough between Erlang versions to matter. (i.e., it was lucky)
- Loading branch information