From 29c93d8f3f903978e6e0922bcd02cddf5f95230e Mon Sep 17 00:00:00 2001 From: Laurent Fasnacht Date: Tue, 15 Apr 2014 13:47:24 +0200 Subject: [PATCH] Automatic generation of build dependencies --- .gitignore | 1 + src/Makefile | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a7e65b00..0c617558 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ # Other files *.exe *.o +*.d diff --git a/src/Makefile b/src/Makefile index 684e53fc..0c523681 100644 --- a/src/Makefile +++ b/src/Makefile @@ -54,6 +54,8 @@ OBJS = interface_main.o encmain.o bitstream.o cabac.o config.o context.o encoder PROG = ./kvazaar PROGS = $(PROG) +DEPS = $(OBJS:.o=.d) + all: $(PROGS) .PHONY: all clean @@ -66,5 +68,10 @@ cpu.o: x86/cpu.asm %.o: %.c $(CC) $(CCFLAGS) -c $< -o $@ +%.d: %.c + $(CC) $(CCFLAGS) -MF"$@" -MG -MM -MP -MT"$@" -MT"$(<:.c=.o)" "$<" + clean: - rm -f $(OBJS) $(PROGS) $(ASMOBJS) + rm -f $(OBJS) $(PROGS) $(ASMOBJS) $(DEPS) + +-include $(DEPS)