@@ -61,20 +61,28 @@ *.64) bin_fmt=elf64;; *) say "cannot determine correct binary format to use for target $target"; exit 1;; esac -# first, we establish the -# parameters of the build -has cc && _cc=cc -has clang && _cc=clang -has gcc && _cc=gcc # prefer gcc -cc=${cc:-$_cc} -has m4 && _m4=m4 -m4=${m4:-$_m4} -has nasm && asm=nasm -has yasm && asm=yasm # prefer yasm -export cc -export m4 +# first, we establish the parameters of the build + +# detect C compiler to use + has cc && _cc=cc + has clang && _cc=clang + has gcc && _cc=gcc # prefer gcc + export cc=${cc:-$_cc} + +# detect m4 implementation to use. TODO: determine if BSD m4 +# is compatible with our macro sources, otherwise we'll need +# to fix that or make gm4 a dep if we can't + has m4 && _m4=m4 + export m4=${m4:-$_m4} + +# pick the assembler to use. long-term, we need to rewrite +# the x86* sources to just use gas, since gas is the only +# OSS assembler that seems to exist for other arches + has nasm && asm=nasm + has yasm && asm=yasm # prefer yasm + export gen=${gen:-gen} library=${library:-static} # {static|shared|both} export verbose=${verbose:-quiet} # {no|quiet|loud} @@ -94,10 +102,10 @@ build_shared_library=yes;; esac check cc "your C compiler of choice" -check asm "an assembler that takes Intel syntax and nasm-style-macros" -check m4 "the path to your m4 installation" +check asm "an assembler that takes Intel syntax and nasm-style macros" +check m4 "the path to your m4 binary" export build=$(global/build-id.sh) if test "$p_headers_errno" = ""; then @@ -275,9 +283,9 @@ report ranlib $to/libk.a fi if test $build_shared_library == yes; then - report ld -r ${rt_objects[@]} -o $to/boot.o + report ld -r ${rt_objects[@]} -o $to/kboot.o report ld -shared ${fn_objects[@]} ${data_objects[@]} -o $to/libk.so fi # fifth pass: compile the executable tools @@ -287,9 +295,9 @@ for exe in $(scan mod/$mod '*.exe.c'); do base="$(basename $exe)" dest="$to/$mod.${base%%.exe.c}" if test $build_shared_library == yes; then - comp_c "$to/boot.o $exe" "$dest" -lk + comp_c "$to/kboot.o $exe" "$dest" -lk else comp_c "$exe" "$dest" -lk fi done