-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (35 loc) · 1.03 KB
/
Makefile
File metadata and controls
43 lines (35 loc) · 1.03 KB
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
# SPDX-License-Identifier: GPL-2.0-only
#
# Makefile for RvRun
#
# Copyright (C) 2026 by Diego Evaristo <di.diegoevaristo@gmail.com>
#
PREFIX ?= /usr/local
src = src
headers = include
CC ?= cc
CFLAGS = -Wall -Werror -Wextra -Wconversion
CFLAGS += -std=c11 -pedantic-errors -D_GNU_SOURCE
CFLAGS += -I$(headers)
CFLAGS += -O2 -mtune=native
CFLAGS += -DRVRUN_VERSION_MAJOR=1 -DRVRUN_VERSION_MINOR=1
LDFLAGS = -lm
VPATH = $(src):$(headers)
objs = main.o debug.o config.o memory.o proc.o syscall.o insn.o riscv.o rv_i.o \
rv_m.o rv_f.o Zicsr.o
rvrun: $(objs)
$(CC) $(LDFLAGS) $(CFLAGS) $(objs) -o rvrun
# Copied and slightly modified from the GNU Make manual section 4.14
%.d: %.c $(headers)/opcodes.h
@set -e; rm -f $@; \
$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$;
-include $(objs:.o=.d)
.PHONY: clean install uninstall
clean:
-rm -f *.o *.d* 2>/dev/null || true
install:
install -m755 rvrun $(PREFIX)/bin/rvrun
uninstall:
-@rm -i $(PREFIX)/bin/rvrun || true