VirtualBox

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

Last change on this file since 10344 was 10344, checked in by vboxsync, 17 years ago

Got the qt4 unit working except for nls. there's a question around the updatenls rule for the Qt experts.

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

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