#You must ensure nmake.exe, cl.exe, link.exe are in system path.
#Under dosbox prompt
#nmake -f Makefile.win

CXX = cl.exe
CFLAGS = -nologo -O2 -EHsc -I.  -D _CRT_SECURE_NO_DEPRECATE
TARGET = .

# -D __WIN32__

all: $(TARGET)\FkNN.exe $(TARGET)\FkNNSVM.exe $(TARGET)\FkNNSVM-nr.exe $(TARGET)\FaLKNR.exe $(TARGET)\FaLK-SVM-train.exe $(TARGET)\FaLK-SVM-predict.exe 

$(TARGET)\FkNN.exe: FkNN.cpp cover_tree.obj knn.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FkNN.cpp cover_tree.obj knn.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FkNN.exe
    
$(TARGET)\FkNNSVM.exe: FkNN.cpp cover_tree.obj knn.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FkNNSVM.cpp cover_tree.obj knn.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FkNNSVM.exe
    
$(TARGET)\FkNNSVM-nr.exe: FkNN.cpp cover_tree.obj knn.obj fast_lsvm.obj  noise_reduction.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FkNNSVM-nr.cpp cover_tree.obj knn.obj fast_lsvm.obj  noise_reduction.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FkNNSVM-nr.exe
    
$(TARGET)\FaLKNR.exe: FkNN.cpp cover_tree.obj knn.obj noise_reduction.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FaLKNR.cpp cover_tree.obj knn.obj noise_reduction.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FaLKNR.exe
    
$(TARGET)\FaLK-SVM-train.exe: FkNN.cpp cover_tree.obj knn.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FaLK-SVM-train.cpp cover_tree.obj knn.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FaLK-SVM-train.exe
    
$(TARGET)\FaLK-SVM-predict.exe: FkNN.cpp cover_tree.obj knn.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj 
    $(CXX) $(CFLAGS) FaLK-SVM-predict.cpp cover_tree.obj knn.obj fast_lsvm.obj svm.obj par_est.obj per_eval.obj -Fe$(TARGET)\FaLK-SVM-predict.exe

cover_tree.obj: cover_tree.cpp cover_tree.h
    $(CXX) $(CFLAGS) -c cover_tree.cpp
    
knn.obj: knn.cpp knn.h
    $(CXX) $(CFLAGS) -c knn.cpp
    
noise_reduction.obj: noise_reduction.cpp noise_reduction.h
    $(CXX) $(CFLAGS) -c noise_reduction.cpp
    
fast_lsvm.obj: fast_lsvm.cpp fast_lsvm.h
    $(CXX) $(CFLAGS) -c fast_lsvm.cpp
    
par_est.obj: par_est.cpp par_est.h
    $(CXX) $(CFLAGS) -c par_est.cpp
    
per_eval.obj: per_eval.cpp per_eval.h
    $(CXX) $(CFLAGS) -c per_eval.cpp

svm.obj: svm.cpp svm.h
    $(CXX) $(CFLAGS) -c svm.cpp


clean:
    -erase /Q *.obj *.exe

