This repository was archived by the owner on Mar 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
48 lines (35 loc) · 1.33 KB
/
makefile
File metadata and controls
48 lines (35 loc) · 1.33 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
44
45
46
47
48
BUILDDIR = build
SRCDIR = .
SRCFILES := $(shell find ${SRCDIR} -type f -name "*.cpp" -print)
OBJ := $(SRCFILES:%.cpp=%.o)
OPTIMIZATIONLEVEL = 0
# TODO: sse and sse2 and mmx
CXXFLAGS := -std=c++20 -Wall -Wextra -O${OPTIMIZATIONLEVEL}
LDFLAGS = -macosx_version_min 12.0 -lSystem -syslibroot `xcrun -sdk macosx --show-sdk-path` -arch arm64
TARGET = ${BUILDDIR}/machine.bin
all: start $(TARGET)
@echo ' '"Build successful.\n"
start:
@echo ' '"\n\n\033[1;2;32m--------------- NEW BUILD ---------------\033[m\n\n"
@mkdir -p ${BUILDDIR}
$(TARGET): $(OBJ)
@echo ' '"[MSG] - OBJ build successful"
@echo ' '[LNK] ' > ' ${TARGET}
@g++ $(shell ls ${BUILDDIR}/*.o) -o ${TARGET}
@echo ' '"[MSG] - ""Final size: $$(du -sh ${TARGET} | cut -c -4)\n"
%.o: %.cpp
@echo ' '"[CPP] > " $(@F)
@${CXX} $(CXXFLAGS) -c $< -o ${BUILDDIR}/$(@F)
run:
@echo ' '"[MSG] - ""Running...\n"
@build/machine.bin build/payload.elf
test:
riscv64-unknown-elf-g++ -ffreestanding -MD -fno-omit-frame-pointer -gdwarf-2 -march=rv64imad -fno-common -nostdlib -mno-relax -T ../machine-tests/common.ld ../machine-tests/test.cpp -o build/payload.elf
riscv64-unknown-elf-objdump -S build/payload.elf > build/payload.asm
.PHONY: run-update
run-update: all run
.PHONY: test-update
test-update: all test run
.PHONY: clean
clean:
${RM} -r ${BUILDDIR}/*