aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/deps.mk1
-rw-r--r--plugins/c_src.mk8
2 files changed, 4 insertions, 5 deletions
diff --git a/core/deps.mk b/core/deps.mk
index 8c5da9c..c70e751 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -178,6 +178,7 @@ define dep_autopatch_rebar.erl
Write("IGNORE_DEPS += edown eper eunit_formatters meck node_package "
"rebar_lock_deps_plugin rebar_vsn_plugin reltool_util\n"),
Write("C_SRC_DIR = /path/do/not/exist\n"),
+ Write("C_SRC_TYPE = rebar\n"),
Write("DRV_CFLAGS = -fPIC\nexport DRV_CFLAGS\n"),
Write(["ERLANG_ARCH = ", rebar_utils:wordsize(), "\nexport ERLANG_ARCH\n"]),
fun() ->
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index 9fa8111..efe7bfe 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -32,10 +32,6 @@ CXXFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR)
LDLIBS += -L $(ERL_INTERFACE_LIB_DIR) -lerl_interface -lei
-ifeq ($(C_SRC_TYPE),shared)
-LDFLAGS += -shared
-endif
-
# Verbosity.
c_verbose_0 = @echo " C " $(?F);
@@ -77,7 +73,9 @@ test-build:: $(C_SRC_ENV) $(C_SRC_OUTPUT)
$(C_SRC_OUTPUT): $(OBJECTS)
$(verbose) mkdir -p priv/
- $(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT)
+ $(link_verbose) $(CC) $(OBJECTS) \
+ $(LDFLAGS) $(if $(filter $(C_SRC_TYPE),shared),-shared) $(LDLIBS) \
+ -o $(C_SRC_OUTPUT)
%.o: %.c
$(COMPILE_C) $(OUTPUT_OPTION) $<