Statistics
| Branch: | Revision:

root / Makefile @ 96cc8d6f

History | View | Annotate | Download (8.96 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

    
92
#
93
# Documentation
94
#
95
apis:
96
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE) apis
97

    
98
docu:
99
	cd $(OMNETPP_DOC_DIR)/src && $(MAKE)
100

    
101
#
102
# Test
103
#
104
tests: base
105
	cd $(OMNETPP_TEST_DIR) && $(MAKE)
106

    
107
#=====================================================================
108
#
109
# Utilities
110
#
111
#=====================================================================
112

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

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

    
134
clean: makefiles
135
	-rm -f $(OMNETPP_LIB_DIR)/*.*
136
	-rm -rf $(OMNETPP_OUT_DIR)/$(CONFIGNAME)
137
	-rm -rf $(OMNETPP_LIB_DIR)/$(CONFIGNAME)
138
	for i in $(BASE); do \
139
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) clean); \
140
	done
141

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

    
149
# bin should be removed last because opp_configfilepath (in bin directory) is needed to clean
150
	-rm -rf $(OMNETPP_BIN_DIR)/*
151

    
152

    
153
depend:
154
	for i in $(BASE); do \
155
	    (cd $(OMNETPP_SRC_DIR)/$$i && $(MAKE) depend); \
156
	done
157

    
158
makefiles:
159

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

    
201
ifeq ($(findstring linux,$(PLATFORM)),linux)
202

    
203
generate-desktop-file:
204
	@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
205

    
206
install-menu-item: generate-desktop-file
207
	@xdg-desktop-menu uninstall opensim-ide.desktop
208
	@xdg-desktop-menu install opensim-ide.desktop
209
	@rm opensim-ide.desktop
210

    
211
install-desktop-icon: generate-desktop-file
212
	@xdg-desktop-icon uninstall opensim-ide.desktop
213
	@xdg-desktop-icon install opensim-ide.desktop
214
	@rm opensim-ide.desktop
215

    
216
else ifeq ($(findstring macosx,$(PLATFORM)),macosx)
217

    
218
install-menu-item:
219
ifeq ($(OMNETPP_PRODUCT),OMNEST)
220
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
221
else
222
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app /Applications/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
223
endif
224

    
225
install-desktop-icon:
226
ifeq ($(OMNETPP_PRODUCT),OMNEST)
227
	-ln -s -f $(OMNETPP_ROOT)/ide/omnest.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
228
else
229
	-ln -s -f $(OMNETPP_ROOT)/ide/omnetpp.app ~/Desktop/'$(OMNETPP_PRODUCT) $(OMNETPP_VERSION) IDE'
230
endif
231

    
232
else ifeq ($(findstring win32,$(PLATFORM)),win32)
233

    
234
endif