summaryrefslogtreecommitdiff
path: root/meson.build
blob: 76539ce7245472085ffc9f940b9cc9f119156319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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'])