This is the first of two rather big changes to clean up includes throughout the project. In this commit, the implicit semi-dependency on libc that bonnibel adds to every module is removed. Previously, I was sloppy with includes of libc headers and include directory order. Now, the freestanding headers from libc are split out into libc_free, and an implicit real dependency is added onto this module, unless `no_libc` is set to `True`. The full libc needs to be explicitly specified as a dependency to be used. Several things needed to change in order to do this: - Many places use `memset` or `memcpy` that cannot depend on libc. The kernel has basic implementations of them itself for this reason. Now those functions are moved into the lower-level `j6/memutils.h`, and libc merely references them. Other modules are now free to reference those functions from libj6 instead. - The kernel's `assert.h` was renamed kassert.h (matching its `kassert` function) so that the new `util/assert.h` can use `__has_include` to detect it and make sure the `assert` macro is usable in libutil code. - Several implementation header files under `__libj6/` also moved under the new libc_free. - A new `include_phase` property has been added to modules for Bonnibel, which can be "normal" (default) or "late" which uses `-idirafter` instead of `-I` for includes. - Since `<utility>` and `<new>` are not freestanding, implementations of `remove_reference`, `forward`, `move`, and `swap` were added to the `util` namespace to replace those from `std`, and `util/new.h` was added to declare `operator new` and `operator delete`.
86 lines
2.2 KiB
Plaintext
86 lines
2.2 KiB
Plaintext
# This file is automatically generated by bonnibel
|
|
|
|
rule compile.c
|
|
command = $cc -MMD -MF $out.d $cflags $ccflags -o $out -c $in
|
|
description = Compiling [$target]:$name
|
|
depfile = $out.d
|
|
deps = gcc
|
|
|
|
rule dump_c_defs
|
|
command = echo | $cc $ccflags $cflags -dM -E - > $out
|
|
description = Dumping C defines for $target
|
|
|
|
rule dump_c_run
|
|
command = echo '#!/bin/bash' > $out; echo '$cc $ccflags $cflags $$*' >> $
|
|
$out; chmod a+x $out
|
|
description = Dumping C arguments for $target
|
|
|
|
rule compile.cpp
|
|
command = $cxx -MMD -MF $out.d $cxxflags $ccflags -o $out -c $in
|
|
description = Compiling [$target]:$name
|
|
depfile = $out.d
|
|
deps = gcc
|
|
|
|
rule dump_cpp_defs
|
|
command = echo | $cxx -x c++ $ccflags $cxxflags -dM -E - > $out
|
|
description = Dumping C++ defines for $target
|
|
|
|
rule dump_cpp_run
|
|
command = echo '#!/bin/bash' > $out; echo '$cxx $ccflags $cxxflags $$*' $
|
|
>> $out; chmod a+x $out
|
|
description = Dumping C++ arguments for $target
|
|
|
|
rule compile.s
|
|
command = $nasm -o $out -felf64 -MD $out.d $asflags $in
|
|
description = Assembling [$target]:$name
|
|
depfile = $out.d
|
|
deps = gcc
|
|
|
|
rule parse.cog
|
|
command = cog -o $out -d -D target=$target $cogflags $in
|
|
description = Parsing [$target]:$name
|
|
|
|
rule exe
|
|
command = $ld $ldflags -o $out $in $libs
|
|
description = Linking $name
|
|
|
|
rule lib
|
|
command = $ar qcs $out $in
|
|
description = Archiving [$target]:$name
|
|
|
|
rule cp
|
|
command = cp $in $out
|
|
description = Copying [$target]:$name
|
|
|
|
rule dump
|
|
command = objdump -DSC -M intel $in > $out
|
|
description = Dumping decompiled $name
|
|
|
|
rule makest
|
|
description = Making symbol table
|
|
command = nm -n -S --demangle $in | ${source_root}/scripts/build_symbol_table.py $out
|
|
|
|
rule makeinitrd
|
|
description = Creating $name
|
|
command = ${source_root}/scripts/mkj6romfs.py -c $format $in $out
|
|
|
|
rule makefat
|
|
description = Creating $name
|
|
command = $
|
|
cp $in $out; $
|
|
mcopy -s -D o -i $out@@1M ${build_root}/fatroot/* ::/
|
|
|
|
rule strip
|
|
description = Stripping $name
|
|
command = $
|
|
cp $in $out; $
|
|
objcopy --only-keep-debug $out $debug; $
|
|
strip --discard-all -g $out; $
|
|
objcopy --add-gnu-debuglink=$debug $out
|
|
|
|
rule touch
|
|
command = touch $out
|
|
|
|
rule compdb
|
|
command = ninja -t compdb > $out
|