From 2cb24f14fabb1179b38476c8e6a45386a5ab05f0 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Sat, 26 Mar 2022 12:36:38 +0100 Subject: [PATCH] header dependencies --- .gitignore | 1 + Makefile | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index fe73ff5..d9ded93 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ /*.g1a /*.g3a *.o +*.d lzy # Python bytecode diff --git a/Makefile b/Makefile index 66bca25..03a145e 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,9 @@ CC ?= gcc -CFLAGS = -std=c99 -Wall -Wextra -O3 -I./inc $(shell sdl2-config --cflags) +CFLAGS = -std=c99 -Wall -Wextra -O3 -I./inc -MMD $(shell sdl2-config --cflags) LDFLAGS = -lSDL2 -lSDL2_image -lSDL2_mixer $(shell sdl2-config --libs) OBJ_NAME = lzy OBJS := $(patsubst %.c,%.o,$(wildcard src/*.c)) -HEADERS := $(wildcard inc/*.h) all: $(OBJ_NAME) @@ -12,7 +11,7 @@ $(OBJ_NAME): $(OBJS) $(CC) $(LDFLAGS) $(LIBRARIES) -o $(OBJ_NAME) $(OBJS) strip $(OBJ_NAME) -%.o: %.c $(HEADERS) +%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< cg: @@ -27,7 +26,9 @@ format: clean: rm -f $(OBJ_NAME).g3a $(OBJ_NAME) - rm -f $(OBJS) + rm -f $(OBJS) src/*.d rm -Rf build-cg .PHONY: cg run run-txt format clean + +-include src/*.d