VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/Makefile.kmk@ 10228

Last change on this file since 10228 was 10167, checked in by vboxsync, 16 years ago

Fe/Qt4: New VM&Global settings api based on one default class (+ui).
One interface for both Settings dialog & one interface for settings pages.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 33.1 KB
Line 
1# $Id: Makefile.kmk 10167 2008-07-03 17:09:23Z vboxsync $
2## @file
3# Makefile for the VirtualBox Qt GUI.
4#
5
6#
7# Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18# Clara, CA 95054 USA or visit http://www.sun.com if you need
19# additional information or have any questions.
20#
21
22# include qmake project file
23include VBoxUI.pro
24
25# Import QDesigner UI sources
26VirtualBox_QT_UISRCS := $(FORMS)
27# Import translation sources
28VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
29
30# reset things to avoid possible conflicts with kBuild
31TEMPLATE :=
32LANGUAGE :=
33FORMS :=
34TRANSLATIONS :=
35IMAGES :=
36
37VBOX_WITH_REGISTRATION := 1
38VBOX_WITH_REGISTRATION_REQUEST := 1
39
40DEPTH = ../../../..
41include $(KBUILD_PATH)/header.kmk
42
43# Disable the debugger for now, this is another story.
44VBOX_WITH_DEBUGGER_GUI :=
45DEFS := $(filter-out VBOX_WITH_DEBUGGER_GUI,$(DEFS))
46
47#
48# Handmade configuration of qt4 - very annoying, this needs to
49# be cleaned up properly later some time (not important now).
50#
51ifeq ($(VBOX_PATH_QT4),)
52 ifeq ($(KBUILD_TARGET),darwin)
53 VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
54 ifeq ($(VBOX_PATH_QT4),)
55 ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
56 # Using the global installation (for OSE).
57 VBOX_PATH_QT4 ?= /usr
58 VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
59 endif
60 endif
61 else if1of ($(KBUILD_TARGET),win)
62 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
63 else if1of ($(KBUILD_TARGET),solaris)
64 VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
65 ifneq ($(VBOX_PATH_QT4),)
66 VBOX_WITH_QT4_SUN = 1
67 endif
68 endif
69endif
70ifeq ($(VBOX_PATH_QT4),)
71 if1of ($(USERNAME), bird)
72 # gentoo (64-bit)
73 VBOX_PATH_QT4 ?= /usr
74 VBOX_PATH_QT4_BIN ?= /usr/bin
75 VBOX_PATH_QT4_INCLUDE ?= /usr/include/qt4
76 VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
77 VBOX_PATH_QT4_LIB64 ?= /usr/lib/qt4
78 VBOX_PATH_QT4_SHARE ?= /usr/share/qt4
79 endif
80endif
81VBOX_PATH_QT4 ?= /usr
82VBOX_PATH_QT4_BIN ?= $(VBOX_PATH_QT4)/bin
83VBOX_PATH_QT4_INCLUDE ?= $(VBOX_PATH_QT4)/include
84VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
85VBOX_PATH_QT4_LIB64 ?= $(VBOX_PATH_QT4)/lib64
86VBOX_PATH_QT4_FRAMEWORKS ?= $(VBOX_PATH_QT4)/Frameworks
87VBOX_PATH_QT4_SHARE ?= $(VBOX_PATH_QT4)
88
89VBOX_MODULE_QT4 = QtCore QtGui
90VBOX_DEFS_QT4 = QT_CORE_LIB QT_GUI_LIB
91
92ifeq ($(KBUILD_TARGET),darwin)
93 # This is necessary because we didn't include the Qt header in framework
94 # notation (e.g.: <QtCore/QObject>)).
95 VBOX_INCS_QT4 = $(patsubst %, $(VBOX_PATH_QT4_FRAMEWORKS)/%.framework/Headers, $(VBOX_MODULE_QT4))
96 # No libs cause we are using frameworks
97 VBOX_PATH_QT4_LIB =
98 VBOX_LIBS_QT4 =
99else
100
101 VBOX_INCS_QT4 = \
102 $(addprefix $(VBOX_PATH_QT4_INCLUDE)/, $(VBOX_MODULE_QT4) Qt) \
103 $(VBOX_PATH_QT4_INCLUDE)
104 ifeq ($(KBUILD_TARGET),win)
105 ifeq ($(KBUILD_TARGET_ARCH),amd64)
106 ## @todo This is the correct one here: VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc2005
107 VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc.net
108 else
109 VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc.net
110 endif
111 else ifeq ($(KBUILD_TARGET),linux)
112 VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/linux-g++
113 endif
114
115 # add the VBox prefix to Qt libs if they are built by us
116 ifeq ($(KBUILD_TARGET),win)
117 VBOX_LIBS_QT4 = $(patsubst %, VBox%4, $(VBOX_MODULE_QT4))
118 VBOX_QT4_RUNTIME = $(patsubst %, $(VBOX_PATH_QT4_LIB)/VBox%4.dll, $(VBOX_MODULE_QT4))
119 else ifdef VBOX_WITH_QT4_SUN
120 # Qt4 compiled by Sun with altered library names
121 VBOX_LIBS_QT4 = $(patsubst %, VBox%, $(VBOX_MODULE_QT4))
122 VBOX_QT4_RUNTIME = $(patsubst %, $(VBOX_PATH_QT4_LIB)/libVBox%.so.4, $(VBOX_MODULE_QT4))
123 # Export the ld library path
124 export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH)
125 else
126 VBOX_LIBS_QT4 = $(VBOX_MODULE_QT4)
127 VBOX_QT4_RUNTIME =
128 endif
129
130 ifeq ($(KBUILD_TARGET),win)
131 VBOX_LIBS_QT4 := $(addsuffix .lib, $(VBOX_LIBS_QT4)) VBoxqtmain.lib
132 endif
133
134endif
135
136# Some default defs
137VBOX_DEFS_QT4 += QT_SHARED HAVE_CONFIG_H QT_NO_DEBUG
138
139VBOX_UIC4 ?= $(VBOX_PATH_QT4_BIN)/uic
140VBOX_MOC4 ?= $(VBOX_PATH_QT4_BIN)/moc
141VBOX_RCC4 ?= $(VBOX_PATH_QT4_BIN)/rcc
142VBOX_LUPDATE4 ?= $(VBOX_PATH_QT4_BIN)/lupdate
143VBOX_LRELEASE4 ?= $(VBOX_PATH_QT4_BIN)/lrelease
144
145# tell moc what platform we are on to let it properly define
146# Q_OS_* and Q_WS_* macros when including qglobal.h
147# (is there a better way?)
148ifeq ($(KBUILD_TARGET),win)
149 ifeq ($(KBUILD_TARGET_ARCH),amd64)
150 VBOX_MOC4 += -DWIN64
151 else
152 VBOX_MOC4 += -DWIN32
153 endif
154else ifeq ($(KBUILD_TARGET),darwin)
155 VBOX_MOC4 += -D__APPLE__ -D__GNUC__
156else ifeq ($(KBUILD_TARGET),solaris)
157 VBOX_MOC4 += -D__sun
158else ifeq ($(KBUILD_TARGET),linux)
159 # when nothing special is defined, Q_OS_UNIX/Q_WS_X11 will be set
160else
161 $(error Port me!)
162endif
163
164# All the following should be done in some root Makefile and removed from this
165# one.
166ifeq ($(KBUILD_TARGET),darwin)
167 # The following is necessary on Non OSE only. On the OSE version the Qt
168 # frameworks provided by Trolltech have to be installed on the target system
169 # in the system wide Frameworks directory (/Library/Frameworks).
170 ifndef VBOX_OSE
171 # Create the targets of the form
172 # @executable_path/../Frameworks/Qt???.framework/Versions/4/Qt???
173 QT_LIB_INSTALL=$(foreach mod, $(VBOX_MODULE_QT4), $(join $(join $(PATH_BIN)/../Frameworks/, $(mod)), .framework/Versions/4/$(mod)))
174 # The target for the libs. This is a special target cause is creates the
175 # necessary directory structure. @Bird: is there something for this in
176 # kBuild already? Todo: What about uninstall?
177 $(QT_LIB_INSTALL): $(PATH_BIN)/../Frameworks/%: $(VBOX_PATH_QT4_FRAMEWORKS)/%
178 $(call MSG_INST_FILE,$<,$@)
179 $(QUIET)$(MKDIR) -p $(@D)
180 $(QUIET)$(INSTALL) -m 0644 $< $(@D)
181 # Add the lib targets to the OTHER dependencies.
182 OTHERS = $(QT_LIB_INSTALL)
183 endif
184else
185 # The Qt DLLs (move to the root Makefile.kmk, and remove bin from INSTALLS below).
186 bin_SOURCES += $(VBOX_QT4_RUNTIME)
187 bin_INST = $(INST_BIN)
188 bin_MODE = 644
189endif
190
191# Template copy from the qt3 stuff. Appended a "4" on the
192# relevant places.
193
194#
195# Template for building Qt GUI executables.
196#
197
198TEMPLATE_VBOXQT4GUIEXE = VBox Qt4 GUI Executable
199TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS) $(VBOX_DEFS_QT4)
200TEMPLATE_VBOXQT4GUIEXE_INCS = \
201 $(VBOX_PATH_SDK)/include \
202 $(VBOX_INCS_QT4)
203
204ifeq ($(KBUILD_TARGET),win)
205 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
206 TEMPLATE_VBOXQT4GUIEXE_DEFS += \
207 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
208 QT_DLL _CRT_SECURE_NO_DEPRECATE \
209 $(QMAKE_PRL_DEFINES)
210 ## @todo VCC70 flags?
211 ifdef VBOX_USE_VCC80
212 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
213 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
214 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
215 else
216 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
217 -nologo -Zm200 -W3 -MD -Zi -GX
218 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -GZ
219 endif
220 TEMPLATE_VBOXQT4GUIEXE_INCS += \
221 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
222 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
223 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
224 /DELAYLOAD:oleaut32.dll
225 TEMPLATE_VBOXQT4GUIEXE_SDKS = WINPSDK
226 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
227 $(VBOX_LIBS_QT4) \
228 $(LIB_RUNTIME) \
229 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
230 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
231 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
232 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
233 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
234 TEMPLATE_VBOXQT4GUIEXE_LIBPATH = $(VBOX_PATH_QT4_LIB)
235 TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
236
237else # the gcc guys:
238 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
239 TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
240
241 TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
242
243 TEMPLATE_VBOXQT4GUIEXE_INCS += \
244 $(LIB_SDL_INC)
245 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
246 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
247 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
248 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
249 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
250 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
251 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
252 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
253 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
254 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
255 $(VBOX_LIBS_QT4) \
256 $(LIB_SDL) \
257 $(LIB_RUNTIME) \
258 $(LIB_REM) \
259 $(LIB_VMM)
260
261 ifeq ($(KBUILD_TARGET_ARCH),amd64)
262 TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
263 $(VBOX_PATH_QT4_LIB64) $(VBOX_PATH_QT4_LIB)
264 else
265 TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
266 $(VBOX_PATH_QT4_LIB)
267 endif
268
269 ifeq ($(KBUILD_TARGET),linux)
270 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
271 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
272 $(VBOX_XCURSOR_LIBS)
273 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
274 $(VBOX_LIBPATH_X11)
275 else ifeq ($(KBUILD_TARGET),darwin)
276 # We have to add the framework path to both the linker and the compiler also.
277 # Note that the -F flag is apple gcc only.
278 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -F$(VBOX_PATH_QT4_FRAMEWORKS) $(addprefix -framework , $(VBOX_MODULE_QT4)) \
279 -framework Carbon -framework QuickTime -bind_at_load
280 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS += -F$(VBOX_PATH_QT4_FRAMEWORKS)
281 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
282 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
283 else
284 TEMPLATE_VBOXQT4GUIEXE_INCS += \
285 $(VBOX_XCURSOR_INCS)
286 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
287 $(VBOX_XCURSOR_LIBS) \
288 Xext \
289 X11 \
290 m \
291 $(LIB_PTHREAD)
292 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
293 $(VBOX_LIBPATH_X11)
294 ifeq ($(KBUILD_TARGET),freebsd)
295 TEMPLATE_VBOXQT4GUIEXE_INCS += \
296 /usr/include \
297 /usr/X11R6/include \
298 /usr/local/include
299 endif
300 ifeq ($(KBUILD_TARGET),solaris)
301 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
302 rt socket nsl
303 endif
304 ifdef VBOX_WITH_ORIGIN
305 # Assume the Qt shared objects are in the same directory as the executable, on Solaris too.
306 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)'
307 endif
308 endif
309
310endif
311
312# Add COM/XPCOM stuff
313TEMPLATE_VBOXQT4GUIEXE_LIBS += \
314 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
315ifdef VBOX_WITH_XPCOM
316 ## @todo may be worth creating the VBOX_XPCOM SDK def
317 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
318 TEMPLATE_VBOXQT4GUIEXE_INCS += \
319 $(VBOX_XPCOM_INCS)
320 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
321 $(LIB_XPCOM)
322endif
323
324#
325# Template for building Qt GUI components.
326#
327TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
328TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQTGUIEXE
329TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
330ifeq ($(KBUILD_TARGET),darwin)
331 TEMPLATE_VBOXQT4GUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS))
332endif
333ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
334 ifneq ($(KBUILD_TARGET),win)
335 TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
336 TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
337 TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
338 TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
339 endif
340endif
341
342
343#
344# exclude inappropriate UI content
345#
346ifndef VBOX_WITH_REGISTRATION
347VirtualBox_QT_UISRCS := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS))
348endif
349
350#
351# The targets.
352#
353PROGRAMS = VirtualBox
354ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(KBUILD_TARGET)),) # X11
355DLLS = VBoxKeyboard4
356OTHERS = $(PATH_BIN)/vboxkeyboard4.tar.gz
357endif
358INSTALLS = VirtualBox.nls bin
359
360#
361# VBoxKeyboard - keyboard library for X11.
362#
363VBoxKeyboard4_TEMPLATE = VBOXR3
364VBoxKeyboard4_SOURCES = \
365 src/linux/keyboard-new.c
366VBoxKeyboard4_TARSOURCES = \
367 $(VBoxKeyboard4_SOURCES) \
368 src/linux/COPYING.LIB \
369 src/linux/keyboard.h \
370 src/linux/keyboard-layouts.h \
371 src/linux/keyboard-list.h \
372 src/linux/keyboard-tables.h \
373 src/linux/keyboard-types.h \
374 src/linux/Makefile
375VBoxKeyboard4_LIBS = X11
376VBoxKeyboard4_LIBPATH = $(VBOX_LIBPATH_X11)
377
378
379#
380# vboxkeyboard.tar.gz - the LGPLed keyboard library must always be
381# redistributed with usable sources.
382#
383SOURCE_DIRECTORY = vboxkeyboard4
384DIRECTORY_PREFIX = src/linux/
385
386$(PATH_TARGET)/$(SOURCE_DIRECTORY):
387 $(MKDIR) -p $(@D)
388 $(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
389
390$(PATH_BIN)/vboxkeyboard4.tar.gz: $(VBoxKeyboard4_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY)
391 $(call MSG_TOOL,tar/gzip,,$@)
392 $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard4_TARSOURCES))) | gzip - > $@
393
394
395#
396# VirtualBox - The GUI program.
397#
398VirtualBox_TEMPLATE = VBOXQT4GUIEXE
399VirtualBox_NAME = VirtualBox4
400VirtualBox_SDKS.win = WINPSDK DXSDK
401#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(KBUILD_TARGET)),) - later
402ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(KBUILD_TARGET)),) # X11 + os2
403VirtualBox_SDKS += LIBSDL
404endif
405
406ifeq ($(KBUILD_TARGET),darwin)
407# For the launch trick we need different inode numbers.
408VirtualBox_INST = $(INST_BIN)VirtualBox4 $(INST_BIN)VirtualBoxVM4
409
410 # For testing iChat Theater stuff change
411 # the sdk path
412 ifdef VBOX_WITH_ICHAT_THEATER
413 VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk
414 endif
415
416endif
417
418ifndef VBOX_OSE
419ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # linux only, yea, right.
420# Note: I'm doing this right here because the GUI will _not_ run
421# without that file which might be annoying for developers!
422$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
423 $(call MSG_GENERATE,,$@)
424 $(QUIET)$(CP) $< $@
425
426$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
427endif
428endif
429
430# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
431VirtualBox_QT_TRANSLATIONS_QT := \
432 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
433 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
434
435# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
436
437# Headers containing definitions of classes that use the Q_OBJECT macro
438VirtualBox_QT_MOCHDRS = \
439 include/QIWidgetValidator.h \
440 include/QIHotKeyEdit.h \
441 include/QIStatusBar.h \
442 include/QIStateIndicator.h \
443 include/QIMessageBox.h \
444 include/QILabel.h \
445 include/QILabel_p.h \
446 include/QIAbstractWizard.h \
447 include/QIListView.h \
448 include/QITreeWidget.h \
449 include/QIMainDialog.h \
450 include/QIHelpButton.h \
451 include/VBoxUtils.h \
452 include/VBoxGlobalSettings.h \
453 include/VBoxGlobal.h \
454 include/VBoxVMListView.h \
455 include/VBoxMediaComboBox.h \
456 include/VBoxSelectorWnd.h \
457 include/VBoxConsoleWnd.h \
458 include/VBoxConsoleView.h \
459 include/VBoxProblemReporter.h \
460 include/VBoxDownloaderWgt.h \
461 include/VBoxNetworkFramework.h \
462 include/VBoxAboutDlg.h \
463 include/VBoxCloseVMDlg.h \
464 include/VBoxNewVMWzd.h \
465 include/VBoxNewHDWzd.h \
466 include/VBoxVMFirstRunWzd.h \
467 include/VBoxRegistrationDlg.h \
468 include/VBoxSnapshotDetailsDlg.h \
469 include/VBoxVMInformationDlg.h \
470 include/VBoxTakeSnapshotDlg.h \
471 include/VBoxSnapshotsWgt.h \
472 include/VBoxVMLogViewer.h \
473 include/VBoxDiskImageManagerDlg.h \
474 include/VBoxSettingsUtils.h \
475 include/VBoxVMSettingsGeneral.h \
476 include/VBoxVMSettingsHD.h \
477 include/VBoxVMSettingsCD.h \
478 include/VBoxVMSettingsFD.h \
479 include/VBoxVMSettingsAudio.h \
480 include/VBoxVMSettingsNetwork.h \
481 include/VBoxVMSettingsSerial.h \
482 include/VBoxVMSettingsParallel.h \
483 include/VBoxVMSettingsUSB.h \
484 include/VBoxVMSettingsSF.h \
485 include/VBoxVMSettingsVRDP.h \
486 include/VBoxGLSettingsGeneral.h \
487 include/VBoxGLSettingsInput.h \
488 include/VBoxGLSettingsLanguage.h \
489 include/VBoxSettingsDialog.h \
490 include/VBoxSettingsDialogSpecific.h \
491 include/VBoxSettingsPage.h
492
493# Sources containing local definitions of classes that use the Q_OBJECT macro
494VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
495ifdef VBOX_WITH_XPCOM
496VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
497endif
498
499# All generated sources. Note: this list MUST be in sync with Qt source
500# generation rules defined somewhere below!
501VirtualBox_GENSRCS = \
502 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp)
503
504# All generated headers. Note: this list MUST be in sync with Qt source
505# generation rules defined somewhere below!
506VirtualBox_GENHDRS = \
507 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
508 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).gen.h)
509
510# All header files
511VirtualBox_HEADERS = \
512 $(wildcard include/*.h) \
513 $(VirtualBox_GENHDRS)
514
515VirtualBox_SOURCES = \
516 $(VirtualBox_GENSRCS) \
517 src/main.cpp \
518 src/COMDefs.cpp \
519 src/QIWidgetValidator.cpp \
520 src/QIHotKeyEdit.cpp \
521 src/QIStateIndicator.cpp \
522 src/QIStatusBar.cpp \
523 src/QIMessageBox.cpp \
524 src/QILabel.cpp \
525 src/QIAbstractWizard.cpp \
526 src/QIDialog.cpp \
527 src/QIDialogButtonBox.cpp \
528 src/QIListView.cpp \
529 src/QITreeWidget.cpp \
530 src/QIMainDialog.cpp \
531 src/QILineEdit.cpp \
532 src/QIHelpButton.cpp \
533 src/VBoxDefs.cpp \
534 src/VBoxGlobalSettings.cpp \
535 src/VBoxGlobal.cpp \
536 src/VBoxMediaComboBox.cpp \
537 src/VBoxProblemReporter.cpp \
538 src/VBoxSelectorWnd.cpp \
539 src/VBoxConsoleView.cpp \
540 src/VBoxConsoleWnd.cpp \
541 src/VBoxDownloaderWgt.cpp \
542 src/VBoxVMListView.cpp \
543 src/VBoxFrameBuffer.cpp \
544 src/HappyHttp.cpp \
545 src/VBoxNetworkFramework.cpp \
546 src/VBoxAboutDlg.cpp \
547 src/VBoxCloseVMDlg.cpp \
548 src/VBoxNewVMWzd.cpp \
549 src/VBoxNewHDWzd.cpp \
550 src/VBoxVMFirstRunWzd.cpp \
551 src/VBoxRegistrationDlg.cpp \
552 src/VBoxSnapshotDetailsDlg.cpp \
553 src/VBoxVMInformationDlg.cpp \
554 src/VBoxTakeSnapshotDlg.cpp \
555 src/VBoxSnapshotsWgt.cpp \
556 src/VBoxVMLogViewer.cpp \
557 src/VBoxDiskImageManagerDlg.cpp \
558 src/VBoxVMSettingsGeneral.cpp \
559 src/VBoxVMSettingsHD.cpp \
560 src/VBoxVMSettingsCD.cpp \
561 src/VBoxVMSettingsFD.cpp \
562 src/VBoxVMSettingsAudio.cpp \
563 src/VBoxVMSettingsNetwork.cpp \
564 src/VBoxVMSettingsSerial.cpp \
565 src/VBoxVMSettingsParallel.cpp \
566 src/VBoxVMSettingsUSB.cpp \
567 src/VBoxVMSettingsSF.cpp \
568 src/VBoxVMSettingsVRDP.cpp \
569 src/VBoxGLSettingsGeneral.cpp \
570 src/VBoxGLSettingsInput.cpp \
571 src/VBoxGLSettingsLanguage.cpp \
572 src/VBoxSettingsDialog.cpp \
573 src/VBoxSettingsDialogSpecific.cpp
574
575ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
576ifndef VBOX_OSE
577VirtualBox_QT_MOCHDRS += \
578 include/VBoxLicenseViewer.h
579VirtualBox_SOURCES += \
580 src/VBoxLicenseViewer.cpp
581endif
582VirtualBox_SOURCES += \
583 src/linux/XKeyboard-new.cpp
584endif
585
586VirtualBox_SOURCES.win += \
587 src/VBoxFBDDRAW.cpp \
588 $(PATH_TARGET)/VirtualBox4.rc
589
590VirtualBox_SOURCES.darwin = \
591 src/darwin/DarwinKeyboard.cpp \
592 src/darwin/DarwinCursor.cpp \
593 src/darwin/VBoxUtils-darwin.cpp \
594 src/VBoxFBQuartz2D.cpp
595# src/darwin/VBoxAquaStyle.cpp \
596
597ifdef VBOX_WITH_ICHAT_THEATER
598 VirtualBox_SOURCES.darwin += \
599 src/darwin/VBoxIChatTheaterWrapper.m
600endif
601
602ifneq ($(KBUILD_TARGET),win)
603src/HappyHttp.cpp_CXXFLAGS += -fexceptions
604src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
605src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
606endif
607src/HappyHttp.cpp_CXXFLAGS.linux += -O2
608
609## @todo how to detect what tool is used?
610## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
611# more generic -Wno-extra
612ifdef VBOX_WITH_XPCOM
613src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
614endif
615
616VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
617VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
618VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
619VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
620VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
621VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
622VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
623VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
624VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
625VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
626#ifndef VBOX_OSE
627 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
628#endif
629ifdef VBOX_WITH_ICHAT_THEATER
630 VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
631endif
632ifneq ($(KBUILD_TYPE),release)
633 # non-release builds has some extra features.
634 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
635 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
636endif
637ifdef VBOX_WITH_REGISTRATION
638 VirtualBox_DEFS += VBOX_WITH_REGISTRATION
639endif
640ifdef VBOX_WITH_REGISTRATION_REQUEST
641 VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
642endif
643ifdef VBOX_WITH_ALSA
644 VirtualBox_DEFS += VBOX_WITH_ALSA
645endif
646ifdef VBOX_WITH_PULSE
647 VirtualBox_DEFS += VBOX_WITH_PULSE
648endif
649ifdef VBOX_WITH_E1000
650 VirtualBox_DEFS += VBOX_WITH_E1000
651endif
652ifdef VBOX_OSE
653 VirtualBox_DEFS += VBOX_OSE
654endif
655ifdef VBOX_WITH_DEBUGGER_GUI
656 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
657endif
658
659VirtualBox_INCS = \
660 ./include \
661 $(PATH_VirtualBox)/ui \
662 $(PATH_VirtualBox)/moc \
663 $(PATH_VirtualBox)/include \
664
665
666ifeq ($(KBUILD_TYPE),release)
667 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
668else
669 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
670 ifeq ($(USERNAME),dmik)
671 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
672 else
673 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
674 endif
675endif
676VirtualBox_LDFLAGS.darwin = -framework IOKit -framework AppKit -framework ApplicationServices -framework Foundation -lz
677ifdef VBOX_WITH_ICHAT_THEATER
678 VirtualBox_LDFLAGS.darwin += -framework InstantMessage -framework QuartzCore
679endif
680VirtualBox_LIBS.win = \
681 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
682 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
683 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
684ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
685VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard4$(VBOX_SUFF_DLL)
686endif
687
688
689ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
690 ifeq ($(KBUILD_TARGET),win)
691 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
692 else
693 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
694 endif
695endif
696
697WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
698WRAPPERSINCFILE = include/COMDefs.h
699WRAPPERSTEMPLATE = include/COMWrappers.xsl
700XIDLFILE = ../../Main/idl/VirtualBox.xidl
701
702VirtualBox_INTERMEDIATES = $(WRAPPERSFILE)
703
704
705# generated files we need to clean manually
706OTHER_CLEAN = \
707 $(VirtualBox_GENSRCS) \
708 $(VirtualBox_GENHDRS) \
709 $(WRAPPERSFILE) \
710 $(PATH_BIN)/vboxkeyboard.tar.gz
711
712#
713# On Windows we'll have to generate/edit the resource file.
714# The IDI_ICON1 name is Qt specific.
715#
716$(PATH_TARGET)/VirtualBox4.rc: Makefile.kmk $(VBOX_WINDOWS_ICON_FILE) | $$(call DIRDEP,$$(@D))
717 $(RM) -f $@
718 $(APPEND) $@ 'IDI_ICON1 ICON "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
719 $(CAT) $@
720
721OTHER_CLEAN.win += $(PATH_TARGET)/VirtualBox4.rc
722
723
724#
725# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
726#
727INSTALLS.darwin += VirtualBox.app
728VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
729VirtualBox.app_MODE = 644
730VirtualBox.app_SOURCES = \
731 src/darwin/PkgInfo \
732 $(PATH_TARGET)/Info.plist \
733 $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
734
735$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
736 $(call MSG_GENERATE,VirtualBox.app,$<,$@)
737 $(QUIET)$(RM) -f $@
738 $(QUIET)$(SED) \
739 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
740 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
741 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
742 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
743 $< > $@
744
745INSTALLS.darwin += VirtualBoxVM.app
746VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
747VirtualBoxVM.app_MODE = 644
748VirtualBoxVM.app_SOURCES = \
749 src/darwin/VM-PkgInfo=>PkgInfo \
750 $(PATH_TARGET)/VM-Info.plist=>Info.plist \
751 $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
752VirtualBoxVM.app_SYMLINKS = \
753 MacOS=>../../../MacOS/
754
755$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
756 $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
757 $(QUIET)$(RM) -f $@
758 $(QUIET)$(SED) \
759 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
760 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
761 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
762 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
763 --output $@ $<
764
765#
766# Translation installation
767#
768VirtualBox.nls_INST = $(INST_BIN)nls4/
769VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
770VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
771VirtualBox.nls_MODE = 644
772
773
774#
775# Testcase for the darwin keyboard routines.
776#
777ifdef VBOX_WITH_TESTCASES
778PROGRAMS.darwin += tstDarwinKeyboard4
779tstDarwinKeyboard4_TEMPLATE = VBOXR3TSTEXE
780tstDarwinKeyboard4_INCS = include
781tstDarwinKeyboard4_SOURCES = \
782 src/darwin/tstDarwinKeyboard.cpp \
783 src/darwin/DarwinKeyboard.cpp
784tstDarwinKeyboard4_LDFLAGS = -framework IOKit -framework Carbon
785tstDarwinKeyboard4_LIBS = \
786 $(LIB_RUNTIME)
787endif
788
789# grep the images out of the resource file for dependency tracking
790VirtualBox_QT_RC += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox.qrc)
791VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application.cpp
792
793# We have different about dialogs in OSE and PUEL. Therefor two independent
794# resource files exists.
795ifdef VBOX_OSE
796VirtualBox_QT_RC_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_OSE.qrc)
797VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_ose.cpp
798else
799VirtualBox_QT_RC_NON_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_NonOSE.qrc)
800VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp
801VirtualBox_SOURCES += src/VBoxAboutNonOSEDlg.cpp
802VirtualBox_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h
803endif
804
805# OSE version is always necessary for lupdate/lrelease
806VirtualBox_QT_UISRCS += ui/VBoxAboutDlg.ui
807
808# Commit the magic.
809# (note: before custom rules that make usage of generated variables!).
810include $(KBUILD_PATH)/footer.kmk
811
812
813#
814# Qt source file generation rules
815#
816
817## @todo move QT source generation macros to kBuild
818
819## Generate a rule to create a MOC source file from a header containing
820# classes that use the Q_OBJECT macro.
821# @param $mochdr header file with Q_OBJECT
822define def_qt_gen_src_moc
823
824$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
825
826$(target)_GENSRCS_REAL += $(mocsrc)
827## @todo The source should be added to GEN_SOURCES: $ (target)_GEN_SOURCES += $ (mocsrc)
828
829$(mocsrc): $(mochdr)
830 $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
831 $$(QUIET)$$(MKDIR) -p $$(@D)
832 $$(QUIET)$$(VBOX_MOC4) \
833 $(addprefix -D,$($(target)_DEFS)) \
834 $(addprefix -I,$($(target)_INCS)) \
835 $(mochdr) -o $$@
836
837endef
838
839## Generate a rule to create a MOC include file from a source containing
840# local classes that use the Q_OBJECT macro. This include is then included
841# by that source, so it must be generated before the source gets compiled.
842# @param $mocsrc source file with Q_OBJECT
843define def_qt_gen_inc_moc
844
845$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
846$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
847
848$(target)_GENHDRS_REAL += $(mocinc)
849$(target)_INTERMEDIATES += $(mocinc)
850
851$(mocobj): $(mocinc)
852
853$(mocinc): $(mocsrc)
854 $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
855 $$(QUIET)$$(MKDIR) -p $$(@D)
856 $$(QUIET)$$(VBOX_MOC4) \
857 $(addprefix -D,$($(target)_DEFS)) \
858 $(addprefix -I,$($(target)_INCS)) \
859 -i $(mocsrc) -o $$@
860
861endef
862
863## Generate a rule to create a MOC include file from a UI header (ui.h) containing
864# local classes that use the Q_OBJECT macro. This include is then included
865# by that header, so it must be generated before the UI source gets compiled.
866# @param $mocuihdr UI header file with Q_OBJECT
867define def_qt_gen_inc_mocuihdr
868
869$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
870$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
871$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
872
873$(target)_GENHDRS_REAL += $(mocuiinc)
874$(target)_INTERMEDIATES += $(mocuiinc)
875
876$(uisrc): $(mocuiinc)
877$(mocuiinc): $(mocuihdr)
878 $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
879 $$(QUIET)$$(MKDIR) -p $$(@D)
880 $$(QUIET)$$(VBOX_MOC4) \
881 $(addprefix -D,$($(target)_DEFS)) \
882 $(addprefix -I,$($(target)_INCS)) \
883 -i $(mocuihdr) -o $$@
884
885endef
886
887## Generate a rule to create a header file from an UI
888# definition source (.ui).
889# @param $uifile UI definintion source file
890define def_qt_gen_src_ui
891
892$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).gen.h)
893
894$(target)_GENHDRS_REAL += $(uihdr)
895$(target)_INTERMEDIATES += $(uihdr)
896
897$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
898 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
899 $$(QUIET)$$(VBOX_UIC4) $(uifile) -o $$@
900
901# we assume that the generated header is at least included by
902# the normal header with the same name
903include/$(notdir $(basename $(uifile))).h: $(uihdr)
904
905endef
906
907## Generate a rule to create a .qm file from a NLS translation
908# source (.ts).
909# @param $tsfile Translation source file
910define def_qt_gen_nls
911
912$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
913
914OTHER_CLEAN += $(qmfile)
915
916# Note that we use -nocompress in lrelease to avoid stripping comments and
917# other information from .qm files. If we don't do that, we get .qm files two
918# times smaller, but QTranslator::findMessage() will start searching for
919# translations in all existing contexts in case if it cannot find it in the
920# original context (which is of course not acceptable, no matter if it's a
921# special Qt "feature" or just a bug).
922
923$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
924 $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
925 $$(QUIET)$$(VBOX_LRELEASE4) -nocompress -silent $(tsfile) -qm $$@
926
927endef
928
929## Generate rules for generating the Qt source for a target.
930# @param $target Target name.
931define def_qt_gen_src
932
933# moc srcs from hdrs with Q_OBJECT
934$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
935# moc includes from srcs with Q_OBJECT
936$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
937# moc includes from UI headers with Q_OBJECT
938$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
939# UI sources
940$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
941# NLS files
942$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
943$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
944# dirs
945$$(call DIRDEP,$(PATH_$(target))/ui/) \
946$$(call DIRDEP,$(PATH_$(target))/moc/) \
947$$(call DIRDEP,$(PATH_$(target))/nls/):
948 $$(call MSG_MKDIR,$$@)
949 $$(QUIET)$$(MKDIR) -p $$@
950
951endef
952
953# Generate Qt source rules.
954$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
955
956
957# Generate COM Wrappers
958$(WRAPPERSINCFILE): $(WRAPPERSFILE)
959
960$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
961 $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
962 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
963
964$(call DIRDEP,$(PATH_VirtualBox)/include/):
965 $(call MSG_MKDIR,$@)
966 $(QUIET)$(MKDIR) -p $@
967
968# rules for resources file creation
969$(PATH_VirtualBox)/ui/qrc_application.cpp: VirtualBox.qrc $(VirtualBox_QT_RC)
970 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
971 $(QUIET)$(VBOX_RCC4) -o $@ $<
972
973$(PATH_VirtualBox)/ui/qrc_application_ose.cpp: VirtualBox_OSE.qrc $(VirtualBox_QT_RC_OSE)
974 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
975 $(QUIET)$(VBOX_RCC4) -name "OSE" -o $@ $<
976
977$(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp: VirtualBox_NonOSE.qrc $(VirtualBox_QT_RC_NON_OSE)
978 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
979 $(QUIET)$(VBOX_RCC4) -name "NonOSE" -o $@ $<
980
981#
982# Hand made dependencies go here.
983# Basically, here are dependencies for generated UI source files that
984# include generated headers in turn.
985#
986
987# Make all generated UI sources dependent on all generated headers (since they
988# may include them). This is safer than indifidual dependencies above but
989# currently disabled, because will cause all UI sources to be rebuilt one a
990# single one changes.
991#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
992
993
994#
995# Custom targets
996#
997
998# Update all known NLS translation (.ts) files in the nls/ subdirectory.
999# NOTE: This target is intened to be run only by the GUI maintainer shortly
1000# before a new product release. VirtualBox_xx_YY.ts is a template for new
1001# languages and should never be actually translated or installed.
1002updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
1003 $(call MSG_L1,lupdate all languages (nls/*.ts))
1004 $(QUIET)$(VBOX_LUPDATE4) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
1005
1006
1007#
1008# Test targets
1009#
1010
1011test:
1012 @echo ====================
1013 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
1014 @echo --------------------
1015 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
1016 @echo ====================
1017 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
1018 @echo --------------------
1019 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
1020 @echo ====================
1021
1022test2:
1023 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
1024
1025test3:
1026 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
1027
1028testwrappers: $(WRAPPERSFILE)
1029
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette