-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (105 loc) · 2.31 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Custom functions
define say
$(info [BitEvolver] $1)
endef
define error
$(error [BitEvolver] $1)
endef
define die
$(call error,$1)
$(exit 1)
endef
# Demand BUILD_DIR and BIN_DIR
ifeq ($(BUILD_DIR),)
$(call die,Please provide BUILD_DIR)
endif
ifeq ($(BIN_DIR),)
$(call die,Please provide BIN_DIR)
endif
#
CC=g++
CFLAGS= -c -std=c++11 -Wall -I..
#
OBJECT_PREFIX=BitEvolver_
#
default: default-say
default: release
default:
$(call say,Default target finished)
default-say:
$(call say,Using default target: release)
#
release: release-say
release: CFLAGS+= -O2
release: build-objects
release:
$(call say,Done building RELEASE)
release-say:
$(call say,Building RELEASE)
#
debug: debug-say
debug: CFLAGS+= -g -g3
debug: build-objects
debug:
$(call say,Done building DEBUG)
debug-say:
$(call say,Building DEBUG)
#
build-objects: \
$(BUILD_DIR)/$(OBJECT_PREFIX)Random.o \
$(BUILD_DIR)/$(OBJECT_PREFIX)Population.o \
$(BUILD_DIR)/$(OBJECT_PREFIX)Breeder.o \
$(BUILD_DIR)/$(OBJECT_PREFIX)RouletteWheel.o \
$(BUILD_DIR)/$(OBJECT_PREFIX)Chromosome.o
$(call say,Done building objects)
# Population.o
$(BUILD_DIR)/$(OBJECT_PREFIX)Population.o: \
Population.h \
Population.cpp \
Defines.h Enums.h Includes.h \
Random.h \
Chromosome.h
$(CC) -o $@ \
Population.cpp \
$(CFLAGS)
$(call say,Built $@)
# Breeder.o
$(BUILD_DIR)/$(OBJECT_PREFIX)Breeder.o: \
Breeder.h \
Breeder.cpp \
Defines.h Enums.h Includes.h \
Random.h \
Chromosome.h
$(CC) -o $@ \
Breeder.cpp \
$(CFLAGS)
$(call say,Built $@)
# RouletteWheel.o
$(BUILD_DIR)/$(OBJECT_PREFIX)RouletteWheel.o: \
RouletteWheel.h \
RouletteWheel.cpp \
Defines.h Enums.h Includes.h \
Random.h
$(CC) -o $@ \
RouletteWheel.cpp \
$(CFLAGS)
$(call say,Built $@)
# Chromosome.o
$(BUILD_DIR)/$(OBJECT_PREFIX)Chromosome.o: \
Chromosome.h \
Chromosome.cpp \
Defines.h Enums.h Includes.h \
Random.h
$(CC) -o $@ \
Chromosome.cpp \
$(CFLAGS)
$(call say,Built $@)
# Random.o
$(BUILD_DIR)/$(OBJECT_PREFIX)Random.o: \
Random.h \
Random.cpp \
Defines.h Enums.h Includes.h
$(CC) -o $@ \
Random.cpp \
$(CFLAGS)
$(call say,Built $@)