-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
110 lines (100 loc) · 4.13 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# FILE = "./Makefile" #
# Created by Dionysis Taxiarchis Balaskas. #
# Copyright © 2019 D.T.Balaskas. All rights reserved. #
#####################################################################
.PHONY: clean default run
# Define exec names.
LSH_EXEC= lsh
CUBE_EXEC= cube
CLUSTER_EXEC= cluster
SEARCH_EXEC= search
# Define filetype and compiler type.
CXX= g++ -std=c++11
CODETYPE = cpp
HEADERTYPE = h
# Define commands and tags.
CXXFLAGS= -Wall -g3
LDLIBS= -lpthread
RM= rm -f
GDBFLAGS = -ggdb3
# Organization of directories and files.
DOC= doc
README= README.md
OUTPUT= ./doc/output
INPUT= ./doc/input
QUERY= ./doc/query
CONF= ./doc/configuration
BDIR= bin
SRCDIR= src
SRC= $(wildcard $(SRCDIR)/*.$(CODETYPE))
IDIR= include
DEPS= $(wildcard $(IDIR)/*.h)
ODIR= build
DEMANDED_OBJECTS= $(ODIR)/exhaustive_knn.o $(ODIR)/hashtable.o $(ODIR)/hash_function.o $(ODIR)/numc.o $(ODIR)/pandac.o $(ODIR)/prediction_results.o
default: $(CUBE_EXEC) $(LSH_EXEC) $(CLUSTER_EXEC) $(SEARCH_EXEC)
@echo "============================================================================"
@echo "Compiled Project!"
info:
@echo "============================================================================"
@echo "source directory: $(SRCDIR)."
@echo "include directory: $(IDIR)."
@echo "object directory: $(ODIR)."
@echo "documents/data directory: $(DOC)."
@echo "input directory: $(INPUT)."
@echo "output directory: $(OUTPUT)."
@echo "query directory: $(QUERY)."
@echo "configuration directory: $(CONF)."
@echo "executable directory: $(BDIR)."
@echo "At compilation we are adding the libraries: $(LDLIBS)."
@echo "README path: $(README)."
@echo "============================================================================"
@echo "make: compiles the executables."
@echo "make <filename>.o: compiles the object file of $(SRCDIR)/<filename>.$(CODETYPE) on $(ODIR)/<filename>.o."
@echo "make cube: compiles the cube's executable."
@echo "make lsh: compiles the lsh's executable."
@echo "make cluster: compiles the cluster's executable."
@echo "make clean: Clears the project from the executables and the object files."
@echo "make clean_cache: Clears the project from the output files."
@echo "make README: Prints the README file of the project."
@echo "============================================================================"
$(ODIR)/%.o: $(SRCDIR)/%.$(CODETYPE)
@echo "Creating object" $@ "..."
mkdir $(ODIR) -p
$(CXX) -c -o $@ $< $(CXXFLAGS)
%.o: $(SRCDIR)/%.$(CODETYPE)
@echo "Creating object" $(ODIR)/$@ "..."
mkdir $(ODIR) -p
$(CXX) -c -o $(ODIR)/$@ $< $(CXXFLAGS)
$(CUBE_EXEC): $(DEMANDED_OBJECTS) $(ODIR)/hc_classifier.o $(ODIR)/cube.o
@echo "============================================================================"
@echo "Creating $@ ..."
mkdir $(BDIR) -p
$(CXX) -o $(BDIR)/$@ $^ $(LDLIBS) $(CXXFLAGS)
$(LSH_EXEC): $(DEMANDED_OBJECTS) $(ODIR)/lsh_classifier.o $(ODIR)/lsh.o
@echo "============================================================================"
@echo "Creating $@ ..."
mkdir $(BDIR) -p
$(CXX) -o $(BDIR)/$@ $^ $(LDLIBS) $(CXXFLAGS)
$(SEARCH_EXEC): $(DEMANDED_OBJECTS) $(ODIR)/lsh_classifier.o $(ODIR)/search.o
@echo "============================================================================"
@echo "Creating $@ ..."
mkdir $(BDIR) -p
$(CXX) -o $(BDIR)/$@ $^ $(LDLIBS) $(CXXFLAGS)
$(CLUSTER_EXEC): $(DEMANDED_OBJECTS) $(ODIR)/lsh_classifier.o $(ODIR)/hc_classifier.o $(ODIR)/kmedians.o $(ODIR)/cluster.o
@echo "============================================================================"
@echo "Creating $@ ..."
mkdir $(BDIR) -p
$(CXX) -o $(BDIR)/$@ $^ $(LDLIBS) $(CXXFLAGS)
clean:
@echo "============================================================================"
@echo "Cleaning up..."
$(RM) $(ODIR)/*
$(RM) $(BDIR)/*
clean_cache:
@echo "============================================================================"
@echo "Removing cached outputs..."
$(RM) $(OUTPUT)/*
README:
@echo "============================================================================"
@cat $(README)
@echo "============================================================================"