Project

General

Profile

Statistics
| Branch: | Revision:

root / Makefile @ 63d0f40e

History | View | Annotate | Download (9.13 KB)

1
#
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
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

    
98
#
99
# Documentation
100
#
101
apis:
102
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE) apis
103

    
104
docu:
105
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE)
106

    
107
#
108
# Test
109
#
110
tests: base
111
	cd $(OMNETPP_TEST_DIR) && $(MAKE)
112

    
113
#=====================================================================
114
#
115
# Utilities
116
#
117
#=====================================================================
118

    
119
check-ui-vars:
120
	@if [ "$(BUILDING_UILIBS)" != "yes" ]; then echo 'ERROR: "make ui" must be invoked with BUILDING_UILIBS=yes!' && exit 1; fi
121

    
122
check-env:
123
	@echo "***** Configuration: MODE=$(MODE), TOOLCHAIN_NAME=$(TOOLCHAIN_NAME), LIB_SUFFIX=$(LIB_SUFFIX) ****"
124
	@echo ===== Checking environment =====
125
	mkdir -p $(OMNETPP_BIN_DIR)
126
	@probefile=__probe__; \
127
	if (echo '#!/bin/sh' >$(OMNETPP_BIN_DIR)/$$probefile && \
128
	    chmod +x $(OMNETPP_BIN_DIR)/$$probefile) 2>/dev/null; then \
129
	  if $$probefile >/dev/null 2>/dev/null; then :; else \
130
	    echo 'ERROR: $(OMNETPP_BIN_DIR) is not in the path! You can add it by entering:'; \
131
	    echo '   export PATH=$(OMNETPP_BIN_DIR):$$PATH'; \
132
	    exit 1; \
133
	  fi; \
134
	else \
135
	  echo 'ERROR: Cannot write to $(OMNETPP_BIN_DIR)! Please make sure it exists, and has write permission.'; \
136
	  exit 1; \
137
	fi; \
138
	rm -f $(OMNETPP_BIN_DIR)/$$probefile; \
139

    
140
clean: makefiles
141
	-rm -f $(OMNETPP_LIB_DIR)/*.*
142
	-rm -rf $(OMNETPP_OUT_DIR)/$(CONFIGNAME)
143
	-rm -rf $(OMNETPP_LIB_DIR)/$(CONFIGNAME)
144
	for i in $(BASE); do \
145
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
146
	done
147

    
148
cleanall: makefiles
149
	-rm -rf $(OMNETPP_OUT_DIR)
150
	-rm -rf $(OMNETPP_LIB_DIR)/*
151
	for i in $(BASE); do \
152
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
153
	done
154

    
155
# bin should be removed last because opp_configfilepath (in bin directory) is needed to clean
156
	-rm -rf $(OMNETPP_BIN_DIR)/*
157

    
158

    
159
depend:
160
	for i in $(BASE); do \
161
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) depend); \
162
	done
163

    
164
makefiles:
165

    
166
# copy the documentation to the UI doc folder too.
167
# patch some files to have correct URLs and add generic eclipse stylsheet when needed
168
copy-ui-docu:
169
	txt2html $(OMNETPP_DOC_DIR)/WhatsNew --outfile $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/WhatsNew.html
170
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/api
171
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
172
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
173
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
174
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/tictoc-tutorial
175
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-overview
176
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
177
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
178
	cp -r $(OMNETPP_DOC_DIR)/ide-changelog $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
179
	cp -r $(OMNETPP_DOC_DIR)/api $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
180
	cp -r $(OMNETPP_DOC_DIR)/src/manual/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual
181
	cp -r $(OMNETPP_DOC_DIR)/src/userguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide
182
	cp -r $(OMNETPP_DOC_DIR)/src/migrationguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration
183
	cp -r $(OMNETPP_DOC_DIR)/tictoc-tutorial $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
184
	cp -r $(OMNETPP_DOC_DIR)/ide-overview $(OMNETPP_UI_DIR)/org.omnetpp.doc/content
185
	cp -r $(OMNETPP_DOC_DIR)/src/ide-customization-guide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide
186
	cp -r $(OMNETPP_DOC_DIR)/src/ide-developersguide/eclipse $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide
187
	echo "<html><body><pre>" >$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
188
	cat $(OMNETPP_DOC_DIR)/License >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
189
	echo "</pre></body></html>" >>$(OMNETPP_UI_DIR)/org.omnetpp.doc/content/License.html
190
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/plugin.xml
191
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/plugin.xml
192
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/plugin.xml
193
	rm -rf $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/plugin.xml
194
	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
195
	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
196
	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
197
	perl -i -pe 's!href="!href="content/manual/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/manual/toc.xml
198
	perl -i -pe 's!href="!href="content/userguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/userguide/toc.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/userguide/*.html
200
	perl -i -pe 's!href="!href="content/migration/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/migration/toc.xml
201
	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
202
	perl -i -pe 's!href="!href="content/ide-customization-guide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-customization-guide/toc.xml
203
	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
204
	perl -i -pe 's!href="!href="content/ide-developersguide/!gi' $(OMNETPP_UI_DIR)/org.omnetpp.doc/content/ide-developersguide/toc.xml
205
	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
206

    
207
ifeq ($(findstring linux,$(PLATFORM)),linux)
208

    
209
generate-desktop-file:
210
	@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
211

    
212
install-menu-item: generate-desktop-file
213
	@xdg-desktop-menu uninstall opensim-ide.desktop
214
	@xdg-desktop-menu install opensim-ide.desktop
215
	@rm opensim-ide.desktop
216

    
217
install-desktop-icon: generate-desktop-file
218
	@xdg-desktop-icon uninstall opensim-ide.desktop
219
	@xdg-desktop-icon install opensim-ide.desktop
220
	@rm opensim-ide.desktop
221

    
222
else ifeq ($(findstring macosx,$(PLATFORM)),macosx)
223

    
224
install-menu-item:
225
ifeq ($(OMNETPP_PRODUCT),OMNEST)
226
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
227
else
228
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
229
endif
230

    
231
install-desktop-icon:
232
ifeq ($(OMNETPP_PRODUCT),OMNEST)
233
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
234
else
235
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
236
endif
237

    
238
else ifeq ($(findstring win32,$(PLATFORM)),win32)
239

    
240
endif