Changed makefile to compile all .c and .h files in the directory and .gitignore to ignore generated .o and .d files

This commit is contained in:
go38coz
2026-06-26 19:19:00 +02:00
parent 3ef33f5a5d
commit 9e0ed163f8
2 changed files with 21 additions and 7 deletions
+2
View File
@@ -1,3 +1,5 @@
.vscode .vscode
*.bmp *.bmp
tricorn tricorn
*.o
*.d
+18 -6
View File
@@ -1,12 +1,24 @@
CFLAGS= -Wall -Wextra -O3
LDLIBS = -lm
CC = gcc 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 .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: clean:
rm -f tricorn rm -f $(OBJS) $(DEPS) $(TARGET)