forked from lorenzodla/ish
-
Notifications
You must be signed in to change notification settings - Fork 0
/
meson.build
166 lines (139 loc) · 3.81 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
project('ish', 'c',
default_options: ['default_library=static', 'c_std=gnu11', 'jit=true', 'warning_level=2'])
log_on = get_option('log').split()
log_off = get_option('nolog').split()
foreach channel : log_on + log_off
if log_on.contains(channel)
add_project_arguments('-DDEBUG_' + channel + '=1', language: 'c')
else
add_project_arguments('-DDEBUG_' + channel + '=0', language: 'c')
endif
endforeach
add_project_arguments('-DLOG_HANDLER_' + get_option('log_handler').to_upper() + '=1', language: 'c')
if get_option('no_crlf')
add_project_arguments('-DNO_CRLF', language: 'c')
endif
if get_option('jit')
add_project_arguments('-DJIT=1', language: 'c')
endif
add_project_arguments('-Wno-switch', language: 'c')
includes = [include_directories('.')]
cc = meson.get_compiler('c')
threads = dependency('threads')
librt = cc.find_library('rt', required: false)
libm = cc.find_library('m', required: false)
subdir('vdso') # ish depends on the vdso
offsets = custom_target('offsets',
output: 'cpu-offsets.h', input: 'jit/offsets.c', depfile: 'cpu-offsets.h.d',
command: [find_program('tools/staticdefine.sh'), '@OUTDIR@/compile_commands.json', '@INPUT@', '@OUTPUT@', '@DEPFILE@'])
src = [
'kernel/init.c',
'kernel/errno.c',
'kernel/calls.c',
'kernel/user.c',
'kernel/vdso.c', vdso,
'kernel/task.c',
'kernel/group.c',
'kernel/log.c',
'kernel/fork.c',
'kernel/exec.c',
'kernel/exit.c',
'kernel/time.c',
'kernel/mmap.c',
'kernel/uname.c',
'kernel/tls.c',
'kernel/futex.c',
'kernel/getset.c',
'kernel/signal.c',
'kernel/resource.c',
'kernel/random.c',
'kernel/misc.c',
'kernel/eventfd.c',
'kernel/ipc.c',
'kernel/fs.c',
'kernel/fs_info.c',
'fs/mount.c',
'fs/fd.c',
'fs/inode.c',
'fs/stat.c',
'fs/dir.c',
'fs/generic.c',
'fs/path.c',
'fs/real.c',
'fs/fake.c',
'fs/fake-rebuild.c',
'fs/fake-migrate.c',
'fs/proc.c',
'fs/proc/entry.c',
'fs/proc/root.c',
'fs/proc/pid.c',
'fs/adhoc.c',
'fs/sock.c',
'fs/pipe.c',
'fs/sockrestart.c',
'fs/lock.c',
'fs/dev.c',
'fs/mem.c',
'fs/tty.c',
'fs/tty-real.c',
'fs/pty.c',
'fs/poll.c',
'kernel/poll.c',
'kernel/epoll.c',
'util/timer.c',
'util/sync.c',
'util/fifo.c',
'emu/memory.c',
'emu/tlb.c',
'emu/fpu.c',
'emu/sse.c',
'emu/float80.c',
'platform/' + host_machine.system() + '.c',
]
if get_option('jit')
gadgets = 'jit/gadgets-' + host_machine.cpu_family()
src += [
'jit/jit.c',
'jit/gen.c',
'jit/helpers.c',
gadgets+'/entry.S',
gadgets+'/memory.S',
gadgets+'/control.S',
gadgets+'/math.S',
gadgets+'/bits.S',
gadgets+'/string.S',
gadgets+'/misc.S',
offsets,
]
else
src += [
'emu/interp.c',
]
endif
sqlite3 = cc.find_library('sqlite3')
dependencies = [librt, libm, threads, sqlite3]
libish = library('ish', src,
include_directories: includes)
ish = declare_dependency(
link_with: libish,
dependencies: dependencies,
include_directories: includes)
# ptraceomatic et al
subdir('tools')
if not meson.is_cross_build()
executable('ish', ['main.c'], dependencies: ish)
endif
gdb_scripts = ['ish-gdb.gdb']
foreach script : gdb_scripts
custom_target(script,
output: script, input: script,
command: ['ln', '-sf', '@INPUT@', '@OUTPUT@'],
build_by_default: true)
endforeach
if not meson.is_cross_build()
# test for floating point library
float80_test = executable('float80_test', ['emu/float80.c', 'emu/float80-test.c'], dependencies: [libm])
test('float80', float80_test, should_fail: true)
endif
e2e_test = find_program('tests/e2e/e2e.bash')
test('e2e', e2e_test, args: ['-y'], timeout: 120)