-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
294 lines (247 loc) · 10.7 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
287
288
289
290
291
292
293
294
#
# Toplevel makefile for OMNeT++ libraries and programs
#
# Use MODE=release or MODE=debug on the command line to build only
# release or debug mode binaries.
# Use V=1 to print all commands executed by the makefile.
#
#=====================================================================
#=====================================================================
#
# 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
allmodes:
$(MAKE) MODE=release
$(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 osg-intro osg-earth osg-indoor osg-satellites
JNILIBS=org.omnetpp.ned.model org.omnetpp.ide.nativelibs
ifeq "$(WITH_TKENV)" "yes"
BASE+= tkenv
endif
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 docu tests all allmodes \
components base ui uilibs samples common layout eventlog scave nedxml sim \
envir cmdenv tkenv qtenv utils systemc
#
# 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)
# dependencies (because of ver.h, opp_msgtool, etc)
common layout eventlog scave nedxml sim envir cmdenv tkenv qtenv systemc makefiles: utils
layout eventlog scave nedxml sim envir cmdenv tkenv qtenv: common
envir : sim
cmdenv tkenv qtenv: envir
tkenv 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
docu:
@echo ===== Building $@ ====
$(Q)cd $(OMNETPP_DOC_DIR)/src && $(MAKE)
#
# Test
#
tests: base
@echo ===== Running $@ ====
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE)
#=====================================================================
#
# Utilities
#
#=====================================================================
check-env:
@echo "***** Configuration: MODE=$(MODE), TOOLCHAIN_NAME=$(TOOLCHAIN_NAME), 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) clean
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 && (test -f Makefile || (MAKE="$(MAKE)" opp_makemake -f --deep --nolink)))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/embedding2 && (test -f Makefile || (MAKE="$(MAKE)" opp_makemake -f --deep --nolink)))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglib && (test -f Makefile || (MAKE="$(MAKE)" opp_makemake -f --make-so -pQUEUEING -I.)))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglibext && (test -f Makefile || (MAKE="$(MAKE)" opp_makemake -f --make-so -I../queueinglib -L'../queueinglib' -l'queueinglib$$(D)' -KQUEUEINGLIB_PROJ=../queueinglib)))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queuenet && (test -f Makefile || (MAKE="$(MAKE)" opp_makemake -f -n)))
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && (test -f Makefile || (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-docu:
$(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/userguide
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-overview
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
$(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_DOC_DIR)/src/userguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
$(Q)cp -r $(OMNETPP_DOC_DIR)/ide-overview $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
$(Q)cp -r $(OMNETPP_DOC_DIR)/src/ide-customization-guide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
$(Q)cp -r $(OMNETPP_DOC_DIR)/src/ide-developersguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
$(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)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/plugin.xml
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/plugin.xml
$(Q)rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/plugin.xml
$(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!<head>!<head><link rel="STYLESHEET" href="../book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-overview/*.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/ide-changelog/*.html
$(Q)perl -i -pe 's!href="!href="content/manual/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual/toc.xml
$(Q)perl -i -pe 's!href="!href="content/userguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/toc.xml
$(Q)perl -i -pe 's!<head>!<head><link rel="STYLESHEET" href="../book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/*.html
$(Q)perl -i -pe 's!href="!href="content/ide-customization-guide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/toc.xml
$(Q)perl -i -pe 's!<head>!<head><link rel="STYLESHEET" href="../book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/*.html
$(Q)perl -i -pe 's!href="!href="content/ide-developersguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/toc.xml
$(Q)perl -i -pe 's!<head>!<head><link rel="STYLESHEET" href="../book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/*.html
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