forked from omnetpp/omnetpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
286 lines (237 loc) · 8.94 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
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
#
# Toplevel makefile for OMNeT++ libraries and programs
#
#===============================================================================
#=====================================================================
#
# Main targets
#
#=====================================================================
ifeq ("$(MODE)","")
all: allmodes
else
all: components
endif
# run in silent mode if V=1 is not specified
ifneq ($(V),1)
MAKE += -s
endif
help:
@echo "$$HELP_SYNOPSYS"
@echo "$$HELP_OPP_TARGETS"
@echo "$$HELP_VARIABLES"
@echo "$$HELP_OPP_VARIABLES"
@echo "$$HELP_EXAMPLES"
allmodes:
@echo
@echo "Building release and debug mode executables. Type 'make help' for further options."
@echo
$(Q)$(MAKE) MODE=release
$(Q)$(MAKE) MODE=debug
@echo
@echo "Now you can type \"`echo $(OMNETPP_RELEASE) | sed 's/-.*//'`\" to start the IDE"
components: base
# Test if the samples directory exists and add dependencies to build it, too
ifneq ($(wildcard samples),)
components: samples
clean: clean-samples
cleanall: cleanall-samples
endif
# Test if the test directory exists and add dependencies to build it, too
ifneq ($(wildcard test),)
clean: clean-tests
cleanall: cleanall-tests
endif
#=====================================================================
#
# Includes and basic checks
#
#=====================================================================
include Makefile.inc
#=====================================================================
#
# OMNeT++ components
#
#=====================================================================
BASE=common layout eventlog scave nedxml sim envir cmdenv utils
SAMPLES=aloha canvas cqn dyna embedding embedding2 fifo hypercube histograms neddemo queueinglib queueinglibext routing tictoc sockets openstreetmap petrinets osg-intro osg-earth osg-indoor osg-satellites wiredphy
JNILIBS=org.omnetpp.ned.model org.omnetpp.ide.nativelibs
ifeq "$(WITH_QTENV)" "yes"
BASE+= qtenv
endif
# add systemc optionally
ifeq "$(WITH_SYSTEMC)" "yes"
ifneq "$(wildcard src/systemc)" ""
BASE+= systemc
SAMPLES+= systemc-embedding
systemc: sim
endif
endif
.PHONY: check-env cleanall cleanall-samples makefiles clean apis doc tests all allmodes \
components base ui uilibs samples common layout eventlog scave nedxml sim \
envir cmdenv qtenv utils systemc help
#
# Group targets.
#
base: $(BASE)
ifeq "$(SHARED_LIBS)" "yes"
@echo ===== Compiling opp_run ====
$(Q)cd $(OMNETPP_SRC_DIR)/envir && $(MAKE) opp_run_executable
endif
samples: $(SAMPLES)
ui:
$(Q)$(MAKE) $(MOPTS) $(MAKEFILE) BUILDING_UILIBS=yes uilibs
uilibs: $(JNILIBS)
ide:
@echo ===== Building IDE =====
$(Q)-rm releng/dist/*
$(Q)releng/build-omnetpp-ide-linux
$(Q)tar xfz releng/dist/*-omnetpp-*-src-linux.tgz $$(cat Version)/ide --strip-components=1
# dependencies (because of ver.h, opp_msgtool, etc)
common layout eventlog scave nedxml sim envir cmdenv qtenv systemc makefiles: utils
layout eventlog scave nedxml sim envir cmdenv qtenv: common
envir : sim
cmdenv qtenv: envir
qtenv: layout
sim : nedxml common
$(SAMPLES) : makefiles base
$(BASE) : check-env
queueinglibext : queueinglib
#
# Core libraries and programs
#
$(BASE):
@echo ===== Compiling $@ ====
$(Q)cd $(OMNETPP_SRC_DIR)/$@ && $(MAKE)
#
# Native libs for the UI
#
$(JNILIBS): nedxml scave layout eventlog common
@echo ===== Compiling $@ ====
$(Q)cd $(OMNETPP_UI_DIR)/$@ && $(MAKE) clean
$(Q)cd $(OMNETPP_UI_DIR)/$@ && $(MAKE)
#
# Sample programs
#
$(SAMPLES):
@echo ===== Compiling $@ ====
$(Q)cd $(OMNETPP_SAMPLES_DIR)/$@ && $(MAKE)
#
# Documentation
#
apis:
@echo ===== Building $@ ====
$(Q)cd $(OMNETPP_DOC_DIR)/src && $(MAKE) apis -j1
doc:
@echo ===== Building $@ ====
$(Q)cd $(OMNETPP_DOC_DIR)/src && $(MAKE) -j1
#
# Test
#
tests: base
@echo ===== Running $@ ====
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE)
#=====================================================================
#
# Utilities
#
#=====================================================================
check-env:
@echo "***** Configuration: MODE=$(MODE), TOOLCHAIN_NAME=$(TOOLCHAIN_NAME), SHARED_LIBS=$(SHARED_LIBS), LIB_SUFFIX=$(LIB_SUFFIX) ****"
@echo ===== Checking environment =====
@mkdir -p $(OMNETPP_BIN_DIR)
@probefile=__probe__; \
if (echo '#!/bin/sh' >$(OMNETPP_BIN_DIR)/$$probefile && \
chmod +x $(OMNETPP_BIN_DIR)/$$probefile) 2>/dev/null; then \
if $$probefile >/dev/null 2>/dev/null; then :; else \
echo 'ERROR: $(OMNETPP_BIN_DIR) is not in the path! You can add it by entering:'; \
echo ' export PATH=$(OMNETPP_BIN_DIR):$$PATH'; \
exit 1; \
fi; \
else \
echo 'ERROR: Cannot write to $(OMNETPP_BIN_DIR)! Please make sure it exists, and has write permission.'; \
exit 1; \
fi; \
rm -f $(OMNETPP_BIN_DIR)/$$probefile; \
clean:
$(Q)-rm -f $(OMNETPP_LIB_DIR)/*.*
$(Q)-rm -rf $(OMNETPP_OUT_DIR)/$(CONFIGNAME)
$(Q)-rm -rf $(OMNETPP_LIB_DIR)/$(CONFIGNAME)
$(Q)for i in $(BASE); do \
(cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
done
$(Q)-rm -f $(OMNETPP_BIN_DIR)/*
clean-tests: makefiles
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE) clean
clean-samples: makefiles
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && $(MAKE) clean); fi;\
done
cleanall:
$(Q)-rm -rf $(OMNETPP_OUT_DIR)
$(Q)-rm -rf $(OMNETPP_LIB_DIR)/*
$(Q)for i in $(BASE); do \
(cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
done
# bin should be removed last because opp_configfilepath (in bin directory) is needed to clean
$(Q)-rm -rf $(OMNETPP_BIN_DIR)/*
cleanall-tests: makefiles
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE) cleanall
cleanall-samples: makefiles
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && $(MAKE) cleanall && rm Makefile); fi;\
done
cleanui:
$(Q)for i in $(JNILIBS); do \
(cd $(OMNETPP_UI_DIR)/$$i && $(MAKE) clean); \
done
makefiles:
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/embedding && MAKE="$(MAKE)" opp_makemake -f --deep --nolink)
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/embedding2 && MAKE="$(MAKE)" opp_makemake -f --deep --nolink)
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglib && MAKE="$(MAKE)" opp_makemake -f --make-so -pQUEUEING -I.)
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglibext && MAKE="$(MAKE)" opp_makemake -f --make-so -I../queueinglib -L'../queueinglib' -l'queueinglib$$(D)' -KQUEUEINGLIB_PROJ=../queueinglib)
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queuenet && MAKE="$(MAKE)" opp_makemake -f -n)
$(Q)for i in $(filter-out embedding embedding2 queueinglib queueinglibext queuenet, $(SAMPLES)) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && MAKE="$(MAKE)" opp_makemake -f --deep); fi;\
done
# copy the documentation to the UI doc folder too.
# patch some files to have correct URLs and add generic eclipse stylesheet when needed
copy-ui-doc:
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/api
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/guides
$(Q)cp -r $(OMNETPP_DOC_DIR)/visual-changelog $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
$(Q)cp -r $(OMNETPP_DOC_DIR)/api $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
$(Q)cp -r $(OMNETPP_DOC_DIR)/src/manual/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
$(Q)cp -r $(OMNETPP_ROOT)/out/doc/eclipsehelp $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/guides
$(Q)echo "<html><body><pre>" >$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
$(Q)cat $(OMNETPP_DOC_DIR)/License >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
$(Q)echo "</pre></body></html>" >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
$(Q)perl -i -pe 's!<head>!<head><link rel="STYLESHEET" href="book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/WhatsNew.html
$(Q)perl -i -pe 's!href="!href="content/manual/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual/toc.xml
ifeq ($(findstring linux,$(PLATFORM)),linux)
generate-desktop-file:
@echo "[Desktop Entry]\nEncoding=UTF-8\nType=Application\nExec=$(OMNETPP_BIN_DIR)/omnetpp\nIcon=$(OMNETPP_ROOT)/ide/icon.png\nName=$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE\nCategories=Development;IDE;Debugger\n" >opensim-ide.desktop
install-menu-item: generate-desktop-file
@xdg-desktop-menu uninstall opensim-ide.desktop
@xdg-desktop-menu install opensim-ide.desktop
@rm opensim-ide.desktop
install-desktop-icon: generate-desktop-file
@xdg-desktop-icon uninstall opensim-ide.desktop
@xdg-desktop-icon install opensim-ide.desktop
@rm opensim-ide.desktop
else ifeq ($(findstring macosx,$(PLATFORM)),macosx)
install-menu-item:
ifeq ($(OMNETPP_PRODUCT),OMNEST)
-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
else
-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
endif
install-desktop-icon:
ifeq ($(OMNETPP_PRODUCT),OMNEST)
-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
else
-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
endif
else ifeq ($(findstring win32,$(PLATFORM)),win32)
endif