This repository was archived by the owner on Mar 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +13
-2
lines changed Expand file tree Collapse file tree 5 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ bitflags = "1"
8
8
9
9
[build-dependencies ]
10
10
bindgen = " *"
11
+ cc = " 1.0"
11
12
shlex = " 0.1"
Original file line number Diff line number Diff line change 1
1
extern crate bindgen;
2
+ extern crate cc;
2
3
extern crate shlex;
3
4
4
5
use std:: env;
@@ -66,4 +67,13 @@ fn main() {
66
67
bindings
67
68
. write_to_file ( out_path. join ( "bindings.rs" ) )
68
69
. expect ( "Couldn't write bindings!" ) ;
70
+
71
+ let mut builder = cc:: Build :: new ( ) ;
72
+ println ! ( "cargo:rerun-if-env-changed=CLANG" ) ;
73
+ builder. compiler ( env:: var ( "CLANG" ) . unwrap_or ( "clang" . to_string ( ) ) ) ;
74
+ builder. file ( "src/helpers.c" ) ;
75
+ for arg in shlex:: split ( & output) . unwrap ( ) {
76
+ builder. flag ( & arg) ;
77
+ }
78
+ builder. compile ( "helpers" ) ;
69
79
}
Original file line number Diff line number Diff line change 1
1
obj-m := helloworld.o
2
- helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a ../src/printk_helper.o
2
+ helloworld-objs := target/x86_64-linux-kernel-module/debug/libhello_world.a
3
3
EXTRA_LDFLAGS += --gc-sections --entry=init_module --undefined=cleanup_module
4
4
5
5
all :
File renamed without changes.
Original file line number Diff line number Diff line change 1
1
obj-m := staticfilesystem.o
2
- staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a ../src/printk_helper.o
2
+ staticfilesystem-objs := target/x86_64-linux-kernel-module/debug/libstatic_filesystem.a
3
3
EXTRA_LDFLAGS += --gc-sections --entry=init_module --undefined=cleanup_module
4
4
5
5
all :
You can’t perform that action at this time.
0 commit comments