38 lines
1.0 KiB
Python

Import('env')
shared_sources = Split('''
src/assert.cpp
src/stdio.cpp
src/stdlib.cpp
src/string.cpp
''')
kernel_sources = shared_sources
env.Append(KERNEL_SOURCES = [env.File(f) for f in kernel_sources])
### Stdlib
stdlib_env = env.Clone()
stdlib_env['AS'] = 'x86_64-baos-elf-as'
stdlib_env['CC'] = 'x86_64-baos-elf-gcc'
stdlib_env['CXX'] = 'x86_64-baos-elf-g++'
stdlib_env['LD'] = 'x86_64-baos-elf-g++'
stdlib_env.Append(CXXFLAGS = ['-fno-exceptions', '-fno-rtti', '-std=c++20'])
stdlib_env.Append(CPPPATH = ['#targets/_any/bastl/include', '#targets/_any/stdlib/include', '#targets/_any/kernel/include'])
stdlib_sources = Split('''
src/crt0.s
''')
for src in shared_sources:
new_src = stdlib_env.File(f'#.stdlib_variant/{stdlib_env.File(src).name}').abspath
stdlib_env.Command(new_src, src, Copy("$TARGET", "$SOURCE"))
stdlib_sources.append(new_src)
lib_stdlib = stdlib_env.StaticLibrary(
target = stdlib_env.File('#stdlib.a'),
source = stdlib_sources
)
stdlib_env.Default(lib_stdlib)
Return('env')