CC=gcc
C2=g++
STATIC=-static -static-libgcc -static-libstdc++

#CSRC	= shape.cpp tree_generation.cpp triangulation.cpp triangulation.h bmp.cpp color.cpp main.cpp shape_generation.cpp  

CFLAGS=-Wall -Wextra -fpermissive -Wsign-compare -O3 #-Werror
LFLAGS=-lm -lpng -ljpeg -ltiff #-fopenmp

# Recursively get all *.cpp this directory and any sub-directories
SRC1 := $(shell find . -name "*.cpp") 

INCLUDE = -I. 
#Replace suffix .cpp by .o
OBJ := $(addsuffix .o,$(basename $(SRC1))) 

#Binary file
BIN  = main

OBJBIN = main.o
OBJ1 := $(filter-out $(OBJBIN),$(OBJ))

#All is the target (you would run make all from the command line). 'all' is dependent
all: $(BIN) 

#Generate executables
main: $(OBJ1)
	$(C2) -std=c++11 $(STATIC) $(OBJ1) -o main $(LFLAGS) -lstdc++

%.o: %.cpp
	$(C2) -std=c++11 $(STATIC) -c $< -o $@ $(INCLUDE) $(CFLAGS) $(LFLAGS) 

clean: 
	rm -f $(BIN) $(OBJ)

