diff options
author | Loïc Hoguin <[email protected]> | 2015-05-17 10:32:26 +0300 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-05-17 10:32:26 +0300 |
commit | 909553ad7e16126e70756eca888edfb2e2b2c65b (patch) | |
tree | ae704ae4981aa9c79dfdb0783cd4d772246005b7 /core | |
parent | cfe5f82bd52e241d9d3dc37d023bb0d568875495 (diff) | |
download | erlang.mk-909553ad7e16126e70756eca888edfb2e2b2c65b.tar.gz erlang.mk-909553ad7e16126e70756eca888edfb2e2b2c65b.tar.bz2 erlang.mk-909553ad7e16126e70756eca888edfb2e2b2c65b.zip |
Handle port_specs with 2 values
For exml from mongooseim.
Diffstat (limited to 'core')
-rw-r--r-- | core/deps.mk | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/deps.mk b/core/deps.mk index ffd9f5c..480f07b 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -184,11 +184,26 @@ define dep_autopatch_rebar.erl Write(io_lib:format("COMPILE_FIRST +=~s\n", [Names])) end end(), + PortSpec = fun(Name, {_, Output, Input, [{env, Env}]}) -> + filelib:ensure_dir("$(DEPS_DIR)/$(1)/" ++ Output), + file:write_file("$(DEPS_DIR)/$(1)/c_src/Makefile." ++ Name, [ + [["override ", K, " = $$$$\(shell echo ", Escape(V), "\)\n"] + || {_, K, V} <- Env], + "\nall:\n\t$$$$\(CC\) $$$$\(CFLAGS\) $$$$\(LDLIBS\) $$$$\(LDFLAGS\) ", + "-o $(DEPS_DIR)/$(1)/", Output, " ", + [["../", F] || F <- Input] + ]) + end, fun() -> case lists:keyfind(port_specs, 1, Conf) of {_, [{Output, _}]} -> filelib:ensure_dir("$(DEPS_DIR)/$(1)/" ++ Output), - Write("C_SRC_OUTPUT = " ++ Output ++ "\n"); + Write("C_SRC_OUTPUT = " ++ Escape(Output) ++ "\n"); + {_, [First, Second]} -> + PortSpec("1", First), + PortSpec("2", Second), + file:write_file("$(DEPS_DIR)/$(1)/c_src/Makefile", + "all:\n\t$$$$\(MAKE\) -f Makefile.1\n\t$$$$\(MAKE\) -f Makefile.2\n"); _ -> ok end end(), |