mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 12:16:31 +00:00
使用kernel-build脚本来编译所有的asm文件 (#445)
This commit is contained in:
@ -15,6 +15,9 @@ pub(super) trait CFilesArch {
|
||||
fn setup_global_include_dir(&self, c: &mut Build);
|
||||
/// 设置需要编译的架构相关的文件
|
||||
fn setup_files(&self, c: &mut Build, files: &mut Vec<PathBuf>);
|
||||
|
||||
/// 设置架构相关的全局编译标志
|
||||
fn setup_global_flags(&self, c: &mut Build);
|
||||
}
|
||||
|
||||
/// 获取当前的架构;
|
||||
|
@ -25,5 +25,14 @@ impl CFilesArch for X86_64CFilesArch {
|
||||
Some("c"),
|
||||
true,
|
||||
));
|
||||
|
||||
// setup asm files
|
||||
files.push(PathBuf::from("src/arch/x86_64/asm/head.S"));
|
||||
files.push(PathBuf::from("src/arch/x86_64/asm/entry.S"));
|
||||
files.push(PathBuf::from("src/arch/x86_64/asm/apu_boot.S"));
|
||||
}
|
||||
|
||||
fn setup_global_flags(&self, c: &mut Build) {
|
||||
c.asm_flag("-m64");
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ pub struct CFilesBuilder;
|
||||
impl CFilesBuilder {
|
||||
pub fn build() {
|
||||
let mut c = cc::Build::new();
|
||||
|
||||
Self::setup_global_flags(&mut c);
|
||||
Self::setup_defines(&mut c);
|
||||
Self::setup_global_include_dir(&mut c);
|
||||
@ -31,6 +32,9 @@ impl CFilesBuilder {
|
||||
.flag("-Wno-unused-parameter")
|
||||
.flag("-m64")
|
||||
.flag("-O1");
|
||||
|
||||
// set Arch-specific flags
|
||||
current_cfiles_arch().setup_global_flags(c);
|
||||
}
|
||||
|
||||
fn setup_defines(c: &mut Build) {
|
||||
|
Reference in New Issue
Block a user