@@ -149,9 +149,9 @@ fi if test "$debug" = yes; then local dflag="-g dwarf2" fi - report $asm $flags $dflag "-f$bin_fmt" -i "$gen" -i "$PWD" "$src" -o "$output"; + report $asm $flags $dflag "-f$bin_fmt" -I "$gen" -I "$PWD" -I "arch/$target" "$src" -o "$output"; } comp_co() { comp_c $1 $2 "-c -fPIC"; } comp_c(){ local src=$1 @@ -168,11 +168,11 @@ else local dflag="-O4" fi if test "$assembly" = yes; then - report $cc $src $3 $dflag -std=c11 -isystem "$to" -isystem "$gen" -isystem "arch/" -ffreestanding -nostdlib "-L$to" -masm=intel -fverbose-asm -S "-o$output.s" + report $cc $src $3 $dflag -std=c11 -isystem "$to" -isystem "$gen" -isystem "arch/$target" -isystem "$PWD" -ffreestanding -nostdlib "-L$to" -masm=intel -fverbose-asm -S "-o$output.s" else - report $cc $src $3 $dflag -std=c11 -isystem "$to" -isystem "$gen" -isystem "arch/" -ffreestanding -nostdlib "-L$to" "-o$output" + report $cc $src $3 $dflag -std=c11 -isystem "$to" -isystem "$gen" -isystem "arch/$target" -isystem "$PWD" -ffreestanding -nostdlib "-L$to" "-o$output" fi } say "commencing libk build $build at $(timestamp)" @@ -182,39 +182,8 @@ mkdir -p $gen report $cc -D_emit_m4_include arch/typesize.c -o $gen/typesize $gen/typesize > gen/typesize.m -# generate syscall tables -if test $posix = yes; then - # on posix, we simply abuse CPP to garner a list of syscalls; - # the file arch/posix/syscalls contains a list of syscalls - # we wish to import; we use sed to transform this into a form - # that cpp will fill out for us, producing a table that the - # awk scripts can handle and turn into a list of constants. - echo '#include ' > $gen/system_calls.t.1 # this is the magic part - cat arch/posix/syscalls > $gen/system_calls.t.2 - sed -e 's;^\(.*\)$;\1 SYS_\1;' -i $gen/system_calls.t.2 - cat $gen/system_calls.t.1 $gen/system_calls.t.2 | cpp -P >$gen/system_calls.tbl - - # generate errno tables the same way - echo '#include ' > $gen/error_codes.t.1 # this is the magic part - cat arch/posix/errnos > $gen/error_codes.t.2 - sed -e 's;^\(.*\)$;k_platform_error_\1 \1;' -i $gen/error_codes.t.2 - cat $gen/error_codes.t.1 $gen/error_codes.t.2 | cpp -P | grep "^k_platform_error" >$gen/error_codes.tbl # haaaack -else - case $os in - *) noimpl 'system call table generation';; - esac -fi - -# take the OS-specific system call tables that have been prepared -# for us above and feed them into awk scripts to generate C headers -awk -f arch/syscall.awk -v out=s <$gen/system_calls.tbl>$gen/system_calls.s -awk -f arch/syscall.awk -v out=h <$gen/system_calls.tbl>$gen/system_calls.h - -# do the same with our error codes table -awk -f arch/errtbl.awk <$gen/error_codes.tbl >$gen/error_table.h - # generate symbol tables for error handling functions mkdir -p "$to/k" awk -f global/gen-conds.awk $to/k/internal.egroup.h awk -f global/gen-ident.awk $gen/internal.ident.c