CXX = g++ CXXFLAGS = -Wall -O2 .PHONY: all clean remake all: graytrace clean: rm -f graytrace graytrace.o lodepng.o remake: clean all graytrace: lodepng.o graytrace.cpp graytrace.o $(CXX) $(CXXFLAGS) graytrace.o lodepng.o -o graytrace lodepng.o: lodepng.cpp lodepng.h $(CXX) $(CXXFLAGS) -c -o lodepng.o lodepng.cpp lodepng.cpp: @if ! test -e lodepng.cpp; then \ /bin/echo -n Downloading lodepng...\ ; \ curl -s 'https://raw.githubusercontent.com/lvandeve/lodepng/master/lodepng.cpp' >lodepng.cpp; \ curl -s 'https://raw.githubusercontent.com/lvandeve/lodepng/master/lodepng.h' >lodepng.h; \ /bin/echo done.; \ fi