From 0ee22520f50b4f006a554c79dd0e5f1d5d780d4d Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Sun, 7 Jan 2024 20:19:20 +0100 Subject: replace make with meson Signed-off-by: Anna (navi) Figueiredo Gomes --- meson.build | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..76539ce --- /dev/null +++ b/meson.build @@ -0,0 +1,45 @@ +project('nrvn', ['c', 'nasm'], + version : '0.1', + default_options : [ + 'warning_level=3', + 'b_pie=false', + 'b_staticpic=false' + ]) + +if not meson.is_cross_build() + error('must be invoked with "meson setup --cross-file=toolchain.txt"') +endif + +files = [ + 'src/asm/boot.asm', + 'src/asm/long.asm', + 'src/nrvn.c', + 'src/vga.c', + 'src/idt.c', + 'src/mem.c', + 'src/acpi.c', + 'src/ps2.c', + 'src/pic.c', + 'src/memory.c' +] + +ld_args = [ + '-ffreestanding', + '-nostdlib', + '-T', + join_paths(meson.current_source_dir(), 'util', 'linker.ld') +] + +kernel = executable('nrvn', files, + c_args: ['-ffreestanding'], + nasm_args: ['-felf64'], + link_args: ld_args, + include_directories: 'include/') + + +iso = custom_target('iso', + input: [import('fs').copyfile('util/grub.cfg'), kernel], + output: 'nrvn.iso', + command: ['util/build_iso.sh', '@PRIVATE_DIR@', '@INPUT@', '@OUTPUT@']) + +run_target('run', command: [find_program('qemu'), '-cdrom', iso, '-m', '2G']) -- cgit v1.2.3