include Makefile.conf

.PHONY: all
all: libiglcomiso
debug: libiglcomiso

include Makefile.conf
all: CFLAGS += -O3 -DNDEBUG -std=c++11
debug: CFLAGS += -g -Wall -std=c++11
CFLAGS += -DINCLUDE_TEMPLATES

.PHONY: libiglcomiso
libiglcomiso: obj ../lib/libiglcomiso.a

SRC_DIR=../include/igl/comiso/
CPP_FILES=$(wildcard $(SRC_DIR)*.cpp)
OBJ_FILES=$(addprefix obj/,$(notdir $(CPP_FILES:.cpp=.o)))

# include igl headers
INC+=-I../include/

# EXPECTS THAT CFLAGS IS ALREADY SET APPROPRIATELY

# Eigen dependency
EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
INC+=$(EIGEN3_INC)

# comiso dependency
COMISO_INC=-I$(COMISO)/ -I$(COMISO)/gmm/include -I$(COMISO)/../
INC+=$(COMISO_INC)

obj:
	mkdir -p obj

../lib/libiglcomiso.a: $(OBJ_FILES)
	rm -f $@
	ar cqs $@ $(OBJ_FILES)

obj/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/%.h
	g++ $(AFLAGS) $(OPENMP) $(CFLAGS) -c -o $@ $< $(INC)

clean:
	rm -f $(OBJ_FILES)
	rm -f ../lib/libiglcomiso.a
