From 19cac40663aaddf43b16c90c8b6cf53e44e4e2bd Mon Sep 17 00:00:00 2001 From: Thodoris Sotiropoulos Date: Wed, 1 Jan 2020 12:42:16 +0200 Subject: [PATCH] Fix faults in Make build --- Makefile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5b9a8715..ad5cb707 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,11 @@ CC ?= gcc CXX ?= g++ override CFLAGS := -W -Wall -Wextra -ansi -pedantic -O3 -Wno-unused-function $(CFLAGS) -override CXXFLAGS := -W -Wall -Wextra -ansi -pedantic -O3 $(CXXFLAGS) +override CXXFLAGS := -MD -W -Wall -Wextra -ansi -pedantic -O3 $(CXXFLAGS) + +OBJS = *.o +OBJS += examples/example_sdl.o +DEPS = $(wildcard *.d examples/*.d) all: unittest benchmark pngdetail showpng @@ -31,4 +35,7 @@ showpng: lodepng.o examples/example_sdl.o $(CXX) -I ./ $^ $(CXXFLAGS) -lSDL -o $@ clean: - rm -f unittest benchmark pngdetail showpng lodepng_unittest.o lodepng_benchmark.o lodepng.o lodepng_util.o pngdetail.o examples/example_sdl.o + rm -f unittest benchmark pngdetail showpng $(OBJS) $(DEPS) + +# Pull-in dependencies generated by -MD +-include $(OBJS:.o=.d)