From ea9af1577ab8bca1a66f256de626e86580c02eed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20GUEZO?= Date: Sun, 9 Mar 2025 15:02:07 +0100 Subject: [PATCH] chore: Initialize basic targets in Makefile --- .gitignore | 2 ++ Makefile | 34 ++++++++++++++++++++++++++++++++++ src/main.c | 3 +++ 3 files changed, 39 insertions(+) create mode 100644 Makefile create mode 100644 src/main.c diff --git a/.gitignore b/.gitignore index c6127b3..4d3ceeb 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,5 @@ modules.order Module.symvers Mkfile.old dkms.conf + +build \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e779ff6 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +EXE = t3dsr + +INC = include +SRC = src +TST = test +BLD = build + +DEBUG_DIR = $(BLD)/debug + +CC = clang +CFLAGS = -Wall -Wextra -I$(INC) -g + +SRCS = $(shell find $(SRC) -name "*.c") +OBJS = $(SRCS:$(SRC)/%.c=$(DEBUG_DIR)/%.o) + +$(EXE): $(OBJS) | $(DEBUG_DIR) + @$(CC) $^ -o $(BLD)/$@ + +$(DEBUG_DIR): + @mkdir -p $(DEBUG_DIR) + +$(DEBUG_DIR)/%.o: $(SRC)/%.c | $(DEBUG_DIR) + @mkdir -p $(dir $@) + @$(CC) $(CFLAGS) -c $< -o $@ + +clean: + @rm -rf $(BLD) $(EXE) + +run: $(EXE) + @./$(BLD)/$(EXE) + +all: $(EXE) + +.PHONY: all clean run \ No newline at end of file diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e9cdae1 --- /dev/null +++ b/src/main.c @@ -0,0 +1,3 @@ +int main() { + return 0; +} \ No newline at end of file