diff options
author | Loïc Hoguin <[email protected]> | 2014-07-22 14:19:25 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-07-22 14:19:25 +0200 |
commit | 0cd0795ab25277149935ef1f25691f5d71bde9fd (patch) | |
tree | 30155c660b3481191bdbdf788ce32bdb99466773 /plugins | |
parent | e281311f7d08dabf969cf1fd0b5f35f8788c1c9d (diff) | |
parent | a4fdce62cefeaa8bfcb0719f6287a70d68096ecc (diff) | |
download | erlang.mk-0cd0795ab25277149935ef1f25691f5d71bde9fd.tar.gz erlang.mk-0cd0795ab25277149935ef1f25691f5d71bde9fd.tar.bz2 erlang.mk-0cd0795ab25277149935ef1f25691f5d71bde9fd.zip |
Merge branch 'jj1bdx-cc-cflags' of git://github.com/jj1bdx/erlang.mk
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/c_src.mk | 16 |
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): |