aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 26 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8c7470c
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,26 @@
+CFLAGS := -Isrc -MMD -MP -Wall -Wextra
+LDFLAGS :=
+
+TARGET = build/bfc
+
+TARGET_SRC := $(shell find src -name "*.c")
+TARGET_OBJ := $(patsubst src/%.c, build/%.o, $(TARGET_SRC))
+TARGET_DEP := $(patsubst build/%.o, build/%.d, $(TARGET_OBJ))
+
+all: build $(TARGET)
+
+build:
+ mkdir -p $(sort $(dir $(TARGET_OBJ)))
+
+$(TARGET): $(TARGET_OBJ)
+ $(CC) $(LDFLAGS) $(TARGET_OBJ) -o $@
+
+-include $(TARGET_DEP)
+
+build/%.o: src/%.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+clean:
+ rm -rf build
+
+.PHONY: build clean