summaryrefslogtreecommitdiff
path: root/makefile.mk
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-09 12:41:49 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-09 12:41:49 -0400
commit2ed275821676a0d5baea6c7fd843d71c72c2342c (patch)
tree480297f28e5c42d02a47b3b94027a7abe507d010 /makefile.mk
downloadmips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.gz
mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.bz2
mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.zip
initial mips32 (r2000ish mips32r6) assembler
Diffstat (limited to 'makefile.mk')
-rw-r--r--makefile.mk32
1 files changed, 32 insertions, 0 deletions
diff --git a/makefile.mk b/makefile.mk
new file mode 100644
index 0000000..afcfda7
--- /dev/null
+++ b/makefile.mk
@@ -0,0 +1,32 @@
+
+# needed cflags
+CFLAGS += -std=c2x
+
+# add include directory
+CFLAGS += -isystem ../include
+INCLUDE += ../include
+
+# add lib directory
+SRC += ../lib
+
+H_SRC = $(shell find $(SRC) $(INCLUDE) -type f -name "*.h")
+C_SRC = $(shell find $(SRC) -type f -name "*.c")
+C_OBJ = $(patsubst %.c,$(BIN)/%.o,$(C_SRC))
+
+.PHONY: clean build run
+
+build: $(BIN)/$(OUT)
+
+clean:
+ rm -fr $(BIN)
+
+run: build
+ $(BIN)/$(OUT)
+
+$(C_OBJ): $(BIN)/%.o : %.c
+ @mkdir -p $(@D)
+ $(CC) -c $(CFLAGS) -o $@ $<
+
+$(BIN)/$(OUT): $(C_OBJ) $(H_SRC)
+ @mkdir -p $(@D)
+ $(LD) $(LDFLAGS) -o $(BIN)/$(OUT) $(C_OBJ)