summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-22 23:41:30 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-22 23:41:30 -0400
commit7a19179b0f0e22a372eacb791d2ac86155da9e11 (patch)
tree4edc25ca6ca37b4a68e6d5c53fcf447777141699
parentmsim stub (diff)
downloadmips-7a19179b0f0e22a372eacb791d2ac86155da9e11.tar.gz
mips-7a19179b0f0e22a372eacb791d2ac86155da9e11.tar.bz2
mips-7a19179b0f0e22a372eacb791d2ac86155da9e11.zip
add global makefile, update tests
-rw-r--r--Makefile31
-rw-r--r--compile_flags.txt1
-rw-r--r--config.mk2
-rw-r--r--test/masm/test.asm2
-rw-r--r--test/mld/test.obin5442 -> 5426 bytes
-rw-r--r--test/msim/testbin5395 -> 9591 bytes
6 files changed, 34 insertions, 2 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..5ed94e2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,31 @@
+include config.mk
+
+.PHONY: build clean install uninstall masm mld msim
+
+build: masm mld msim
+ ./bin/masm/masm -o ./bin/runtime.o ./lib/runtime.asm
+
+clean:
+ rm -fr ./bin
+
+install:
+ install -m 755 -D -t $(PREFIX)/bin ./bin/masm/masm
+ install -m 755 -D -t $(PREFIX)/bin ./bin/mld/mld
+ install -m 755 -D -t $(PREFIX)/bin ./bin/msim/msim
+ install -m 444 -D -t $(PREFIX)/lib/mips ./bin/runtime.o
+
+uninstall:
+ rm $(PREFIX)/bin/masm
+ rm $(PREFIX)/bin/mld
+ rm $(PREFIX)/bin/msim
+ rm $(PREFIX)/lib/mips/runtime.o
+ rmdir $(PREFIX)/lib/mips
+
+masm:
+ make -C ./masm build
+
+mld:
+ make -C ./mld build
+
+msim:
+ make -C ./msim build
diff --git a/compile_flags.txt b/compile_flags.txt
index c36adb4..a3db3de 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -5,3 +5,4 @@
-pedantic
-Wno-gnu-binary-literal
-Iinclude
+-DPREFIX=/usr/local
diff --git a/config.mk b/config.mk
index 4586fb9..dcc3bcf 100644
--- a/config.mk
+++ b/config.mk
@@ -8,6 +8,8 @@ CFLAGS += -Wall -Wextra -pedantic
CFLAGS += -Wno-initializer-overrides
CFLAGS += -O0 -g
+PREFIX=/usr/local
+
# ======================== CONFIG OPTIONS ==
#
# MAX LEX LENGTH
diff --git a/test/masm/test.asm b/test/masm/test.asm
index d70f3e7..b099c2e 100644
--- a/test/masm/test.asm
+++ b/test/masm/test.asm
@@ -18,7 +18,6 @@ null:
.text
.align 2
.globl main
-.globl _start
# init the heap
heap_init:
@@ -204,7 +203,6 @@ realloc_free:
jr $ra
-_start:
main:
# push return address
addi $sp, $sp, -4
diff --git a/test/mld/test.o b/test/mld/test.o
index c0a5e03..7cf14c0 100644
--- a/test/mld/test.o
+++ b/test/mld/test.o
Binary files differ
diff --git a/test/msim/test b/test/msim/test
index f81c617..293d241 100644
--- a/test/msim/test
+++ b/test/msim/test
Binary files differ