Add C to Rust example

This commit is contained in:
Alex Crichton
2015-04-19 10:28:20 -07:00
parent afbdb0cc41
commit 930924cdf5
4 changed files with 43 additions and 0 deletions

18
c-to-rust/Makefile Normal file
View File

@@ -0,0 +1,18 @@
all: target/double
target/double
target:
mkdir -p $@
target/double: target/main.o target/libdouble_input.a
$(CC) -o $@ -Wl,--gc-sections $^ -lpthread
target/libdouble_input.a: src/lib.rs Cargo.toml
cargo build
(cd target && ln -nsf debug/libdouble_input-*.a libdouble_input.a)
target/main.o: src/main.c | target
$(CC) -o $@ -c $<
clean:
rm -rf target