SUBDIRS = ILPTools
CC = gcc
CXX = g++
INSTDIR = ./
CFLAGS = -Wall -O3
CFLAGS_64 = -Wall -O3 -m64

OUT_DIR = output
TEST_DIR = ../Dataset
ref = ../Dataset
tar = ../Dataset


gurobiVersion=gurobi$(shell grep 'version=' ${GUROBI_HOME}/setup.py | head -n 1 | sed 's/version=//g' | sed 's/ //g' | sed 's/,//g' | sed 's/\"//g' | cut -d '.' -f1,2 --output-delimiter=" " | sed 's/ //g')
gurobiIncludePath=${GUROBI_HOME}/include/
gurobiLibPath=${GUROBI_HOME}/lib/

all: EBD-scaffolder subdirs speedup_1E speedup_1 fna2allnew\


subdirs: 
	@for dir in $(SUBDIRS); do \
		$(MAKE) -C $$dir; \
	done
    
EBD-scaffolder:information scaffolder.o sibeliaToAll.o markerInformation.o removeDuplication.o removeContinuity.o shadj.o maxIndependentSetILP.o
	$(CC) $(CFLAGS_64) -g -o EBD-scaffolder scaffolder.o sibeliaToAll.o markerInformation.o removeDuplication.o removeContinuity.o shadj.o maxIndependentSetILP.o -I${gurobiIncludePath} -L${gurobiLibPath} -l${gurobiVersion}


information:
	$(info Gurobi home is: ${GUROBI_HOME})
	$(info Gurobi version is: ${gurobiVersion})
	$(info Gurobi include path is: ${gurobiIncludePath})
	$(info Gurobi lib path is: ${gurobiLibPath})
	$(info )
	$(info If the above settting is incorrect, please modify Makefile manually!)
	$(info )

scaffolder.o:scaffolder.c exemplar.h
	$(CC) $(CFLAGS) -g -c scaffolder.c
sibeliaToAll.o:sibeliaToAll.c exemplar.h sibeliaToAll.h
	$(CC) $(CFLAGS) -g -c sibeliaToAll.c
markerInformation.o:markerInformation.c exemplar.h markerInformation.h
	$(CC) $(CFLAGS) -g -c markerInformation.c
removeDuplication.o:removeDuplication.c exemplar.h removeDuplication.h
	$(CC) $(CFLAGS) -g -c removeDuplication.c
removeContinuity.o:removeContinuity.c exemplar.h removeContinuity.h
	$(CC) $(CFLAGS) -g -c removeContinuity.c
shadj.o:shadj.c exemplar.h shadj.h
	$(CC) $(CFLAGS) -g -c shadj.c
maxIndependentSetILP.o:maxIndependentSetILP.c exemplar.h maxIndependentSetILP.h
	$(CC) $(CFLAGS_64) -g -c maxIndependentSetILP.c -I${gurobiIncludePath} -L${gurobiLibPath} -l${gurobiVersion}
speedup_1E:speedup_1E.cpp
	$(CXX) speedup_1E.cpp -o speedup_1E -std=c++2a -fconcepts -O3 -lm -lfmt 
speedup_1:speedup_1.cpp
	$(CXX) speedup_1.cpp -o speedup_1 -std=c++2a -fconcepts -O3 -lm -lfmt 
fna2allnew:fna2allnew.cpp
	$(CXX) fna2allnew.cpp -o fna2allnew -std=c++2a -fconcepts -O3 -lm -lfmt 


.PHONY: clean
clean:
	@rm -f EBD-scaffolder fna2allnew speedup_1 speedup_1E ilp ilp_i ilp_m scaffolder.o sibeliaToAll.o markerInformation.o removeDuplication.o removeContinuity.o shadj.o maxIndependentSetILP.o \
#	rm -f *.o

