nif: add support for CFLAGS

This commit is contained in:
Carlos Martín Nieto
2013-10-16 13:27:40 +02:00
parent 05e1781356
commit b930c1519f

View File

@@ -51,6 +51,12 @@ defmodule Mix.Tasks.Compile.Nif do
exts = Keyword.get(config, :exts, [:c])
compiler = Keyword.get(config, :compilers, ["cc", "gcc", "clang"]) |> find_compiler
if cflags = System.get_env("CFLAGS") do
# FIXME: this isn't going to work too well with quoted spaces
# inside arguments
flags = [flags, String.split(cflags)]
end
# Create the directory (e.g. "priv/")
File.mkdir_p!(Path.dirname(file))