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)