forked from efficomp/Hpmoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
91 lines (73 loc) · 3.33 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
## This file is subject to the terms and conditions defined in
# file 'LICENSE', which is part of Hpmoon repository.
#
# This work has been funded by:
#
# Spanish 'Ministerio de Economía y Competitividad' under grants number TIN2012-32039 and TIN2015-67020-P.\n
# Spanish 'Ministerio de Ciencia, Innovación y Universidades' under grant number PGC2018-098813-B-C31.\n
# European Regional Development Fund (ERDF).
#
# @file Makefile
# @author Juan José Escobar Pérez
# @date 15/06/2015
# @brief File with the necessary rules to compile the project. Also, documentation is generated
# @copyright Hpmoon (c) 2015 EFFICOMP
SRC = src
INC = include
OBJ = obj
BIN = bin
DOC = docs
GNUPLOT = gnuplot
OPENCL = $(AMDAPPSDKROOT)/include
COMP ?= mpic++
CPPFLAGS = -std=c++0x -c -Iinclude
OPT = -O2 -funroll-loops
OMP = -fopenmp
NFEATURES = -D N_FEATURES=$(N_FEATURES)
OBJECTS = $(OBJ)/tinyxml2.o $(OBJ)/cmdParser.o $(OBJ)/config.o $(OBJ)/clUtils.o $(OBJ)/bd.o $(OBJ)/ag.o $(OBJ)/evaluation.o $(OBJ)/individual.o $(OBJ)/zitzler.o $(OBJ)/main.o
# ************ Targets ************
all: $(BIN)/hpmoon
# ************ Documentation ************
documentation:
@mkdir -p $(DOC)/html
@doxygen $(DOC)/Doxyfile
@printf "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n" > $(DOC)/index.html
@printf "<html>\n <head>\n <meta http-equiv=Refresh content=\"0;url=html/index.html\">\n </head>\n</html>" >> $(DOC)/index.html
# ************ Compilation of modules ************
$(OBJ)/tinyxml2.o: $(SRC)/tinyxml2.cpp $(INC)/tinyxml2.h
@mkdir -p $(OBJ)
$(COMP) $(CPPFLAGS) $(OPT) $(SRC)/tinyxml2.cpp -o $(OBJ)/tinyxml2.o
$(OBJ)/cmdParser.o: $(SRC)/cmdParser.cpp $(INC)/cmdParser.h
$(COMP) $(CPPFLAGS) $(OPT) $(SRC)/cmdParser.cpp -o $(OBJ)/cmdParser.o
$(OBJ)/config.o: $(SRC)/config.cpp $(INC)/config.h $(OPENCL)
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) -I$(OPENCL) $(SRC)/config.cpp -o $(OBJ)/config.o
$(OBJ)/clUtils.o: $(SRC)/clUtils.cpp $(INC)/clUtils.h $(OPENCL)
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) -I$(OPENCL) $(SRC)/clUtils.cpp -o $(OBJ)/clUtils.o
$(OBJ)/bd.o: $(SRC)/bd.cpp $(INC)/bd.h
$(COMP) $(CPPFLAGS) $(OPT) $(SRC)/bd.cpp -o $(OBJ)/bd.o
$(OBJ)/ag.o: $(SRC)/ag.cpp $(INC)/ag.h $(OPENCL)
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) $(OMP) -I$(OPENCL) $(SRC)/ag.cpp -o $(OBJ)/ag.o
$(OBJ)/evaluation.o: $(SRC)/evaluation.cpp $(INC)/evaluation.h $(OPENCL)
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) $(OMP) -I$(OPENCL) $(SRC)/evaluation.cpp -o $(OBJ)/evaluation.o
$(OBJ)/individual.o: $(SRC)/individual.cpp $(INC)/individual.h
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) $(SRC)/individual.cpp -o $(OBJ)/individual.o
$(OBJ)/zitzler.o: $(SRC)/zitzler.cpp $(INC)/zitzler.h
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) $(SRC)/zitzler.cpp -o $(OBJ)/zitzler.o
$(OBJ)/main.o: $(SRC)/main.cpp $(OPENCL)
$(COMP) $(CPPFLAGS) $(NFEATURES) $(OPT) -I$(OPENCL) $(SRC)/main.cpp -o $(OBJ)/main.o
# ************ Linking and creating executable ************
$(BIN)/hpmoon: $(OBJECTS)
@mkdir -p $(BIN) $(GNUPLOT)
$(COMP) $(OBJECTS) -o $(BIN)/hpmoon -lOpenCL $(OMP)
# ************ Cleaning ***************
clean:
@echo "Partial cleaning..."
@printf "\t- Binary files\n"
@printf "\t- .o files\n"
@printf "\t- ~ files\n"
@\rm -rf $(OBJ) $(BIN) *~
eraseAll: clean
@echo "Additionally..."
@printf "\t- gnuplot files\n"
@printf "\t- Documentation files\n"
@\rm -rf $(GNUPLOT) $(DOC)/html $(DOC)/index.html