CXX := CC
CXXFLAGS := -std=c++11 -std=gnu++14 -O3 -fopenmp -fpermissive -DTHREADED -DGNU_PARALLEL #-DTIMING 



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 $<



TOMMYS = $(COMBBLAS)/Tommy/tommyhashdyn.o $(COMBBLAS)/Tommy/tommyhash.o $(COMBBLAS)/Tommy/tommylist.o

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



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

bpmm: BPMaximumMatching.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

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

auction: auction.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

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

awpm: ApproxWeightPerfectMatching.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





clean:
	rm -rf ../*.o
	rm -f bpmm auction
	rm -f *.o
