Syncboot/meson.build

95 lines
2.3 KiB
Meson

project('Syncboot', 'c')
sources = [ \
'src/main.c', 'src/gfx.c', 'src/bootloader.c', 'src/memory.c',
'gnu-efi/lib/misc.c', 'gnu-efi/lib/print.c', 'gnu-efi/lib/smbios.c',
'gnu-efi/lib/sread.c', 'gnu-efi/lib/str.c', 'gnu-efi/lib/boxdraw.c',
'gnu-efi/lib/cmdline.c', 'gnu-efi/lib/console.c', 'gnu-efi/lib/crc.c',
'gnu-efi/lib/data.c', 'gnu-efi/lib/debug.c', 'gnu-efi/lib/dpath.c',
'gnu-efi/lib/error.c', 'gnu-efi/lib/event.c', 'gnu-efi/lib/exit.c',
'gnu-efi/lib/guid.c', 'gnu-efi/lib/hand.c', 'gnu-efi/lib/hw.c',
'gnu-efi/lib/init.c', 'gnu-efi/lib/lock.c', 'gnu-efi/lib/x86_64/callwrap.c',
'gnu-efi/lib/x86_64/efi_stub.S', 'gnu-efi/lib/x86_64/initplat.c',
'gnu-efi/lib/x86_64/math.c', 'gnu-efi/lib/x86_64/setjmp.S',
'gnu-efi/lib/runtime/efirtlib.c', 'gnu-efi/lib/runtime/rtdata.c',
'gnu-efi/lib/runtime/rtlock.c', 'gnu-efi/lib/runtime/rtstr.c',
'gnu-efi/lib/runtime/vm.c'
]
include_dirs = [
'inc',
'gnu-efi/inc',
'gnu-efi/inc/x86_64',
'gnu-efi/inc/protocol',
'gnu-efi/lib'
]
c_arguments = [
'-ffreestanding', '-fpic', '-fshort-wchar', '-fno-stack-protector', '-fno-stack-check',
'-fno-strict-aliasing', '-fno-merge-all-constants', '-m64', '-mno-red-zone',
'-DGNU_EFI_USE_MS_ABI', '-maccumulate-outgoing-args', '--std=c11',
'-Og', '-g3', '-Wall', '-Wextra', '-Wdouble-promotion', '-Wpedantic', '-fmessage-length=0', '-MMD', '-MP'
]
# f'-Wa,-adghlmns={line}.out',
# f'-MT{line}.o',
link_arguments = [
'-nostdlib', '-Wl,--warn-common', '-Wl,--no-undefined', '-Wl,-dll',
'-Wl,--subsystem,10', '-e', 'efi_main', '-Wl,-Map=output.map'
]
lib = shared_library('BOOTX64',
sources,
include_directories: include_dirs,
c_args:c_arguments,
link_args: link_arguments,
name_prefix: '',
name_suffix: 'EFI',
)
meson.add_install_script('scripts/install.py')
objcopy = find_program('objcopy')
split_debug = custom_target(
'split_debug',
input: lib,
output: 'BOOTX64.debug',
build_by_default: true,
command: [
objcopy, '--only-keep-debug', '@INPUT@', '@OUTPUT@'
],
depends: [
lib
]
)
strip_debug = run_target(
'strip_debug',
command: [
objcopy, '--strip-debug', lib
]
)
link_debug = run_target(
'link_debug',
command: [
objcopy, '--add-gnu-debuglink=' + split_debug.full_path(), lib
],
depends : [
split_debug
]
)
run_target(
'run',
command: [
'scripts/run.py'
]
)