-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmakefile
More file actions
210 lines (164 loc) · 7.26 KB
/
makefile
File metadata and controls
210 lines (164 loc) · 7.26 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
###############################################################################
#
# Theron++
#
# Theron actors only require the actor header and source file. However, in
# practice one would probably use more of the utility code base. In particular,
# if the transparent communication is used, then multiple code files will be
# needed as it became infeasible to implement the communication technology
# interface classes as 'header only' libraries.
#
# The purpose of this make file is to define a target 'Library' that builds
# and archives all source files so that the use of Theron++ is just to set
# the include directory to the top level Theron++ and link against this library.
#
# In order to keep the code base clean from the compiler generated object files
# they are placed in a dedicated 'bin' directory and rebuilt as needed.
#
# Author: Geir Horn, University of Oslo, 2019
#
###############################################################################
#
# The first section covers the standard definitions and compiler flags. The
# code is standard C++, but may utilize features of the most recent standard
# draft and so it is important that the compiler supports the advanced features.
# The standard is explicitly given, and currently it is C++ 2017 version.
# Both Gnu C++ and CLang has been tested and can be used.
CXX = ccache g++
# The standard archive utility is used with the following flags:
# r = Replace an existing library entry with the new one
# u = Update only files if they are newer than the ones in the archive
# v = Verbose telling us what happens
# s = Create or update the library index (equivalent with ranlib)
ARFLAGS = ruvs
# The compiler is instructed to produce all warnings and provide output for
# the code to be debugged with GDB. This produces larger object files and if
# this is a concern the GDB switch can be dropped. -Wall to be added
GENERAL_OPTIONS = -c -Wall -std=c++26 -ggdb -fPIC
# Optimisation -O3 is the highest level of optimisation and should be used
# with production code. -Og is the code optimising and offering debugging
# transparency and should be use while the code is under development
OPTIMISATION_FLAG =
# It is useful to let the compiler generate the dependencies for the various
# files, and the following will produce .d files that can be included at the
# end. The -MMD flag is equivalent with -MD, but the latter will include system
# headers in the output (which we do not need here). The -MP includes an
# empty rule to create the dependencies so that make would not create any errors
# if the file name changes.
DEPENDENCY_FLAGS = -MMD -MP
# The combined flags for the compiler
CXXFLAGS = $(DEPENDENCY_FLAGS) $(OPTIMISATION_FLAG) $(GENERAL_OPTIONS)
# The linker flags include the use of POSIX threads as they are the underlying
# implementation of standard C++ threads and is explicitly needed on some
# systems.
LDFLAGS = -ggdb -D_DEBUG -pthread
#------------------------------------------------------------------------------
#
# Theron++ base file
#
#------------------------------------------------------------------------------
#
# The Theron include directory is rooted on this directory
THERON_INCLUDE = .
# The file locations are relative to the Theron++ base directory where this
# make file is located.
OBJECTS_DIR = Bin
# There is only one header file and one source file involved
ACTOR_HEADER = Actor.hpp
ACTOR_SOURCE = Actor.cpp
ACTOR_OBJECTS = ${ACTOR_SOURCE:.cpp=.o}
# The command to build the object files for the base files
$(OBJECTS_DIR)/%.o : %.cpp
$(CXX) $(CXXFLAGS) $< -o $@ $(INCLUDE_DIRECTORIES)
#------------------------------------------------------------------------------
#
# Utility files
#
#------------------------------------------------------------------------------
#
# The utilities are useful classes that may help in setting up a working
# actor system. Some of the classes are header only, and some of them requires
# accompanying object files.
#
# Note that the Console Print class is deprecated and the file ConsolePrint.cpp
# should only be included for backward compatibility (creates unnecessary
# warnings otherwise)
UTILITY_DIR = Utility
UTILITY_HEADERS = ActorRegistry.hpp AddressHash.hpp ConsolePrint.hpp \
EventHandler.hpp StandardFallbackHandler.hpp \
TerminationWatch.hpp WallClockEvent.hpp
UTILITY_SOURCE = ActorRegistry.cpp EventHandler.cpp
UTILITY_OBJECTS = ${UTILITY_SOURCE:.cpp=.o}
# The command to build the object files for the utility files
$(OBJECTS_DIR)/%.o : $(UTILITY_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@ $(INCLUDE_DIRECTORIES)
#------------------------------------------------------------------------------
#
# Transparent communication
#
#------------------------------------------------------------------------------
#
# There are common files defining the different communication layers to be used
# by the technology specific protocols.
COMMUNICATION_DIR = Communication
COMMUNICATION_HEADERS = LinkMessage.hpp NetworkEndpoint.hpp \
NetworkingActor.hpp NetworkLayer.hpp \
PolymorphicMessage.hpp PresentationLayer.hpp \
SessionLayer.hpp
COMMUNICATION_SOURCE = NetworkEndpoint.cpp
COMMUNICATION_OBJECTS = ${COMMUNICATION_SOURCE:.cpp=.o}
# The command to build the object files for the communication files is
# similar to the command used for the utility files
$(OBJECTS_DIR)/%.o : $(COMMUNICATION_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@ $(INCLUDE_DIRECTORIES)
#------------------------------------------------------------------------------
#
# Active Message Queue
#
#------------------------------------------------------------------------------
#
# The support for the Active Message Queue (AMQ) is based on the Qpid Proton
# AMQ API.
AMQ_DIR = $(COMMUNICATION_DIR)/AMQ
AMQ_HEADERS = AMQEndpoint.hpp AMQMessage.hpp AMQPresentationLayer.hpp \
AMQjson.hpp AMQNetworkLayer.hpp AMQSessionLayer.hpp
AMQ_SOURCE = AMQjson.cpp AMQNetworkLayer.cpp AMQSessionLayer.cpp
AMQ_OBJECTS = ${AMQ_SOURCE:.cpp=.o}
# Then the build command is set to include these additional definitions.
$(OBJECTS_DIR)/%.o : $(AMQ_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $< -o $@ $(INCLUDE_DIRECTORIES)
#------------------------------------------------------------------------------
#
# Combined directives
#
#------------------------------------------------------------------------------
#
INCLUDE_DIRECTORIES = -I$(THERON_INCLUDE)
ALL_OBJECTS = $(addprefix $(OBJECTS_DIR)/, $(ACTOR_OBJECTS) \
$(UTILITY_OBJECTS) $(COMMUNICATION_OBJECTS) \
$(AMQ_OBJECTS) )
###############################################################################
#
# Targets
#
###############################################################################
#
#
# Building the library in static and shared versions
Theron++.a: $(ALL_OBJECTS)
$(AR) $(ARFLAGS) Theron++.a $?
Theron++.so: Theron++.a
g++ -shared -std=c++23 -ggdb -fPIC -o Theron++.so -Wl,--whole-archive \
Theron++.a -Wl,--no-whole-archive
Library: Theron++.a
Shared: Theron++.so
# Cleaning means deleting the object and dependencies and the library
clean:
$(RM) Theron++.a $(OBJECTS_DIR)/*.o $(OBJECTS_DIR)/*.d
###############################################################################
#
# Dependencies
#
###############################################################################
#
-include $(ALL_OBJECTS:.o=.d)