1 | # $Id: Makefile.kmk 4589 2007-09-06 18:53:16Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Makefile for the VirtualBox Qt GUI.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License as published by the Free Software Foundation,
|
---|
13 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 |
|
---|
17 | # include qmake project file
|
---|
18 | include VBoxUI.pro
|
---|
19 |
|
---|
20 | # Import QDesigner UI sources
|
---|
21 | VirtualBox_QT_UISRCS := $(FORMS)
|
---|
22 | # Import translation sources
|
---|
23 | VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
|
---|
24 | # Import images
|
---|
25 | VirtualBox_QT_IMAGES := $(IMAGES)
|
---|
26 |
|
---|
27 | # reset things to avoid possible conflicts with kBuild
|
---|
28 | TEMPLATE :=
|
---|
29 | LANGUAGE :=
|
---|
30 | FORMS :=
|
---|
31 | TRANSLATIONS :=
|
---|
32 | IMAGES :=
|
---|
33 |
|
---|
34 | DEPTH = ../../../..
|
---|
35 | include $(PATH_KBUILD)/header.kmk
|
---|
36 |
|
---|
37 | PROGRAMS = VirtualBox
|
---|
38 | DLLS.linux = VBoxKeyboard
|
---|
39 |
|
---|
40 | INSTALLS = VirtualBox.nls
|
---|
41 |
|
---|
42 | VBoxKeyboard_TEMPLATE = VBOXR3
|
---|
43 | VBoxKeyboard_SOURCES = \
|
---|
44 | src/linux/keyboard.c
|
---|
45 |
|
---|
46 | VirtualBox_TEMPLATE = VBOXQTGUIEXE
|
---|
47 | VirtualBox_SDKS.win = WINPSDK DXSDK
|
---|
48 | VirtualBox_SDKS.linux = LIBSDL
|
---|
49 | VirtualBox_SDKS.os2 = LIBSDL
|
---|
50 |
|
---|
51 | ifeq ($(BUILD_TARGET),darwin)
|
---|
52 | # For the launch trick we need different inode numbers.
|
---|
53 | VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
|
---|
54 | endif
|
---|
55 |
|
---|
56 | ifeq ($(VBOX_OSE),)
|
---|
57 | ifeq ($(BUILD_TARGET),linux)
|
---|
58 | # Note: I'm doing this right here because the GUI will _not_ run
|
---|
59 | # without that file which might be annoying for developers!
|
---|
60 | $(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
|
---|
61 | endif
|
---|
62 | endif
|
---|
63 |
|
---|
64 | # Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
|
---|
65 | VirtualBox_QT_TRANSLATIONS_QT := \
|
---|
66 | $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
|
---|
67 | $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
|
---|
68 |
|
---|
69 | # QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
|
---|
70 |
|
---|
71 | # Headers containing definitions of classes that use the Q_OBJECT macro
|
---|
72 | VirtualBox_QT_MOCHDRS = \
|
---|
73 | include/QIWidgetValidator.h \
|
---|
74 | include/QIHotKeyEdit.h \
|
---|
75 | include/QIStatusBar.h \
|
---|
76 | include/QIStateIndicator.h \
|
---|
77 | include/QIMessageBox.h \
|
---|
78 | include/QIRichLabel.h \
|
---|
79 | include/VBoxGlobalSettings.h \
|
---|
80 | include/VBoxUtils.h \
|
---|
81 | include/VBoxGlobal.h \
|
---|
82 | include/VBoxVMListBox.h \
|
---|
83 | include/VBoxMediaComboBox.h \
|
---|
84 | include/VBoxSelectorWnd.h \
|
---|
85 | include/VBoxConsoleWnd.h \
|
---|
86 | include/VBoxConsoleView.h \
|
---|
87 | include/VBoxProblemReporter.h \
|
---|
88 | include/VBoxDownloaderWgt.h
|
---|
89 |
|
---|
90 | # Sources containing local definitions of classes that use the Q_OBJECT macro
|
---|
91 | VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
|
---|
92 | ifeq ($(BUILD_TARGET),linux)
|
---|
93 | VirtualBox_QT_MOCSRCS += src/VBoxGlobal.cpp
|
---|
94 | endif
|
---|
95 | ifdef VBOX_WITH_XPCOM
|
---|
96 | VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
|
---|
97 | endif
|
---|
98 |
|
---|
99 | # UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
|
---|
100 | VirtualBox_QT_MOCUIHDRS = \
|
---|
101 | ui/VBoxVMSettingsDlg.ui.h \
|
---|
102 | ui/VBoxVMLogViewer.ui.h \
|
---|
103 | ui/VBoxSharedFoldersSettings.ui.h
|
---|
104 |
|
---|
105 |
|
---|
106 | # All generated sources. Note: this list MUST be in sync with Qt source
|
---|
107 | # generation rules defined somewhere below!
|
---|
108 | VirtualBox_GENSRCS = \
|
---|
109 | $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
|
---|
110 | $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
|
---|
111 | $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
|
---|
112 |
|
---|
113 | # All generated headers. Note: this list MUST be in sync with Qt source
|
---|
114 | # generation rules defined somewhere below!
|
---|
115 | VirtualBox_GENHDRS = \
|
---|
116 | $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
|
---|
117 | $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
|
---|
118 | $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
|
---|
119 |
|
---|
120 | # All existing .ui.h files for known .ui sources
|
---|
121 | VirtualBox_QT_UIHDRS = \
|
---|
122 | $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
|
---|
123 |
|
---|
124 | # All header files
|
---|
125 | VirtualBox_HEADERS = \
|
---|
126 | $(wildcard include/*.h) \
|
---|
127 | $(VirtualBox_GENHDRS) \
|
---|
128 | $(VirtualBox_QT_UIHDRS)
|
---|
129 |
|
---|
130 |
|
---|
131 | VirtualBox_SOURCES = \
|
---|
132 | $(VirtualBox_GENSRCS) \
|
---|
133 | src/main.cpp \
|
---|
134 | src/COMDefs.cpp \
|
---|
135 | src/QIWidgetValidator.cpp \
|
---|
136 | src/QIHotKeyEdit.cpp \
|
---|
137 | src/QIStateIndicator.cpp \
|
---|
138 | src/QIStatusBar.cpp \
|
---|
139 | src/QIMessageBox.cpp \
|
---|
140 | src/QIRichLabel.cpp \
|
---|
141 | src/VBoxDefs.cpp \
|
---|
142 | src/VBoxGlobalSettings.cpp \
|
---|
143 | src/VBoxGlobal.cpp \
|
---|
144 | src/VBoxMediaComboBox.cpp \
|
---|
145 | src/VBoxProblemReporter.cpp \
|
---|
146 | src/VBoxSelectorWnd.cpp \
|
---|
147 | src/VBoxConsoleView.cpp \
|
---|
148 | src/VBoxConsoleWnd.cpp \
|
---|
149 | src/VBoxDownloaderWgt.cpp \
|
---|
150 | src/VBoxVMListBox.cpp \
|
---|
151 | src/VBoxFrameBuffer.cpp \
|
---|
152 | src/HappyHttp.cpp
|
---|
153 |
|
---|
154 | VirtualBox_SOURCES.win += \
|
---|
155 | src/win32/VirtualBox.rc
|
---|
156 |
|
---|
157 | VirtualBox_SOURCES.win += \
|
---|
158 | src/VBoxFBDDRAW.cpp
|
---|
159 |
|
---|
160 | VirtualBox_SOURCES.linux = \
|
---|
161 | src/linux/XKeyboard.cpp
|
---|
162 |
|
---|
163 | VirtualBox_SOURCES.darwin = \
|
---|
164 | src/darwin/DarwinKeyboard.cpp \
|
---|
165 | src/darwin/DarwinCursor.cpp \
|
---|
166 | src/darwin/VBoxAquaStyle.cpp \
|
---|
167 | src/darwin/VBoxUtils-darwin.cpp
|
---|
168 |
|
---|
169 | src/HappyHttp.cpp_CXXFLAGS.linux += -fexceptions -O2
|
---|
170 | src/HappyHttp.cpp_CXXFLAGS.darwin += -fexceptions
|
---|
171 | src/HappyHttp.cpp_CXXFLAGS.os2 += -fexceptions
|
---|
172 | src/VBoxDownloaderWgt.cpp_CXXFLAGS.linux += -fexceptions
|
---|
173 | src/VBoxDownloaderWgt.cpp_CXXFLAGS.darwin += -fexceptions
|
---|
174 | src/VBoxDownloaderWgt.cpp_CXXFLAGS.os2 += -fexceptions
|
---|
175 |
|
---|
176 | ## @todo how to detect what tool is used?
|
---|
177 | ## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
|
---|
178 | # more generic -Wno-extra
|
---|
179 | ifdef VBOX_WITH_XPCOM
|
---|
180 | src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
|
---|
181 | endif
|
---|
182 |
|
---|
183 | VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
|
---|
184 | VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
|
---|
185 | VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
|
---|
186 | VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
|
---|
187 | VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
|
---|
188 | VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
|
---|
189 | VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
|
---|
190 | #ifndef VBOX_OSE
|
---|
191 | VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
|
---|
192 | #endif
|
---|
193 | ifneq ($(BUILD_TYPE),release)
|
---|
194 | # non-release builds has some extra features.
|
---|
195 | VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER
|
---|
196 | VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
|
---|
197 | VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
|
---|
198 | endif
|
---|
199 | ifdef VBOX_WITH_ALSA
|
---|
200 | VirtualBox_DEFS += VBOX_WITH_ALSA
|
---|
201 | endif
|
---|
202 | ifdef VBOX_OSE
|
---|
203 | VirtualBox_DEFS += VBOX_OSE
|
---|
204 | endif
|
---|
205 | ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
206 | VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
|
---|
207 | endif
|
---|
208 |
|
---|
209 | VirtualBox_INCS = \
|
---|
210 | ./include \
|
---|
211 | $(PATH_VirtualBox)/ui \
|
---|
212 | $(PATH_VirtualBox)/moc \
|
---|
213 | $(PATH_VirtualBox)/include \
|
---|
214 |
|
---|
215 |
|
---|
216 | ifeq ($(BUILD_TYPE),release)
|
---|
217 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
|
---|
218 | else
|
---|
219 | VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
|
---|
220 | ifeq ($(USERNAME),dmik)
|
---|
221 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
|
---|
222 | else
|
---|
223 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
|
---|
224 | endif
|
---|
225 | endif
|
---|
226 | VirtualBox_LDFLAGS.darwin = -framework IOKit
|
---|
227 | VirtualBox_LIBS.win = \
|
---|
228 | $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
|
---|
229 | $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
|
---|
230 | $(PATH_SDK_DXSDK_LIB)/dxguid.lib
|
---|
231 | VirtualBox_LIBS.linux = $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
|
---|
232 |
|
---|
233 |
|
---|
234 | ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
235 | ifeq ($(BUILD_TARGET),win)
|
---|
236 | VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
|
---|
237 | else
|
---|
238 | VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
|
---|
239 | endif
|
---|
240 | endif
|
---|
241 |
|
---|
242 | WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
|
---|
243 | WRAPPERSINCFILE = include/COMDefs.h
|
---|
244 | WRAPPERSTEMPLATE = include/COMWrappers.xsl
|
---|
245 | XIDLFILE = ../../Main/idl/VirtualBox.xidl
|
---|
246 |
|
---|
247 |
|
---|
248 | # generated files we need to clean manually
|
---|
249 | OTHER_CLEAN = \
|
---|
250 | $(VirtualBox_GENSRCS) \
|
---|
251 | $(VirtualBox_GENHDRS) \
|
---|
252 | $(WRAPPERSFILE)
|
---|
253 |
|
---|
254 |
|
---|
255 | #
|
---|
256 | # On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
|
---|
257 | #
|
---|
258 | INSTALLS.darwin += VirtualBox.app
|
---|
259 | VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
|
---|
260 | VirtualBox.app_MODE = 644
|
---|
261 | VirtualBox.app_SOURCES = \
|
---|
262 | src/darwin/PkgInfo \
|
---|
263 | $(PATH_TARGET)/Info.plist \
|
---|
264 | images/VirtualBox.icns=>Resources/virtualbox.icns
|
---|
265 |
|
---|
266 | $(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
267 | $(call MSG_GENERATE,VirtualBox.app,$<,$@)
|
---|
268 | $(QUIET)$(RM) -f $@
|
---|
269 | $(QUIET)$(SED) \
|
---|
270 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
271 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
272 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
273 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
274 | $< > $@
|
---|
275 |
|
---|
276 | INSTALLS.darwin += VirtualBoxVM.app
|
---|
277 | VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
|
---|
278 | VirtualBoxVM.app_MODE = 644
|
---|
279 | VirtualBoxVM.app_SOURCES = \
|
---|
280 | src/darwin/VM-PkgInfo=>PkgInfo \
|
---|
281 | $(PATH_TARGET)/VM-Info.plist=>Info.plist \
|
---|
282 | images/VirtualBox.icns=>Resources/virtualbox.icns
|
---|
283 | VirtualBoxVM.app_SYMLINKS = \
|
---|
284 | MacOS=>../../../MacOS/
|
---|
285 |
|
---|
286 | $(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
287 | $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
|
---|
288 | $(QUIET)$(RM) -f $@
|
---|
289 | $(QUIET)$(SED) \
|
---|
290 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
291 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
292 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
293 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
294 | $< > $@
|
---|
295 |
|
---|
296 | #
|
---|
297 | # Translation installation
|
---|
298 | #
|
---|
299 |
|
---|
300 | VirtualBox.nls_INST = $(INST_BIN)nls/
|
---|
301 | VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
|
---|
302 | VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
|
---|
303 | VirtualBox.nls_MODE = 644
|
---|
304 |
|
---|
305 |
|
---|
306 | #
|
---|
307 | # Testcase for the darwin keyboard routines.
|
---|
308 | #
|
---|
309 | ifdef VBOX_WITH_TESTCASES
|
---|
310 | PROGRAMS.darwin += tstDarwinKeyboard
|
---|
311 | tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
|
---|
312 | tstDarwinKeyboard_INCS = include
|
---|
313 | tstDarwinKeyboard_SOURCES = \
|
---|
314 | src/darwin/tstDarwinKeyboard.cpp \
|
---|
315 | src/darwin/DarwinKeyboard.cpp
|
---|
316 | tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
|
---|
317 | tstDarwinKeyboard_LIBS = \
|
---|
318 | $(LIB_RUNTIME)
|
---|
319 | endif
|
---|
320 |
|
---|
321 |
|
---|
322 |
|
---|
323 | # Commit the magic.
|
---|
324 | # (note: before custom rules that make usage of generated variables!).
|
---|
325 | include $(PATH_KBUILD)/footer.kmk
|
---|
326 |
|
---|
327 |
|
---|
328 |
|
---|
329 | #
|
---|
330 | # Qt source file generation rules
|
---|
331 | #
|
---|
332 |
|
---|
333 | ## @todo move QT source generation macros to kBuild
|
---|
334 |
|
---|
335 | ## Generate a rule to create a MOC source file from a header containing
|
---|
336 | # classes that use the Q_OBJECT macro.
|
---|
337 | # @param $mochdr header file with Q_OBJECT
|
---|
338 | define def_qt_gen_src_moc
|
---|
339 |
|
---|
340 | $(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
|
---|
341 |
|
---|
342 | $(target)_GENSRCS_REAL += $(mocsrc)
|
---|
343 |
|
---|
344 | $(mocsrc): $(mochdr)
|
---|
345 | $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
|
---|
346 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
347 | $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
|
---|
348 |
|
---|
349 | endef
|
---|
350 |
|
---|
351 | ## Generate a rule to create a MOC include file from a source containing
|
---|
352 | # local classes that use the Q_OBJECT macro. This include is then included
|
---|
353 | # by that source, so it must be generated before the source gets compiled.
|
---|
354 | # @param $mocsrc source file with Q_OBJECT
|
---|
355 | define def_qt_gen_inc_moc
|
---|
356 |
|
---|
357 | $(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
|
---|
358 | $(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
|
---|
359 |
|
---|
360 | $(target)_GENHDRS_REAL += $(mocinc)
|
---|
361 |
|
---|
362 | $(mocobj): $(mocinc)
|
---|
363 |
|
---|
364 | .NOTPARALLEL: $(mocinc)
|
---|
365 | $(mocinc): $(mocsrc)
|
---|
366 | $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
|
---|
367 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
368 | $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
|
---|
369 |
|
---|
370 | endef
|
---|
371 |
|
---|
372 | ## Generate a rule to create a MOC include file from a UI header (ui.h) containing
|
---|
373 | # local classes that use the Q_OBJECT macro. This include is then included
|
---|
374 | # by that header, so it must be generated before the UI source gets compiled.
|
---|
375 | # @param $mocuihdr UI header file with Q_OBJECT
|
---|
376 | define def_qt_gen_inc_mocuihdr
|
---|
377 |
|
---|
378 | $(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
|
---|
379 | $(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
|
---|
380 | $(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
|
---|
381 |
|
---|
382 | $(target)_GENHDRS_REAL += $(mocuiinc)
|
---|
383 |
|
---|
384 | .NOTPARALLEL: $(mocuiinc)
|
---|
385 | $(uisrc): $(mocuiinc)
|
---|
386 | $(mocuiinc): $(mocuihdr)
|
---|
387 | $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
|
---|
388 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
389 | $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
|
---|
390 |
|
---|
391 | endef
|
---|
392 |
|
---|
393 | ## Generate a rule to create a header and source files from an UI
|
---|
394 | # definition source (.ui).
|
---|
395 | # @param $uifile UI definintion source file
|
---|
396 | define def_qt_gen_src_ui
|
---|
397 |
|
---|
398 | $(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
|
---|
399 | $(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
|
---|
400 | $(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
|
---|
401 |
|
---|
402 | $(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
|
---|
403 | $(target)_GENHDRS_REAL += $(uihdr)
|
---|
404 |
|
---|
405 | .NOTPARALLEL: $(uihdr)
|
---|
406 | $(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
|
---|
407 | $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
|
---|
408 | $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
|
---|
409 |
|
---|
410 | $(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
|
---|
411 | $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
|
---|
412 | $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
|
---|
413 |
|
---|
414 | $(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
|
---|
415 | $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
|
---|
416 | $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
|
---|
417 |
|
---|
418 | endef
|
---|
419 |
|
---|
420 | ## Generate a rule to create a .qm file from a NLS translation
|
---|
421 | # source (.ts).
|
---|
422 | # @param $tsfile Translation source file
|
---|
423 | define def_qt_gen_nls
|
---|
424 |
|
---|
425 | $(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
|
---|
426 |
|
---|
427 | OTHER_CLEAN += $(qmfile)
|
---|
428 |
|
---|
429 | # Note that we use -nocompress in lrelease to avoid stripping comments and
|
---|
430 | # other information from .qm files. If we don't do that, we get .qm files two
|
---|
431 | # times smaller, but QTranslator::findMessage() will start searching for
|
---|
432 | # translations in all existing contexts in case if it cannot find it in the
|
---|
433 | # original context (which is of course not acceptable, no matter if it's a
|
---|
434 | # special Qt "feature" or just a bug).
|
---|
435 |
|
---|
436 | $(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
|
---|
437 | $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
|
---|
438 | $$(QUIET)$$(VBOX_LRELEASE) -nocompress $(tsfile) -qm $$@
|
---|
439 |
|
---|
440 | endef
|
---|
441 |
|
---|
442 | ## Generate rules for generating the Qt source for a target.
|
---|
443 | # @param $target Target name.
|
---|
444 | define def_qt_gen_src
|
---|
445 |
|
---|
446 | # moc srcs from hdrs with Q_OBJECT
|
---|
447 | $(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
|
---|
448 | # moc includes from srcs with Q_OBJECT
|
---|
449 | $(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
|
---|
450 | # moc includes from UI headers with Q_OBJECT
|
---|
451 | $(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
|
---|
452 | # UI sources
|
---|
453 | $(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
|
---|
454 | # NLS files
|
---|
455 | $(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
|
---|
456 | $(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
|
---|
457 | # dirs
|
---|
458 | $$(call DIRDEP,$(PATH_$(target))/ui/) \
|
---|
459 | $$(call DIRDEP,$(PATH_$(target))/moc/) \
|
---|
460 | $$(call DIRDEP,$(PATH_$(target))/nls/):
|
---|
461 | $$(call MSG_MKDIR,$$@)
|
---|
462 | $$(QUIET)$$(MKDIR) -p $$@
|
---|
463 |
|
---|
464 | endef
|
---|
465 |
|
---|
466 | # Generate Qt source rules.
|
---|
467 | $(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
|
---|
468 |
|
---|
469 |
|
---|
470 | # Generate COM Wrappers
|
---|
471 | .NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
|
---|
472 |
|
---|
473 | $(WRAPPERSINCFILE): $(WRAPPERSFILE)
|
---|
474 |
|
---|
475 | $(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
|
---|
476 | $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
|
---|
477 | $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
|
---|
478 |
|
---|
479 | $(call DIRDEP,$(PATH_VirtualBox)/include/):
|
---|
480 | $(call MSG_MKDIR,$@)
|
---|
481 | $(QUIET)$(MKDIR) -p $@
|
---|
482 |
|
---|
483 | # this is actually necessary only for Win32 target with disabled dependencies
|
---|
484 | define def_wrapper_deps
|
---|
485 | $(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
|
---|
486 | endef
|
---|
487 |
|
---|
488 | $(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
|
---|
489 |
|
---|
490 | # static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
|
---|
491 |
|
---|
492 | $(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
|
---|
493 | @echo " \
|
---|
494 | $(VirtualBox_QT_IMAGES) \
|
---|
495 | " > $@
|
---|
496 |
|
---|
497 | $(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
|
---|
498 | $(call MSG_TOOL,uic,VirtualBox,$<,$@)
|
---|
499 | $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
|
---|
500 |
|
---|
501 | VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
|
---|
502 | OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
|
---|
503 |
|
---|
504 |
|
---|
505 | #
|
---|
506 | # Hand made dependencies go here.
|
---|
507 | # Basically, here are dependencies for generated UI source files that
|
---|
508 | # include generated headers in turn.
|
---|
509 | #
|
---|
510 |
|
---|
511 | $(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
|
---|
512 | $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
|
---|
513 |
|
---|
514 | # Make all generated UI sources dependent on all generated headers (since they
|
---|
515 | # may include them). This is safer than indifidual dependencies above but
|
---|
516 | # currently disabled, because will cause all UI sources to be rebuilt one a
|
---|
517 | # single one changes.
|
---|
518 | #$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
|
---|
519 |
|
---|
520 |
|
---|
521 | #
|
---|
522 | # Custom targets
|
---|
523 | #
|
---|
524 |
|
---|
525 | # Update all known NLS translation (.ts) files in the nls/ subdirectory.
|
---|
526 | # NOTE: This target is intened to be run only by the GUI maintainer shortly
|
---|
527 | # before a new product release. VirtualBox_xx_YY.ts is a template for new
|
---|
528 | # languages and should never be actually translated or installed.
|
---|
529 | updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
|
---|
530 | $(call MSG_L1,lupdate all languages (nls/*.ts))
|
---|
531 | $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
|
---|
532 |
|
---|
533 |
|
---|
534 | #
|
---|
535 | # Test targets
|
---|
536 | #
|
---|
537 |
|
---|
538 | test:
|
---|
539 | @echo ====================
|
---|
540 | @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
|
---|
541 | @echo --------------------
|
---|
542 | @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
|
---|
543 | @echo ====================
|
---|
544 | @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
|
---|
545 | @echo --------------------
|
---|
546 | @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
|
---|
547 | @echo ====================
|
---|
548 |
|
---|
549 | test2:
|
---|
550 | @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
|
---|
551 |
|
---|
552 | test3:
|
---|
553 | @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
|
---|
554 |
|
---|
555 | testwrappers: $(WRAPPERSFILE)
|
---|
556 |
|
---|