CXX := mpicxx
CXXFLAGS := -std=c++11 -std=gnu++14 -O3 -fopenmp -fpermissive  -DTHREADED #-DDETERMINISTIC  -DTIMING #-DBENCHMARK_SPMSPV



COMBBLAS = ../..

$(COMBBLAS)/graph500-1.2/generator/libgraph_generator_seq.a:
	$(MAKE) -C $(COMBBLAS)/graph500-1.2/generator

%.o : %.cpp
	$(CXX) $(CXXFLAGS) -o $@ -c $<

$(COMBBLAS)/Tommy/%.o : $(COMBBLAS)/Tommy/%.c
	$(CXX) $(CXXFLAGS) -o $@ -c $<

$(COMBBLAS)/usort/%.o : $(COMBBLAS)/usort/src/%.cpp
	$(CXX) -I$(COMBBLAS)/usort/include $(CXXFLAGS) -o $@ -c $<


clean:
	rm -rf ../../*.o
	rm -f SpMSpVBench
	rm -f *.o
        
TOMMYS = $(COMBBLAS)/Tommy/tommyhashdyn.o $(COMBBLAS)/Tommy/tommyhash.o $(COMBBLAS)/Tommy/tommylist.o

USORT = $(COMBBLAS)/usort/binUtils.o $(COMBBLAS)/usort/parUtils.o 


SpMSpVBench.o: SpMSpVBench.cpp $(COMBBLAS)/SpDCCols.cpp $(COMBBLAS)/dcsc.cpp $(COMBBLAS)/SpHelper.h $(COMBBLAS)/SpParMat.h $(COMBBLAS)/ParFriends.h $(COMBBLAS)/SpParMat.cpp $(COMBBLAS)/SpDefs.h $(COMBBLAS)/SpTuples.cpp $(COMBBLAS)/SpImpl.h $(COMBBLAS)/SpCCols.h $(COMBBLAS)/SpCCols.cpp $(COMBBLAS)/csc.cpp $(COMBBLAS)/SpImpl.cpp
	$(CXX) $(CXXFLAGS) -o $@ -c $<

SpMSpVBench: SpMSpVBench.o $(COMBBLAS)/MPIType.o $(COMBBLAS)/mmio.o $(COMBBLAS)/MPIOp.o $(COMBBLAS)/MemoryPool.o $(COMBBLAS)/CommGrid.o  $(COMBBLAS)/hash.o $(COMBBLAS)/graph500-1.2/generator/libgraph_generator_seq.a $(COMBBLAS)/CommGrid.o $(TOMMYS) $(USORT)
	$(CXX) $(CXXFLAGS) -o $@ $^ -L$(COMBBLAS)/graph500-1.2/generator -lgraph_generator_seq


