]> piware.de Git - learn-rust.git/blobdiff - call-rust-from-c/Makefile
Call Rust function from C: Skeleton
[learn-rust.git] / call-rust-from-c / Makefile
diff --git a/call-rust-from-c/Makefile b/call-rust-from-c/Makefile
new file mode 100644 (file)
index 0000000..66a951a
--- /dev/null
@@ -0,0 +1,20 @@
+RLIB = target/debug/libcall_rust_from_c.a
+
+main: src/main.o $(RLIB)
+       $(CC) -Wall -o $@ $^
+
+src/main.o: src/rustlib.h
+
+src/rustlib.h: src/lib.rs
+       cbindgen --lang c --output $@
+
+$(RLIB): src/lib.rs
+       cargo build
+
+run: main
+       ./main
+
+check:
+       cargo test
+
+.PHONY: run test