-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
92 lines (75 loc) · 1.5 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
##
## Practical aliases
##
CC = g++
RM = rm -rf
SRCS_DIR = ./srcs
##
## code like a boss
##
CPPFLAGS += -W -Wextra -Wall -fPIC
##
## libraries
##
CPPFLAGS += -fopenmp -lboost_system
LIBDL = -ldl -lgomp
##
## header location
##
CPPFLAGS += -I./srcs/algorithm -I./srcs/utils
CPPFLAGS += -I./srcs/problem -I./inih/ -I./libs/
##
## shared library flag
##
LDFLAGS += -shared
##
## c++ version
##
CPPFLAGS += -std=c++11
##
## compilation options
##
FRAMEWORK = open-gaf
PROBLEMS = $(shell find problems/ -maxdepth 1 -mindepth 1 -type d)
GENERATOR = template
SRCS = $(SRCS_DIR)/main.cpp \
$(SRCS_DIR)/algorithm/Chromosome.cpp \
$(SRCS_DIR)/algorithm/Population.cpp \
$(SRCS_DIR)/algorithm/Simulation.cpp \
$(SRCS_DIR)/utils/Config.cpp \
\
$(SRCS_DIR)/inih/INIReader.cpp \
$(SRCS_DIR)/inih/ini.cpp
OBJS = $(SRCS:.cpp=.o)
##
## compilation
##
all: $(FRAMEWORK) $(PROBLEMS) $(GENERATOR)
framework: $(FRAMEWORK)
$(FRAMEWORK): $(OBJS)
$(CC) $(OBJS) -o $(FRAMEWORK) $(LIBDL)
problems: $(PROBLEMS)
$(PROBLEMS):
$(MAKE) -C $@
generator: $(GENERATOR)
$(GENERATOR):
$(MAKE) -C $@
##
## Clean
##
RM_OBJS = $(OBJS) \
$(foreach dir, $(PROBLEMS), $(wildcard $(dir)/*.o)) \
$(foreach dir, $(GENERATOR), $(wildcard $(dir)/*.o))
RM_BIN = $(FRAMEWORK) \
$(foreach dir, $(PROBLEMS), $(wildcard $(dir)/*.so)) \
$(GENERATOR)/generator
clean:
$(RM) $(RM_OBJS)
fclean: clean
$(RM) $(RM_BIN)
re: fclean all
##
## avoid problems
##
.PHONY: all clean fclean re rclean problems generator \
$(PROBLEMS) $(FRAMEWORK) $(GENERATOR)