-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathMakefile
288 lines (247 loc) · 11.1 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
#
# 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
allmodes:
$(MAKE) MODE=release
$(MAKE) MODE=debug
@echo
@echo "Now you can type \"`echo $(OMNETPP_RELEASE) | sed 's/-.*//'`\" to start the IDE"
components: base samples
#=====================================================================
#
# Includes and basic checks
#
#=====================================================================
include Makefile.inc
# Make sure that output locations are set
ifeq ("$(strip $(OMNETPP_BIN_DIR))","")
$(error OMNETPP_BIN_DIR must be correctly set)
endif
ifeq ("$(strip $(OMNETPP_OUT_DIR))","")
$(error OMNETPP_OUT_DIR must be correctly set)
endif
ifeq ("$(strip $(OMNETPP_LIB_DIR))","")
$(error OMNETPP_LIB_DIR must be correctly set)
endif
#=====================================================================
#
# OMNeT++ components
#
#=====================================================================
BASE=common layout eventlog scave nedxml sim envir cmdenv tkenv utils
SAMPLES=aloha cqn dyna embedding embedding2 fifo google-earth hypercube histograms neddemo queueinglib queueinglibext routing tictoc sockets
JNILIBS=org.omnetpp.ned.model org.omnetpp.ide.nativelibs
# add systemc optionally
ifeq "$(SYSTEMC)" "yes"
ifneq "$(wildcard src/systemc)" ""
BASE+= systemc
SAMPLES+= systemc-embedding
systemc: sim
endif
endif
#
# Group targets.
#
base: $(BASE)
cd $(OMNETPP_SRC_DIR)/envir && $(MAKE) opp_run_executable
samples: $(SAMPLES)
opplibs:
$(MAKE) $(MOPTS) $(MAKEFILE) BUILDING_UILIBS=yes ui
ui: check-ui-vars common layout eventlog scave nedxml $(JNILIBS)
# dependencies (because of ver.h, opp_msgc, etc)
clean depend: makefiles
common layout eventlog scave nedxml sim envir cmdenv tkenv systemc makefiles: utils
layout eventlog scave nedxml sim envir cmdenv tkenv : common
envir : sim
cmdenv tkenv : envir
tkenv : layout
sim : nedxml common
$(SAMPLES) : makefiles base
$(BASE) : check-env
queueinglibext : queueinglib
.PHONY: check-env cleanall depend makefiles clean apis docu tests all allmodes \
components base ui samples common layout eventlog scave nedxml sim \
envir cmdenv tkenv utils systemc
#
# Core libraries and programs
#
$(BASE):
@echo ===== Compiling $@ ====
$(Q)cd $(OMNETPP_SRC_DIR)/$@ && $(MAKE)
#
# Native libs for the UI
#
$(JNILIBS): nedxml
@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-ui-vars:
@if [ "$(BUILDING_UILIBS)" != "yes" ]; then echo 'ERROR: "make ui" must be invoked with BUILDING_UILIBS=yes!' && exit 1; fi
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: makefiles
$(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)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && $(MAKE) clean); fi;\
done
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE) clean
$(Q)-rm -f $(OMNETPP_BIN_DIR)/*
cleanall: makefiles
$(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
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && $(MAKE) cleanall); fi;\
done
$(Q)cd $(OMNETPP_TEST_DIR) && $(MAKE) clean
# bin should be removed last because opp_configfilepath (in bin directory) is needed to clean
-rm -rf $(OMNETPP_BIN_DIR)/*
cleanui:
for i in $(JNILIBS); do \
(cd $(OMNETPP_UI_DIR)/$$i && $(MAKE) clean); \
done
depend:
$(Q)for i in $(BASE); do \
(cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) depend); \
done
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && $(MAKE) depend); fi;\
done
makefiles:
$(Q)for i in $(SAMPLES) ""; do \
if [ "$$i" != "" ]; then (cd $(OMNETPP_SAMPLES_DIR)/$$i && (opp_makemake -f --deep)); fi;\
done
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/embedding && (opp_makemake -f --deep --nolink))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/embedding2 && (opp_makemake -f --deep --nolink))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/google-earth && (opp_makemake -f -o google-earth-demo))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglib && (opp_makemake -f --make-so))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queueinglibext && (opp_makemake -f --make-so -I../queueinglib -L../queueinglib/out/$(CONFIGNAME) -lqueueinglib -KQUEUEINGLIB_PROJ=../queueinglib))
$(Q)(cd $(OMNETPP_SAMPLES_DIR)/queuenet && (opp_makemake -f -n))
# 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:
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/api
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/tictoc-tutorial
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-overview
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
cp -r $(OMNETPP_DOC_DIR)/ide-changelog $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
cp -r $(OMNETPP_DOC_DIR)/api $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
cp -r $(OMNETPP_DOC_DIR)/src/manual/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
cp -r $(OMNETPP_DOC_DIR)/src/userguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
cp -r $(OMNETPP_DOC_DIR)/src/migrationguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
cp -r $(OMNETPP_DOC_DIR)/tictoc-tutorial $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
cp -r $(OMNETPP_DOC_DIR)/ide-overview $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
cp -r $(OMNETPP_DOC_DIR)/src/ide-customization-guide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
cp -r $(OMNETPP_DOC_DIR)/src/ide-developersguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
echo "<html><body><pre>" >$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
cat $(OMNETPP_DOC_DIR)/License >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
echo "</pre></body></html>" >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/plugin.xml
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/plugin.xml
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/plugin.xml
rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/plugin.xml
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
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
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
perl -i -pe 's!href="!href="content/manual/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual/toc.xml
perl -i -pe 's!href="!href="content/userguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/toc.xml
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
perl -i -pe 's!href="!href="content/migration/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/toc.xml
perl -i -pe 's!<head>!<head><link rel="STYLESHEET" href="../book.css" type="text/css"/>!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/*.html
perl -i -pe 's!href="!href="content/ide-customization-guide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/toc.xml
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
perl -i -pe 's!href="!href="content/ide-developersguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/toc.xml
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