Convert the Makefile to Cake.

This has been planned for a while.
This commit is contained in:
ticki 2016-08-14 18:40:34 +02:00
parent 938b1a73a4
commit 7b8ba1a118
3 changed files with 41 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/// Memcpy
/// Copy memory.
///
/// Copy N bytes of memory from one location to another.
#[no_mangle]
@ -12,7 +12,7 @@ pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8
dest
}
/// Memmove
/// Copy (possibly overlapping) memory.
///
/// Copy N bytes of memory from src to dest. The memory areas may overlap.
#[no_mangle]
@ -35,7 +35,7 @@ pub unsafe extern fn memmove(dest: *mut u8, src: *const u8,
dest
}
/// Memset
/// Set memory.
///
/// Fill a block of memory with a specified value.
#[no_mangle]
@ -49,7 +49,7 @@ pub unsafe extern fn memset(s: *mut u8, c: i32, n: usize) -> *mut u8 {
s
}
/// Memcmp
/// Compare memory.
///
/// Compare two blocks of memory.
#[no_mangle]

36
src/cakefile.rs Normal file
View file

@ -0,0 +1,36 @@
#[macro_use]
extern crate cake;
const QEMU: &'static str = "qemu-system-x86_64";
const LS_FLAGS: &'static [&'static str] = &["-a", "/"];
build! {
// ---- COMMANDS ----
start(harddrive) => {},
list(kernel_list) => {},
run(bochs) => {},
clean() => cmd!("rm", "-rf", "build/*"),
// ---- RECIPES ----
bochs(harddrive) => cmd!("bochs", "-f", "bochs.x86_64"),
qemu(harddrive) => cmd!(QEMU,
"-serial", "mon:stdio",
"-drive", "file=build/harddrive.bin,format=raw,index=0,media=disk"),
libkernel() => cmd!("cargo", "rustc", "--", "-C", "lto"),
kernel(libkernel) => cmd!("ld",
"-m", "elf_x86_64",
"--gc-sections",
"-z", "max-page-size=0x1000",
"-T bootloader/x86/kernel.ld",
"-o", "build/kernel.in", "build/libkernel.a"),
kernel_list(kernel) => cmd!("objdump",
"-C", "-M", "intel",
"-D", "build/kernel.bin",
">", "build/kernel.list"),
harddrive(kernel) => cmd!("nasm",
"-f", "bin",
"-o", "build/harddrive.bin",
"-D", "ARCH_x86_64", "-ibootloader/x86/", "-ibuild/",
"bootloader/x86/harddrive.asm"),
}

View file

@ -6,6 +6,7 @@
/// also stripping the scheme identifier of paths if necessary.
pub trait Scheme {
/// Open the file at `path` with `flags`.
///
/// Returns a file descriptor or an error
fn open(path: &str, flags: usize) -> Result<usize>;
}