-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
311 lines (262 loc) · 8.66 KB
/
Makefile.in
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#
# This file is part of Hecios
#
# Copyright (C) 2007,2008,2009 Brad Settlemyer
#
# This file is distributed WITHOUT ANY WARRANTY. See the file 'License.txt'
# for details on this and other legal matters.
#
#
# Top Level Makefile for HECIOS. This makefile avoids recursive make and
# integrates the third party framework, INET, into HECIOS.
#
#
# Variables set by the configure script
#
HECIOS_DIR := @CONFIG_PROJECT_DIR@
BUILD_DIR := @CONFIG_BUILD_DIR@
INSTALL_DIR = @prefix@
OMNET_DIR := @CONFIG_OMNET_DIR@
CONFIG_CXXFLAGS := @CONFIG_CXXFLAGS@
CONFIG_UNSAFE_CXXFLAGS := @CONFIG_UNSAFE_CXXFLAGS@
CONFIG_LDFLAGS := @CONFIG_LDFLAGS@
CONFIG_XML_LIBS := @CONFIG_XML_LIB@
MODE := debug
#
# Module locations
#
DOC_DIR = doc
SRC_DIR = src
INET_DIR = INET
CLIENT_DIR = $(SRC_DIR)/client
CLIENT_AGGREGATOR_DIR = $(SRC_DIR)/client/aggregator
CLIENT_CACHE_DIR = $(SRC_DIR)/client/cache
COMMON_DIR = $(SRC_DIR)/common
CONFIG_DIR = $(SRC_DIR)/config
IO_DIR = $(SRC_DIR)/io
LAYOUT_DIR = $(SRC_DIR)/layout
MESSAGES_DIR = $(SRC_DIR)/messages
OS_DIR = $(SRC_DIR)/os
PHYSICAL_DIR = $(SRC_DIR)/physical
SERVER_DIR = $(SRC_DIR)/server
TOOLS_DIR = $(SRC_DIR)/tools
#
# Build target directories
#
BIN_DIR = bin
LIB_DIR = lib
#
# Set the VPATH to enable out of tree builds
#
VPATH = $(HECIOS_DIR)
#
# Master Makefile default targets
#
DEFAULT_TARGETS = $(BIN_DIR)/hecios_cmd $(BUILD_DIR)/omnetpp.ini
default: $(DEFAULT_TARGETS)
#
# Include path (directories to search for include files)
#
INCLUDES = $(OMNET_DIR)/include \
$(HECIOS_DIR) \
$(CLIENT_AGGREGATOR_DIR) \
$(CLIENT_CACHE_DIR) \
$(CLIENT_DIR) \
$(COMMON_DIR) \
$(CONFIG_DIR) \
$(IO_DIR) \
$(LAYOUT_DIR) \
$(MESSAGES_DIR) \
$(OS_DIR) \
$(PHYSICAL_DIR) \
$(SERVER_DIR) \
$(INET_DIR) \
$(INET_DIR)/src/applications/ethernet \
$(INET_DIR)/src/applications/generic \
$(INET_DIR)/src/applications/pingapp \
$(INET_DIR)/src/applications/tcpapp \
$(INET_DIR)/src/applications/udpapp \
$(INET_DIR)/src/base \
$(INET_DIR)/src/networklayer/arp \
$(INET_DIR)/src/networklayer/autorouting \
$(INET_DIR)/src/networklayer/common \
$(INET_DIR)/src/networklayer/contract \
$(INET_DIR)/src/networklayer/ipv4 \
$(INET_DIR)/src/networklayer/queue \
$(INET_DIR)/src/linklayer/contract \
$(INET_DIR)/src/linklayer/etherswitch \
$(INET_DIR)/src/linklayer/ethernet \
$(INET_DIR)/src/linklayer/ppp \
$(INET_DIR)/src/nodes/inet \
$(INET_DIR)/src/transport/contract \
$(INET_DIR)/src/transport/tcp \
$(INET_DIR)/src/transport/udp \
$(INET_DIR)/src/util
#
# Testing subsystem include files. Setup in tests.mk, but referenced here
# so that it can be used
#
TEST_INCLUDES =
#
# Libraries to link
#
OMNET_LIB_MODE_EXT =
LIB_DIR = lib
OMNET_SIM_LIBS = -loppsim$(OMNET_LIB_MODE_EXT) -loppnedxml$(OMNET_LIB_MODE_EXT) $(CONFIG_XML_LIBS)
OMNET_GUI_LIBS = -loppenvir$(OMNET_LIB_MODE_EXT) -lopptkenv$(OMNET_LIB_MODE_EXT)
OMNET_CMD_LIBS = -loppenvir$(OMNET_LIB_MODE_EXT) -loppcmdenv$(OMNET_LIB_MODE_EXT)
LIBS_GUI = -L$(OMNET_DIR)/lib -L$(LIB_DIR) \
$(OMNET_GUI_LIBS) $(OMNET_SIM_LIBS) -ltk -ltcl -ldl -lstdc++
LIBS_CMD = -L$(OMNET_DIR)/lib -L$(LIB_DIR) \
$(OMNET_CMD_LIBS) $(OMNET_SIM_LIBS) -ldl -lstdc++
#
# Variables used by the individual modules
#
DOC_SRC :=
SIM_SRC :=
TOOLS_SRC :=
#
# Include module makefiles
#
include $(HECIOS_DIR)/mf/inet.mk
include $(DOC_DIR)/module.mk
include $(CLIENT_DIR)/module.mk
include $(CLIENT_AGGREGATOR_DIR)/module.mk
include $(CLIENT_CACHE_DIR)/module.mk
include $(COMMON_DIR)/module.mk
include $(CONFIG_DIR)/module.mk
include $(IO_DIR)/module.mk
include $(LAYOUT_DIR)/module.mk
include $(MESSAGES_DIR)/module.mk
include $(OS_DIR)/module.mk
include $(PHYSICAL_DIR)/module.mk
include $(SERVER_DIR)/module.mk
include $(TOOLS_DIR)/module.mk
#
# Doc Module build targets
#
DOC_DVI := $(patsubst %.tex,%.dvi, $(filter %.tex,$(DOC_SRC)))
DOC_PDF := $(patsubst %.tex,%.pdf, $(filter %.tex,$(DOC_SRC)))
DOC_PS := $(patsubst %.tex,%.ps, $(filter %.tex,$(DOC_SRC)))
DOC_EPS := $(patsubst %.fig,%.eps, $(filter %.fig,$(DOC_SRC)))
#
# Latex creates a bunch of spurious files, add those to clean list
#
DOC_CRUFT := $(patsubst %.tex,%.aux, $(filter %.tex,$(DOC_SRC)))
DOC_CRUFT += $(patsubst %.tex,%.toc, $(filter %.tex,$(DOC_SRC)))
DOC_CRUFT += $(patsubst %.tex,%.log, $(filter %.tex,$(DOC_SRC)))
#
# Src Module build targets
#
SIM_MSG_OUTPUT := $(patsubst %.msg,%_m.cc, $(filter %.msg, $(SIM_SRC)))
SIM_MSG_OBJS := $(patsubst %.msg,%_m.o, $(filter %.msg, $(SIM_SRC)))
SIM_NED_OUTPUT := $(patsubst %.ned,%_n.cc, $(filter %.ned, $(SIM_SRC)))
SIM_NED_OBJS := $(patsubst %.ned,%_n.o, $(filter %.ned, $(SIM_SRC)))
SIM_OBJS := $(patsubst %.cc, %.o, $(filter %.cc, $(SIM_SRC)))
TOOLS_OBJS := $(patsubst %.cc, %.o, $(filter %.cc, $(TOOLS_SRC)))
#
# Source code dependency generation
#
SIM_DEPENDS := $(patsubst %.cc, %.d, $(filter %.cc, $(SIM_SRC)))
TOOLS_DEPENDS := $(patsubst %.cc, %.d, $(filter %.cc, $(TOOLS_SRC)))
#
# Include dependency makefiles if building source target
#
DEPFILTER_MAKECMDGOALS := $(filter %clean %doc, $(MAKECMDGOALS))
ifeq ($(strip $(DEPFILTER_MAKECMDGOALS)),)
-include $(SIM_DEPENDS)
-include $(TOOLS_DEPENDS)
endif
#
# Include all make system makefiles
#
include $(HECIOS_DIR)/mf/rules.mk
include $(HECIOS_DIR)/mf/tools.mk
include $(HECIOS_DIR)/mf/tests.mk
#
# Top level psuedo targets
#
all: $(BIN_DIR)/hecios $(BIN_DIR)/hecios_gui $(BIN_DIR)/lanl_trace_scanner $(BUILD_DIR)/omnetpp.ini
gui: $(BIN_DIR)/hecios $(BUILD_DIR)/omnetpp.ini
clean:
@echo "Removing all derived files."
$(RM) $(DOC_DVI) $(DOC_EPS) $(DOC_PDF) $(DOC_PS) $(DOC_CRUFT)
$(RM) $(SIM_DEPENDS)
$(RM) $(SIM_NED_OUTPUT) $(SIM_NED_OBJS)
$(RM) $(SIM_MSG_OUTPUT) $(SIM_MSG_OBJS)
$(RM) $(SIM_OBJS)
$(RM) $(BIN_DIR)/hecios $(BIN_DIR)/hecios_cmd $(BUILD_DIR)/omnetpp.ini
@echo "Derived files deleted. Project is clean."
depclean:
$(RM) $(SIM_DEPENDS)
gen_clean:
@echo "Removing generated source files and objects."
$(RM) $(SIM_NED_OUTPUT) $(SIM_NED_OBJS)
$(RM) $(SIM_MSG_OUTPUT) $(SIM_MSG_OBJS)
@echo "Generated source files and objects removed."
all_clean: clean inet_clean tests_clean
#
# Build targets for software installation
#
install:
$(INSTALL) -d $(INSTALL_DIR)/bin
$(INSTALL) -d $(INSTALL_DIR)/examples
$(INSTALL) -d $(INSTALL_DIR)/ini
$(INSTALL) -d $(INSTALL_DIR)/lib/ned
$(INSTALL) -d $(INSTALL_DIR)/scripts
$(INSTALL) -c -m 755 bin/hecios* $(INSTALL_DIR)/bin
$(INSTALL) -c -m 755 bin/lanl_trace_scanner $(INSTALL_DIR)/bin
$(INSTALL) -c -m 644 lib/*.* $(INSTALL_DIR)/lib
$(INSTALL) -c -m 644 ini/*.ini $(INSTALL_DIR)/ini
$(INSTALL) -c -m 755 scripts/*.pl $(INSTALL_DIR)/scripts
#find . -name *.ned -exec $(INSTALL) -c {} $(INSTALL_DIR)/lib/ned \;
#find $(INSTALL_DIR) -name *.ned > $(INSTALL_DIR)/lib/ned/hecios_ned.lst
rsync -rv --include="+ */" --include="*.ned" --exclude="*" INET/src $(INSTALL_DIR)/lib/ned/inet
rsync -rv --include="+ */" --include="*.ned" --exclude="*" src $(INSTALL_DIR)/lib/ned/spfs
sed -e "s|@INSTALL_DIR@|$(INSTALL_DIR)|" \
$(HECIOS_DIR)/omnetpp.ini.in > $(INSTALL_DIR)/example.ini
@echo "HECIOS successfully installed."
.PHONY: install
#
# Build targets for documentation
#
doc: $(DOC_EPS) $(DOC_PDF)
@#echo "DOC_PDF: $(DOC_PDF) DOC_DIR: $(DOC_DIR)"
doxygen $(DOC_DIR)/Doxyfile
doxytag -t $(DOC_DIR)/Doxytag.xml $(DOC_DIR)/api-doc/html
opp_neddoc -d ../api-doc/html -t $(DOC_DIR)/Doxytag.xml -o $(DOC_DIR)/ned-doc $(SRC_DIR)
.PHONY: doc
#
# Build the Omnet configuration information
#
$(BUILD_DIR)/hecios_ned.lst:
find $(HECIOS_DIR) -name *.ned > $@
$(BUILD_DIR)/omnetpp.ini: $(BUILD_DIR)/hecios_ned.lst $(HECIOS_DIR)/omnetpp.ini.in
sed -e "s|@INSTALL_DIR@|$(INSTALL_DIR)|" $(HECIOS_DIR)/omnetpp.ini.in > $@
configfile: $(BUILD_DIR)/omnetpp.ini
.PHONY: configfile
#
# Incremental build (useful target for IDE auto-save builds)
#
incremental: $(LIB_DIR)/inet.o $(SIM_MSG_OBJS) $(SIM_OBJS) $(TOOLS_OBJS) tests_incremental
.PHONY: incremental
#
# Targets to build HECIOS simulator (gui and command line versions)
#
$(SIM_MSG_OUTPUT): $(LIB_DIR)/libinet.so
$(SIM_OBJS): $(SIM_MSG_OUTPUT)
$(BIN_DIR)/hecios_gui: $(LIB_DIR)/libinet.so $(SIM_MSG_OBJS) $(SIM_OBJS)
@mkdir -p $(BIN_DIR)
$(LD) $(LDFLAGS) $(SIM_MSG_OBJS) $(SIM_OBJS) $(LIB_DIR)/libinet.so $(LIBS_GUI) -o $@
$(BIN_DIR)/hecios: $(LIB_DIR)/libinet.so $(SIM_MSG_OBJS) $(SIM_OBJS)
@mkdir -p $(BIN_DIR)
$(LD) $(LDFLAGS) $(SIM_MSG_OBJS) $(SIM_OBJS) $(LIB_DIR)/libinet.so $(LIBS_CMD) -o $@
#
# Build unit test drivers
#
test: tests_all
.PHONY: test
#
# Psuedotargets (required by make for some dependencies)
#
.PHONY: all all_clean clean default depclean gen_clean gui tests_clean