main
build.ninja
1# i know this is a ninja file, but you're allowed to edit it.
2# you can also pass things on the command line if you like, eg
3#
4# CC=clang ninja
5
6cc = $${CC:-cc}
7cflags = $${CFLAGS:--O2 -flto -std=gnu11 -Wreturn-type -Werror=return-type -Werror=implicit-function-declaration -Wno-unused-value -m64 -pthread -DDATA_PATH=\"$${DATA_PATH:-$${PREFIX:-/usr}/share/blastem}\" $$(pkg-config --cflags wayland-client)}
8ldflags = $${LDFLAGS:--O2 -flto -m64 -pthread}
9libs = $${LIBS:--lm $$(pkg-config --libs wayland-client) -lasound -lz}
10prefix = $${PREFIX:-/usr}
11destdir = $${DESTDIR:-}
12bindir = $${BINDIR:-$${DESTDIR:-}$${PREFIX:-/usr}/bin}
13datadir = $${DESTDIR:-}$${DATA_PATH:-$${PREFIX:-/usr}/share/blastem}
14xdg_shell_xml = $${XDG_SHELL_XML:-/usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml}
15
16rule wayland_client_header
17 command = wayland-scanner client-header $xdg_shell_xml $out
18 description = wl $out
19
20rule wayland_private_code
21 command = wayland-scanner private-code $xdg_shell_xml $out
22 description = wl $out
23
24rule cc
25 command = $cc $cflags -MMD -MF $out.d -c -o $out $in
26 deps = gcc
27 depfile = $out.d
28 description = cc $out
29
30rule link
31 command = $cc $ldflags -o $out $in $libs
32 description = link $out
33
34rule install
35 command = mkdir -p $outdir && cp $in $outdir/
36 description = install $in
37
38build xdg-shell-client-protocol.h: wayland_client_header
39build xdg-shell-protocol.c: wayland_private_code
40
41build blastem.o: cc blastem.c
42build system.o: cc system.c
43build genesis.o: cc genesis.c
44build debug.o: cc debug.c
45build gdb_remote.o: cc gdb_remote.c
46build vdp.o: cc vdp.c
47build ppm.o: cc ppm.c
48build controller_info.o: cc controller_info.c
49build render_wayland.o: cc render_wayland.c | xdg-shell-client-protocol.h
50build xdg-shell-protocol.o: cc xdg-shell-protocol.c | xdg-shell-client-protocol.h
51build png.o: cc png.c
52build io.o: cc io.c
53build romdb.o: cc romdb.c
54build hash.o: cc hash.c
55build menu.o: cc menu.c
56build xband.o: cc xband.c
57build realtec.o: cc realtec.c
58build i2c.o: cc i2c.c
59build nor.o: cc nor.c
60build sega_mapper.o: cc sega_mapper.c
61build multi_game.o: cc multi_game.c
62build megawifi.o: cc megawifi.c
63build net.o: cc net.c
64build serialize.o: cc serialize.c
65build terminal.o: cc terminal.c
66build config.o: cc config.c
67build tern.o: cc tern.c
68build util.o: cc util.c
69build paths.o: cc paths.c
70build gst.o: cc gst.c
71build 68kinst.o: cc 68kinst.c
72build m68k_core.o: cc m68k_core.c
73build m68k_core_x86.o: cc m68k_core_x86.c
74build gen.o: cc gen.c
75build backend.o: cc backend.c
76build mem.o: cc mem.c
77build arena.o: cc arena.c
78build gen_x86.o: cc gen_x86.c
79build backend_x86.o: cc backend_x86.c
80build ym2612.o: cc ym2612.c
81build psg.o: cc psg.c
82build wave.o: cc wave.c
83build saves.o: cc saves.c
84build zip.o: cc zip.c
85build bindings.o: cc bindings.c
86build jcart.o: cc jcart.c
87build sms.o: cc sms.c
88build z80inst.o: cc z80inst.c
89build z80_to_x86.o: cc z80_to_x86.c
90
91build blastem: link blastem.o system.o genesis.o debug.o gdb_remote.o vdp.o ppm.o controller_info.o render_wayland.o xdg-shell-protocol.o png.o io.o romdb.o hash.o menu.o xband.o realtec.o i2c.o nor.o sega_mapper.o multi_game.o megawifi.o net.o serialize.o terminal.o config.o tern.o util.o paths.o gst.o 68kinst.o m68k_core.o m68k_core_x86.o gen.o backend.o mem.o arena.o gen_x86.o backend_x86.o ym2612.o psg.o wave.o saves.o zip.o bindings.o jcart.o sms.o z80inst.o z80_to_x86.o
92build all: phony blastem
93build install-blastem: install blastem
94 outdir = $bindir
95build install-default-config: install default.cfg
96 outdir = $datadir
97build install-rom-db: install rom.db
98 outdir = $datadir
99build install: phony install-blastem install-default-config install-rom-db
100
101default all