aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/c_src.mk16
-rw-r--r--plugins/relx.mk4
2 files changed, 17 insertions, 3 deletions
diff --git a/plugins/c_src.mk b/plugins/c_src.mk
index e1d8297..63ca6bc 100644
--- a/plugins/c_src.mk
+++ b/plugins/c_src.mk
@@ -11,6 +11,20 @@ C_SRC_ENV ?= $(C_SRC_DIR)/env.mk
C_SRC_OPTS ?=
C_SRC_OUTPUT ?= $(CURDIR)/priv/$(PROJECT).so
+# System type and C compiler/flags.
+
+UNAME_SYS := $(shell uname -s)
+ifeq ($(UNAME_SYS), Darwin)
+ CC ?= cc
+ CFLAGS ?= -O3 -std=c99 -arch x86_64 -flat_namespace -undefined suppress -finline-functions -Wall -Wmissing-prototypes
+else ifeq ($(UNAME_SYS), FreeBSD)
+ CC ?= cc
+ CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
+else ifeq ($(UNAME_SYS), Linux)
+ CC ?= gcc
+ CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
+endif
+
# Verbosity.
c_src_verbose_0 = @echo " C_SRC " $(?F);
@@ -22,7 +36,7 @@ ifeq ($(wildcard $(C_SRC_DIR)/Makefile),)
app:: $(C_SRC_ENV)
@mkdir -p priv/
- $(c_src_verbose) gcc $(C_SRC_DIR)/*.c -fPIC -shared -o $(C_SRC_OUTPUT) \
+ $(c_src_verbose) $(CC) $(CFLAGS) $(C_SRC_DIR)/*.c -fPIC -shared -o $(C_SRC_OUTPUT) \
-I $(ERTS_INCLUDE_DIR) $(C_SRC_OPTS)
$(C_SRC_ENV):
diff --git a/plugins/relx.mk b/plugins/relx.mk
index c6fd227..f425d12 100644
--- a/plugins/relx.mk
+++ b/plugins/relx.mk
@@ -16,8 +16,8 @@ RELX_URL ?= https://github.com/erlware/relx/releases/download/v1.0.2/relx
RELX_OPTS ?=
RELX_OUTPUT_DIR ?= _rel
-ifneq ($(firstword $(subst -o,,$(RELX_OPTS))),)
- RELX_OUTPUT_DIR = $(firstword $(subst -o,,$(RELX_OPTS)))
+ifeq ($(firstword $(RELX_OPTS)),-o)
+ RELX_OUTPUT_DIR = $(word 2,$(RELX_OPTS))
endif
# Core targets.