Statistics
| Branch: | Revision:

root / Makefile @ master

History | View | Annotate | Download (9.38 KB)

1 01873262 Georg Kunz
#
2
# Toplevel makefile for OMNeT++ libraries and programs
3
#
4
#=====================================================================
5
6
#=====================================================================
7
#
8
# Main targets
9
#
10
#=====================================================================
11
12
ifeq ("$(MODE)","")
13
all: allmodes
14
else
15
all: components
16
endif
17
18
allmodes:
19
	$(MAKE) MODE=release
20
	$(MAKE) MODE=debug
21
22
components: base
23
24
#=====================================================================
25
#
26
# Includes and basic checks
27
#
28
#=====================================================================
29
30
include Makefile.inc
31
32
# Make sure that output locations are set
33
ifeq ("$(strip $(OMNETPP_BIN_DIR))","")
34
$(error OMNETPP_BIN_DIR must be correctly set)
35
endif
36
ifeq ("$(strip $(OMNETPP_OUT_DIR))","")
37
$(error OMNETPP_OUT_DIR must be correctly set)
38
endif
39
ifeq ("$(strip $(OMNETPP_LIB_DIR))","")
40
$(error OMNETPP_LIB_DIR must be correctly set)
41
endif
42
#=====================================================================
43
#
44
# OMNeT++ components
45
#
46
#=====================================================================
47
48
BASE=common layout eventlog scave nedxml sim envir cmdenv tkenv utils
49
50
SAMPLES=
51
JNILIBS=org.omnetpp.ned.model org.omnetpp.ide.nativelibs
52
53
#
54
# Group targets.
55
#
56
base: $(BASE)
57
	cd $(OMNETPP_SRC_DIR)/envir && $(MAKE) opp_run_executable
58
59
ui: check-ui-vars common layout eventlog scave nedxml $(JNILIBS)
60
61
# dependencies (because of ver.h, opp_msgc, etc)
62
clean depend: makefiles
63
common layout eventlog scave nedxml sim envir cmdenv tkenv makefiles: utils
64
layout eventlog scave nedxml sim envir cmdenv tkenv : common
65
envir : sim
66
cmdenv tkenv : envir
67
tkenv : layout
68
sim : nedxml common
69
$(BASE) : check-env
70
queueinglibext : queueinglib
71
72
.PHONY: check-env cleanall depend makefiles clean apis docu tests all allmodes \
73
        components base ui common layout eventlog scave nedxml sim \
74
        envir cmdenv tkenv utils
75
76
#
77
# Core libraries and programs
78
#
79
$(BASE):
80
	@echo ===== Compiling $@ ====
81
	cd $(OMNETPP_SRC_DIR)/$@ && $(MAKE)
82
83
#
84
# Native libs for the UI
85
#
86
$(JNILIBS): nedxml
87
	@echo ===== Compiling $@ ====
88
	cd $(OMNETPP_UI_DIR)/$@ && $(MAKE) clean
89
	cd $(OMNETPP_UI_DIR)/$@ && $(MAKE)
90
91 63d0f40e Georg Kunz
nativelibs: nedxml
92
	@echo ===== Compiling $@ =====
93
	cd ide/org.omnetpp.ide.nativelibs && $(MAKE)
94
	
95
nativelibs-clean:
96
	cd ide/org.omnetpp.ide.nativelibs && $(MAKE) clean	
97 01873262 Georg Kunz
98 8f424055 Georg Kunz
install-plugins:
99
	cp ide/org.omnetpp.ide.nativelibs/bin/$(PLATFORM)/* ide/plugins/org.omnetpp.ide.nativelibs.$(PLATFORM)_4.1.0.100611-4b63c38
100
	cp ide/org.omnetpp.ide.nativelibs/bin/*.jar ide/plugins/
101
	cp ide/org.omnetpp.sequencechart/bin/*.jar ide/plugins/
102
103 01873262 Georg Kunz
#
104
# Documentation
105
#
106
apis:
107
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE) apis
108
109
docu:
110
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE)
111
112
#
113
# Test
114
#
115
tests: base
116
	cd $(OMNETPP_TEST_DIR) && $(MAKE)
117
118
#=====================================================================
119
#
120
# Utilities
121
#
122
#=====================================================================
123
124
check-ui-vars:
125
	@if [ "$(BUILDING_UILIBS)" != "yes" ]; then echo 'ERROR: "make ui" must be invoked with BUILDING_UILIBS=yes!' && exit 1; fi
126
127
check-env:
128
	@echo "***** Configuration: MODE=$(MODE), TOOLCHAIN_NAME=$(TOOLCHAIN_NAME), LIB_SUFFIX=$(LIB_SUFFIX) ****"
129
	@echo ===== Checking environment =====
130
	mkdir -p $(OMNETPP_BIN_DIR)
131
	@probefile=__probe__; \
132
	if (echo '#!/bin/sh' >$(OMNETPP_BIN_DIR)/$$probefile && \
133
	    chmod +x $(OMNETPP_BIN_DIR)/$$probefile) 2>/dev/null; then \
134
	  if $$probefile >/dev/null 2>/dev/null; then :; else \
135
	    echo 'ERROR: $(OMNETPP_BIN_DIR) is not in the path! You can add it by entering:'; \
136
	    echo '   export PATH=$(OMNETPP_BIN_DIR):$$PATH'; \
137
	    exit 1; \
138
	  fi; \
139
	else \
140
	  echo 'ERROR: Cannot write to $(OMNETPP_BIN_DIR)! Please make sure it exists, and has write permission.'; \
141
	  exit 1; \
142
	fi; \
143
	rm -f $(OMNETPP_BIN_DIR)/$$probefile; \
144
145
clean: makefiles
146
	-rm -f $(OMNETPP_LIB_DIR)/*.*
147
	-rm -rf $(OMNETPP_OUT_DIR)/$(CONFIGNAME)
148
	-rm -rf $(OMNETPP_LIB_DIR)/$(CONFIGNAME)
149
	for i in $(BASE); do \
150
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
151
	done
152
153
cleanall: makefiles
154
	-rm -rf $(OMNETPP_OUT_DIR)
155
	-rm -rf $(OMNETPP_LIB_DIR)/*
156
	for i in $(BASE); do \
157
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
158
	done
159
160
# bin should be removed last because opp_configfilepath (in bin directory) is needed to clean
161
	-rm -rf $(OMNETPP_BIN_DIR)/*
162
163
164
depend:
165
	for i in $(BASE); do \
166
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) depend); \
167
	done
168
169
makefiles:
170
171
# copy the documentation to the UI doc folder too.
172
# patch some files to have correct URLs and add generic eclipse stylsheet when needed
173
copy-ui-docu:
174
	txt2html $(OMNETPP_DOC_DIR)/WhatsNew --outfile $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/WhatsNew.html
175
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/api
176
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
177
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
178
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
179
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/tictoc-tutorial
180
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-overview
181
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
182
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
183
	cp -r $(OMNETPP_DOC_DIR)/ide-changelog $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
184
	cp -r $(OMNETPP_DOC_DIR)/api $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
185
	cp -r $(OMNETPP_DOC_DIR)/src/manual/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
186
	cp -r $(OMNETPP_DOC_DIR)/src/userguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
187
	cp -r $(OMNETPP_DOC_DIR)/src/migrationguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
188
	cp -r $(OMNETPP_DOC_DIR)/tictoc-tutorial $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
189
	cp -r $(OMNETPP_DOC_DIR)/ide-overview $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
190
	cp -r $(OMNETPP_DOC_DIR)/src/ide-customization-guide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
191
	cp -r $(OMNETPP_DOC_DIR)/src/ide-developersguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
192
	echo "<html><body><pre>" >$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
193
	cat $(OMNETPP_DOC_DIR)/License >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
194
	echo "</pre></body></html>" >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
195
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/plugin.xml
196
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/plugin.xml
197
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/plugin.xml
198
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/plugin.xml
199
	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
200
	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
201
	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
202
	perl -i -pe 's!href="!href="content/manual/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual/toc.xml
203
	perl -i -pe 's!href="!href="content/userguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/toc.xml
204
	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
205
	perl -i -pe 's!href="!href="content/migration/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/toc.xml
206
	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
207
	perl -i -pe 's!href="!href="content/ide-customization-guide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/toc.xml
208
	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
209
	perl -i -pe 's!href="!href="content/ide-developersguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/toc.xml
210
	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
211
212
ifeq ($(findstring linux,$(PLATFORM)),linux)
213
214
generate-desktop-file:
215
	@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
216
217
install-menu-item: generate-desktop-file
218
	@xdg-desktop-menu uninstall opensim-ide.desktop
219
	@xdg-desktop-menu install opensim-ide.desktop
220
	@rm opensim-ide.desktop
221
222
install-desktop-icon: generate-desktop-file
223
	@xdg-desktop-icon uninstall opensim-ide.desktop
224
	@xdg-desktop-icon install opensim-ide.desktop
225
	@rm opensim-ide.desktop
226
227
else ifeq ($(findstring macosx,$(PLATFORM)),macosx)
228
229
install-menu-item:
230
ifeq ($(OMNETPP_PRODUCT),OMNEST)
231
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
232
else
233
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
234
endif
235
236
install-desktop-icon:
237
ifeq ($(OMNETPP_PRODUCT),OMNEST)
238
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
239
else
240
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
241
endif
242
243
else ifeq ($(findstring win32,$(PLATFORM)),win32)
244
245
endif