import subprocess AddOption( '--target', dest = 'target', type = 'choice', choices = ('i686', 'x86_64'), nargs = 1, action = 'store', default = 'i686' ) target = GetOption('target') env = Environment(tools = ['default', 'compilation_db']) env.Append(CXXFLAGS = ['-ffreestanding', '-fno-exceptions', '-fno-rtti', '-std=c++20']) env.Append(LINKFLAGS = ['-T', 'linker.ld', '-ffreestanding', '-nostdlib']) env.Append(CPPPATH = ['#targets/_any/include', '#bastl/include']) env.Append(CCFLAGS = ['-g', '-O0']) env['KERNEL_SOURCES'] = [] env['KERNEL_DEPENDENCIES'] = [] env = SConscript('bastl/SConscript', exports = 'env') env = SConscript('targets/_any/SConscript', exports = 'env') env = SConscript(f'targets/{target}/SConscript', exports = 'env') prog_os = env.Program( target = 'os.bin', source = env['KERNEL_SOURCES'], LIBS = ['gcc'] ) env.Depends(prog_os, env['KERNEL_DEPENDENCIES']) env.Default(prog_os) comp_db = env.CompilationDatabase(target = '#compile_commands.json') env.Default(comp_db)