aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..df15ae7
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
+ifeq ($(shell uname -s),Darwin)
+ AFLAGS += -fmacho64
+ LDFLAGS += -lSystem
+ LD = clang
+endif
+ifeq ($(shell uname -s),Linux)
+ AFLAGS += -felf64
+ LD = ld
+endif
+
+OUT_BIN=build
+
+.PHONY: clean $(OUT_BIN)
+
+default: clean $(OUT_BIN)
+
+$(OUT_BIN): main.o
+ $(LD) $(LDFLAGS) -o $@ $^
+
+%.o: %.asm
+ nasm $(AFLAGS) $< -o $@
+
+clean:
+ -rm *.o $(OUT_BIN)