From e75d6f6b8f4512a5bbfecbfa8c17f0bb687e3d55 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Tue, 24 Dec 2024 21:11:06 -0800 Subject: first commit --- Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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) -- cgit