aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..cafa911
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,29 @@
+SRC_DIR := src
+OBJ_DIR := obj
+BIN_DIR := bin
+
+EXE := $(BIN_DIR)/umami
+SRC := $(wildcard $(SRC_DIR)/*.c)
+OBJ := $(SRC:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)
+
+CFLAGS := -Wall -Iinclude
+LDFLAGS := -Llib
+LDLIBS := -lm
+
+.PHONY: all clean
+
+all: $(EXE)
+
+$(EXE): $(OBJ) | $(BIN_DIR)
+ $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
+ $(CC) $(CFLAGS) -c $< -o $@
+
+$(BIN_DIR) $(OBJ_DIR):
+ mkdir -p $@
+
+clean:
+ @$(RM) -rv $(BIN_DIR) $(OBJ_DIR) result
+
+-include $(OBJ:.o=.d)