From 9e0ed163f82623ba4e777c37a485e314946545c9 Mon Sep 17 00:00:00 2001 From: go38coz Date: Fri, 26 Jun 2026 19:19:00 +0200 Subject: [PATCH] Changed makefile to compile all .c and .h files in the directory and .gitignore to ignore generated .o and .d files --- .gitignore | 4 +++- Implementierung/Makefile | 24 ++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index b14960b..51b09c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vscode *.bmp -tricorn \ No newline at end of file +tricorn +*.o +*.d \ No newline at end of file diff --git a/Implementierung/Makefile b/Implementierung/Makefile index f8d0de5..321ec74 100644 --- a/Implementierung/Makefile +++ b/Implementierung/Makefile @@ -1,12 +1,24 @@ -CFLAGS= -Wall -Wextra -O3 -LDLIBS = -lm CC = gcc +CFLAGS = -Wall -Wextra -O3 -std=c17 +DEPFLAGS = -MMD -MP +LDFLAGS = -lm + +TARGET = tricorn +SRCS = $(wildcard *.c) +OBJS = $(SRCS:.c=.o) +DEPS = $(SRCS:.c=.d) .PHONY: all clean -all: tricorn +all: $(TARGET) + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) + +%.o: %.c + $(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@ + +-include $(DEPS) -tricorn: main.c tricorn.c - $(CC) $(CFLAGS) -o $@ $^ $(LDLIBS) clean: - rm -f tricorn \ No newline at end of file + rm -f $(OBJS) $(DEPS) $(TARGET) \ No newline at end of file