31 lines
891 B
Python
31 lines
891 B
Python
|
|
import subprocess
|
|
|
|
AddOption(
|
|
'--target',
|
|
dest = 'target',
|
|
type = 'choice',
|
|
choices = ('i686', 'x86_64'),
|
|
nargs = 1,
|
|
action = 'store',
|
|
default = 'x86_64'
|
|
)
|
|
|
|
target = GetOption('target')
|
|
|
|
env = Environment(tools = ['default', 'compilation_db'])
|
|
env.Append(CCFLAGS = ['-g', '-O0', '-fno-stack-protector'])
|
|
env.Append(CPPDEFINES = ['BASTL_EXTENSIONS=1'])
|
|
# env.Append(CCFLAGS = ['-O2'])
|
|
|
|
env['ISO_FILES'] = []
|
|
env = SConscript('targets/_any/SConscript', exports = 'env')
|
|
env = SConscript(f'targets/{target}/SConscript', exports = 'env')
|
|
|
|
comp_db = env.CompilationDatabase(target = '#compile_commands.json')
|
|
env.Default(comp_db)
|
|
|
|
iso_targets = []
|
|
for iso_file in env['ISO_FILES']:
|
|
iso_targets.append(env.Command(f'iso/{iso_file["target"]}', iso_file["source"], Copy("$TARGET", "$SOURCE")))
|
|
env.Command('os.iso', iso_targets, 'grub-mkrescue -o "$TARGET" "iso"') |