VirtualBox

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

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

Fe/Qt4: GlobalInputSettings ported to qt4, fixed tab-order for GlobalGeneralSettings.

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