From a5ac0914146a1866b65244f30f0a871b28d18c30 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 21 Apr 2015 16:55:16 -0700 Subject: [PATCH] Tweak other makefiles for OSX --- node-to-rust/Makefile | 12 +++++++++--- node-to-rust/src/main.js | 2 +- python-to-rust/Makefile | 8 +++++++- ruby-to-rust/Makefile | 8 +++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/node-to-rust/Makefile b/node-to-rust/Makefile index b8898b2..e6af8a5 100644 --- a/node-to-rust/Makefile +++ b/node-to-rust/Makefile @@ -1,9 +1,15 @@ -all: target/libdouble_input.so +ifeq ($(shell uname),Darwin) + EXT := dylib +else + EXT := so +endif + +all: target/libdouble_input.$(EXT) node src/main.js -target/libdouble_input.so: src/lib.rs Cargo.toml +target/libdouble_input.$(EXT): src/lib.rs Cargo.toml cargo build - (cd target && ln -nsf debug/libdouble_input-* libdouble_input.so) + (cd target && ln -nsf debug/libdouble_input-*$(EXT) libdouble_input.$(EXT)) clean: rm -rf target diff --git a/node-to-rust/src/main.js b/node-to-rust/src/main.js index 4ffec4b..0748788 100644 --- a/node-to-rust/src/main.js +++ b/node-to-rust/src/main.js @@ -1,6 +1,6 @@ var ffi = require('ffi'); -var lib = ffi.Library('target/libdouble_input.so', { +var lib = ffi.Library('target/libdouble_input', { 'double_input': [ 'int', [ 'int' ] ] }); diff --git a/python-to-rust/Makefile b/python-to-rust/Makefile index 583a843..9dd7bcb 100644 --- a/python-to-rust/Makefile +++ b/python-to-rust/Makefile @@ -1,9 +1,15 @@ +ifeq ($(shell uname),Darwin) + EXT := dylib +else + EXT := so +endif + all: target/libdouble_input.so python src/main.py target/libdouble_input.so: src/lib.rs Cargo.toml cargo build - (cd target && ln -nsf debug/libdouble_input-* libdouble_input.so) + (cd target && ln -nsf debug/libdouble_input-*$(EXT) libdouble_input.so) clean: rm -rf target diff --git a/ruby-to-rust/Makefile b/ruby-to-rust/Makefile index 582f0ca..a39306a 100644 --- a/ruby-to-rust/Makefile +++ b/ruby-to-rust/Makefile @@ -1,9 +1,15 @@ +ifeq ($(shell uname),Darwin) + EXT := dylib +else + EXT := so +endif + all: target/libdouble_input.so ruby src/main.rb target/libdouble_input.so: src/lib.rs Cargo.toml cargo build - (cd target && ln -nsf debug/libdouble_input-* libdouble_input.so) + (cd target && ln -nsf debug/libdouble_input-*$(EXT) libdouble_input.so) clean: rm -rf target