riscv/
.clang-format
570 B
.gitignore
5 B
.gitsigners
112 B
LICENSE
1.1 KiB
Makefile
1.1 KiB
README
3.3 KiB
color.h
567 B
emulator.c
79.7 KiB
io.c
1.1 KiB
io.h
444 B
jit.c
32.6 KiB
jit.h
5.0 KiB
riscv.c
12.0 KiB
riscv.h
12.0 KiB
types.h
1.0 KiB
Makefile
raw
| 1 | # Builds the RISC-V emulator. |
| 2 | |
| 3 | PREFIX ?= $(HOME)/bin |
| 4 | CC := clang |
| 5 | CFLAGS := -fvisibility=hidden -std=c99 -O3 -g \ |
| 6 | -Wall -Wextra -Wpedantic \ |
| 7 | -Wformat=2 -Wformat-security \ |
| 8 | -Wnull-dereference \ |
| 9 | -Wno-format-nonliteral \ |
| 10 | -Wcast-align \ |
| 11 | -Wunused -Wuninitialized \ |
| 12 | -Wmissing-field-initializers \ |
| 13 | -fno-common -fstack-protector-all \ |
| 14 | -mcmodel=medium \ |
| 15 | -march=native -flto |
| 16 | LDFLAGS := -fuse-ld=lld -Wl,-z,stack-size=33554432 |
| 17 | EMULATOR_SRCS := emulator.c jit.c riscv/debug.c io.c riscv.c |
| 18 | |
| 19 | default: bin/emulator |
| 20 | |
| 21 | bin/emulator: $(EMULATOR_SRCS) jit.h color.h types.h io.h riscv.h riscv/debug.h |
| 22 | @echo "cc emulator => $@" |
| 23 | @mkdir -p bin |
| 24 | @$(CC) $(CFLAGS) $(LDFLAGS) $(EMULATOR_SRCS) -o $@ |
| 25 | |
| 26 | install: bin/emulator |
| 27 | @echo "copy bin/emulator => $(PREFIX)/emulator" |
| 28 | @mkdir -p $(PREFIX) |
| 29 | @cp bin/emulator $(PREFIX)/emulator |
| 30 | |
| 31 | fmt: |
| 32 | git ls-files "*.c" "*.h" | xargs clang-format -i |
| 33 | |
| 34 | clean: |
| 35 | @rm -f bin/emulator |
| 36 | |
| 37 | .PHONY: default clean install |
| 38 | .SUFFIXES: |
| 39 | .DELETE_ON_ERROR: |
| 40 | .SILENT: |