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 Binary files a/test/mld/test.o and b/test/mld/test.o differ diff --git a/test/msim/test b/test/msim/test index f81c617..293d241 100644 Binary files a/test/msim/test and b/test/msim/test differ