1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
CCOPTS=-ggdb -O0 -Wall -lpng -pthread OUTFILE=mandelbrot SRCFILES := $(wildcard *.cpp) OBJFILES := $(patsubst %.cpp,build/%.o,$(SRCFILES)) all: $(OBJFILES) g++ $(CCOPTS) -o $(OUTFILE) $(OBJFILES) build/%.o: %.cpp if [ ! -d "build" ]; then mkdir -p build; fi g++ $(CCOPTS) -c -o $@ $< clean: rm -f build/*.o rm -f *.out rm -f compile_commands.json run: ./$(OUTFILE)