summaryrefslogtreecommitdiff
path: root/src/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'src/makefile')
-rw-r--r--src/makefile29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/makefile b/src/makefile
new file mode 100644
index 0000000..ce91b59
--- /dev/null
+++ b/src/makefile
@@ -0,0 +1,29 @@
+CC = gcc-14
+CFLAGS = -Wall \
+ -Werror \
+ -Wextra \
+ -Wpedantic \
+ -std=c17
+SOURCE_DIR = .
+SOURCES = hello.c io.c
+OBJECT_DIR = object
+OBJECTS = $(SOURCES:%.c=$(OBJECT_DIR)/%.o)
+TARGET = hello
+
+all: $(TARGET)
+
+debug: CFLAGS += -g -O0
+debug: $(TARGET)
+
+clean:
+ rm -rf $(TARGET) $(OBJECT_DIR)
+
+$(TARGET): $(OBJECTS) | $(BIN_DIR)
+ $(CC) $(CFLAGS) -o $@ $^
+
+$(OBJECT_DIR)/%.o: %.c | $(OBJECT_DIR)
+ $(CC) $(CFLAGS) -c $^ -o $@
+
+$(OBJECT_DIR) $(BIN_DIR):
+ mkdir $@
+