From 7a19179b0f0e22a372eacb791d2ac86155da9e11 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Sun, 22 Sep 2024 23:41:30 -0400 Subject: [PATCH] add global makefile, update tests --- Makefile | 31 +++++++++++++++++++++++++++++++ compile_flags.txt | 1 + config.mk | 2 ++ test/masm/test.asm | 2 -- test/mld/test.o | Bin 5442 -> 5426 bytes test/msim/test | Bin 5395 -> 9591 bytes 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 Makefile 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 c0a5e03c66c52628415201cd81a9d985e579ddeb..7cf14c0a5da8d72487b0f0f4d376e818d5d3284f 100644 GIT binary patch delta 200 zcmX@4wMlD&GNaT+6+K2quF1iS%97k%3=nXEfq{bs%6`DWz&*L2F*u1ID$8iVz`zTY zWprU+;DoVL7#IX$YBG@66$}glFf|3=nXEfq|0+%6`DWz%#j@F*r#8D$8iVz`zHU zWprU+;DWJJ7#M_LYBG@66$}i5Ff|+}_1SGv1K%77%=&gh%%$YANPZwE+vgu7ZAzOo z_JMpxAZ_M74{>1L&b~LhJL|6hCS|8PHa`GHK$MgeR3SWE;uQ7u==SOtFeGY#m9YT= zpQO-;jz}h6z=YP8z#xq z!y-@eBAY$}@hmGc#KnA7Al9DqTd&WOr-HsM`ix{Yc>7#|U*(k4t|*cezRnizB5VPIecVg}ZY6Z-ilZcx}P zFL0A_;!5tx(n<-8tdnz;?oQ5B-p#|Hmy%eL$e>q}T2V6DMWv}8qz4KFU<_U$g9*lA zU=aKOG&=yuXMu__0%?$9Q6OdpVg(=u0$~Rru?NJ00+2cokOg97b$@_-b&v!D0~eSC GD+B;CIvqm*