VirtualBox

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

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

FE/Qt4: Enabled Qt3Support library again. Too many errors on windows.

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