aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKenji Rikitake <[email protected]>2014-06-17 10:00:21 +0900
committerKenji Rikitake <[email protected]>2014-07-21 00:28:37 +0900
commita4fdce62cefeaa8bfcb0719f6287a70d68096ecc (patch)
tree74aceb8e108a44e7b3190a05d641035885e3cae0 /plugins
parentf2e7ca3b3d9562b186fb276c72ee7f45a8304c32 (diff)
downloaderlang.mk-a4fdce62cefeaa8bfcb0719f6287a70d68096ecc.tar.gz
erlang.mk-a4fdce62cefeaa8bfcb0719f6287a70d68096ecc.tar.bz2
erlang.mk-a4fdce62cefeaa8bfcb0719f6287a70d68096ecc.zip
Add CC/CFLAGS OS type detection code to plugins/c_src.mk
Diffstat (limited to 'plugins')
-rw-r--r--plugins/c_src.mk16
1 files changed, 15 insertions, 1 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):