Rewrite build.rs again

master
WangRunji 7 years ago
parent 21d97418d6
commit 96258c6a0b

@ -31,6 +31,7 @@ endif
ld := $(prefix)ld
objdump := $(prefix)objdump
cc := $(prefix)gcc
.PHONY: all clean run iso kernel build debug_asm
@ -61,7 +62,7 @@ $(kernel): kernel $(rust_os) $(assembly_object_files) $(linker_script)
$(assembly_object_files) $(rust_os)
kernel:
@RUST_TARGET_PATH=$(shell pwd) xargo build --target $(target) --features "$(features)"
@RUST_TARGET_PATH=$(shell pwd) CC=$(cc) xargo build --target $(target) --features "$(features)"
# compile assembly files
build/arch/$(arch)/boot/%.o: $(boot_src)/%.asm

@ -1,16 +1,7 @@
extern crate cc;
use std::process::Command;
fn main() {
let output = Command::new("uname").output()
.expect("failed to get uname");
let compiler = match output.stdout.as_slice() {
b"Darwin\n" => "x86_64-elf-gcc",
b"Linux\n" => "gcc",
_ => panic!("unknown os")
};
cc::Build::new()
.compiler(compiler)
.file("src/arch/x86_64/driver/apic/lapic.c")
.compile("cobj");
}
Loading…
Cancel
Save