aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-23 14:52:17 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-23 14:52:17 +0100
commit20eb8b73f7914c86812eda4b3b14ee2d0cd5a826 (patch)
treeb9b32887525510c7031f8e0957e11d85e6bdcf11
parentd77e19ae7380b8ddda4625772161c8dc74651370 (diff)
downloadpintos-rs-20eb8b73f7914c86812eda4b3b14ee2d0cd5a826.tar.gz
userprog makefile
-rw-r--r--halt/main.c5
-rw-r--r--halt/rust.h1
-rw-r--r--rust/Cargo.toml (renamed from halt/Cargo.toml)7
-rw-r--r--rust/Makefile2
-rw-r--r--rust/rust-toolchain (renamed from halt/rust-toolchain)0
-rw-r--r--rust/src/lib.rs (renamed from halt/src/lib.rs)0
-rw-r--r--src/Makefile.userprog8
7 files changed, 10 insertions, 13 deletions
diff --git a/halt/main.c b/halt/main.c
deleted file mode 100644
index c89be21..0000000
--- a/halt/main.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "rust.h"
-
-void _start (int argc, char **argv) {
- main();
-}
diff --git a/halt/rust.h b/halt/rust.h
deleted file mode 100644
index eba2976..0000000
--- a/halt/rust.h
+++ /dev/null
@@ -1 +0,0 @@
-int main(void);
diff --git a/halt/Cargo.toml b/rust/Cargo.toml
index 14c75e0..a74fdd6 100644
--- a/halt/Cargo.toml
+++ b/rust/Cargo.toml
@@ -1,21 +1,18 @@
[package]
-name = "halt"
+name = "pintos-rs"
version = "0.1.0"
authors = ["Gustav Sörnäs <gustav@sornas.net>"]
edition = "2018"
[lib]
-name = "halt"
+name = "rust"
crate-type = ["staticlib"]
-# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
-
[profile.dev]
panic = "abort"
[profile.release]
panic = "abort"
-lto = true
[dependencies.libc]
version = "0.2"
diff --git a/rust/Makefile b/rust/Makefile
new file mode 100644
index 0000000..23187c9
--- /dev/null
+++ b/rust/Makefile
@@ -0,0 +1,2 @@
+all:
+ cargo rustc -- -C link-arg= -L.
diff --git a/halt/rust-toolchain b/rust/rust-toolchain
index adfa491..adfa491 100644
--- a/halt/rust-toolchain
+++ b/rust/rust-toolchain
diff --git a/halt/src/lib.rs b/rust/src/lib.rs
index 43470b2..43470b2 100644
--- a/halt/src/lib.rs
+++ b/rust/src/lib.rs
diff --git a/src/Makefile.userprog b/src/Makefile.userprog
index f7271fe..3c4d404 100644
--- a/src/Makefile.userprog
+++ b/src/Makefile.userprog
@@ -23,7 +23,7 @@ lib/user_SRC += lib/user/console.c # Console code.
LIB_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(lib_SRC) $(lib/user_SRC)))
LIB_DEP = $(patsubst %.o,%.d,$(LIB_OBJ))
-LIB = lib/user/entry.o libc.a
+LIB = lib/user/entry.o libc.a librust.a
PROGS_SRC = $(foreach prog,$(PROGS),$($(prog)_SRC))
PROGS_OBJ = $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(PROGS_SRC)))
@@ -48,9 +48,13 @@ libc.a: $(LIB_OBJ)
ar r $@ $^
ranlib $@
+librust.a:
+ make -C $(SRCDIR)/../halt all
+ cp $(SRCDIR)/../rust/target/debug/librust.a $@
+
clean::
rm -f $(PROGS) $(PROGS_OBJ) $(PROGS_DEP)
- rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a
+ rm -f $(LIB_DEP) $(LIB_OBJ) lib/user/entry.[do] libc.a librust.a
.PHONY: all clean