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