Update compile.pl to support tacle c (no wasm) compilation
This commit is contained in:
+26
-3
@@ -374,9 +374,30 @@ sub compile_c_module {
|
||||
( $target eq 'linux' )
|
||||
? ( $linux_cc, @linux_cflags )
|
||||
: ( $cross_cc, @cross_cflags );
|
||||
|
||||
if ( Util::module_is_tacle($module) ) {
|
||||
my ( $srcs, $inc ) = Util::find_tacle_sources($module);
|
||||
|
||||
# Compile the wrapper separately, so the main can be renamed
|
||||
Util::run( $cc, @flags, "-I$inc", '-c',
|
||||
"targets/wasm-module/$module.cpp",
|
||||
'-o', "$bd/c_module.o" );
|
||||
|
||||
my @objs;
|
||||
for my $src (@$srcs) {
|
||||
( my $obj = $src ) =~ s{.*/}{};
|
||||
$obj =~ s/\.c$/.o/;
|
||||
$obj = "$bd/tacle_$obj";
|
||||
Util::run( $cc, @flags, "-I$inc", '-Dmain=tacle_main_bullshit',
|
||||
'-c', $src, '-o', $obj );
|
||||
push @objs, $obj;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Util::run( $cc, @flags, '-c', "targets/wasm-module/$module.cpp",
|
||||
'-o', "$bd/c_module.o" );
|
||||
}
|
||||
}
|
||||
|
||||
sub compile_c_host {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
@@ -437,17 +458,19 @@ sub link_wasm {
|
||||
|
||||
sub link_c {
|
||||
my ( $module, $bd, $target ) = @_;
|
||||
my @tacle_objs =
|
||||
Util::module_is_tacle($module) ? glob("$bd/tacle_*.o") : ();
|
||||
if ( $target eq 'fail' ) {
|
||||
Util::run(
|
||||
$cross_cc, '-Wl,-T',
|
||||
'targets/linker.ld', "$bd/c_host.o",
|
||||
"$bd/startup.o", "$bd/c_module.o",
|
||||
@cross_ldflags_nowasm, '-o',
|
||||
"$bd/system.elf"
|
||||
@tacle_objs, @cross_ldflags_nowasm,
|
||||
'-o', "$bd/system.elf"
|
||||
);
|
||||
}
|
||||
elsif ( $target eq 'linux' ) {
|
||||
Util::run( $linux_cc, "$bd/c_host.o", "$bd/c_module.o",
|
||||
Util::run( $linux_cc, "$bd/c_host.o", "$bd/c_module.o", @tacle_objs,
|
||||
@linux_ldflags_nowasm, '-o', "$bd/system.elf" );
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user