-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
107 lines (98 loc) · 2.21 KB
/
meson.build
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
project('loader', 'c')
warning_level = 3
strip = false
c_std = 'gnu11'
include_dir = include_directories('include')
yasm = find_program('yasm', required: true)
asm_gen = generator(yasm, output: '@BASENAME@.o', arguments: meson.get_cross_property('asm_args') + ['@INPUT@', '-o', '@OUTPUT@'])
asm_src = files('cpu/msr.asm', 'cpu/cr.asm', 'elf/elf.asm')
asm_obj = []
foreach f : asm_src
asm_obj += asm_gen.process(f)
endforeach
c_src = files(
'boot/framebuffer.c',
'boot/image.c',
'boot/memory_map.c',
'boot/rsdp.c',
'elf/elf.c',
'fs/open.c',
'fs/read.c',
'fs/utils.c',
'lib/stdlib/free.c',
'lib/stdlib/malloc.c',
'lib/string/memcmp.c',
'lib/string/memcpy.c',
'lib/string/memset.c',
'lib/string/strlen.c',
'lib/string/strncmp.c',
'lib/vcbprintf.c',
'loader.c',
'loader/kernel.c',
'loader/paging.c',
'loader/parse.c',
'net/bufpool.c',
'net/eth.c',
'net/icmp6.c',
'net/ip6.c',
'net/net.c',
'net/netboot.c',
'net/udp6.c',
'net/util.c',
'print.c',
'uefi/device-path.c',
'uefi/driver.c',
'uefi/error.c',
'uefi/guid.c',
'uefi/init.c',
'uefi/io.c',
'uefi/ucs2.c',
'uefi/util.c',
)
c_args = ['-target', 'x86_64-pc-win32-coff',
'-Wbad-function-cast',
'-Wconversion',
'-Wformat=2',
'-Wformat-security',
'-Winit-self',
'-Wparentheses',
'-Winline',
'-Wmissing-braces',
'-Wmissing-declarations',
'-Wmissing-field-initializers',
'-Wmissing-prototypes',
'-Wnested-externs',
'-Wpointer-arith',
'-Wredundant-decls',
'-Wshadow',
'-Wstrict-prototypes',
'-Wswitch-default',
'-Wswitch-enum',
'-Wuninitialized',
'-Wunreachable-code',
'-Wunused',
'-Wwrite-strings',
'-Wno-unreachable-code',
'-mno-red-zone',
'-ffreestanding',
'-fno-stack-protector',
'-mno-mmx',
'-mno-sse',
'-mno-sse2',
'-DVINEYARD',
'-DSTACK=0xFFFFFE0000000000',
'-DSTACK_SIZE=0x21000',
'-DVINEYARD_LOADER', ]
# we need this fake library to compile our C sources
fake_lib = static_library('fakeloader', c_src, c_args: c_args, include_directories: include_dir, pic: false)
# specifying a linker in a cross-file doesn't really work here
custom_target('bootx64.efi',
output: 'bootx64.efi',
input: [fake_lib.extract_all_objects(), asm_obj],
command: [
'lld-link',
meson.get_cross_property('ld_args'),
'@INPUT@',
'-out:@OUTPUT@'
],
install: true, install_dir: '')