VirtualBox

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

Last change on this file since 9894 was 9886, checked in by vboxsync, 16 years ago

Fe/Qt4: Language Global Settings ported. Global Settings now checks for USB page after ui retranslated due to Global Settings Selector updated in that case. Global Settings dialog is now fully ported.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 38.5 KB
Line 
1# $Id: Makefile.kmk 9886 2008-06-23 15:12:24Z 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/VBoxGlobalSettingsLanguage.ui,$(VirtualBox_QT_UISRCS3))
414VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsLanguage.ui
415
416VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsDlg.ui,$(VirtualBox_QT_UISRCS3))
417VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsDlg.ui
418
419#
420# The targets.
421#
422PROGRAMS = VirtualBox
423ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(KBUILD_TARGET)),) # X11
424DLLS = VBoxKeyboard4
425OTHERS = $(PATH_BIN)/vboxkeyboard4.tar.gz
426endif
427INSTALLS = VirtualBox.nls bin
428
429ifeq ($(KBUILD_TARGET),os2)
430 DLLS += VBoxHlp
431 ifneq ($(strip $(VBOX_DLL_QT)),)
432 INSTALLS += qt.dll
433 qt.dll_INST = $(INST_BIN)
434 qt.dll_SOURCES += \
435 $(VBOX_DLL_QT)=>$(not-dir $(VBOX_DLL_QT))
436 endif
437endif
438
439
440#
441# VBoxHlp - helper DLL for OS/2.
442#
443VBoxHlp_ASTOOL = NASM
444VBoxHlp_ASFLAGS = -f obj
445VBoxHlp_DEFS = IN_RING3 IN_VBOXHLP
446VBoxHlp_CXXFLAGS = -fno-exceptions
447VBoxHlp_LDFLAGS = -nostdlib -los2
448VBoxHlp_LDFLAGS += -Zlinker option -Zlinker manyautodata
449VBoxHlp_SOURCES = \
450 src/os2/VBoxHlp.asm \
451 src/os2/VBoxHlp.cpp
452
453
454#
455# VBoxKeyboard - keyboard library for X11.
456#
457VBoxKeyboard4_TEMPLATE = VBOXR3
458VBoxKeyboard4_SOURCES = \
459 src/linux/keyboard-new.c
460VBoxKeyboard4_TARSOURCES = \
461 $(VBoxKeyboard4_SOURCES) \
462 src/linux/COPYING.LIB \
463 src/linux/keyboard.h \
464 src/linux/keyboard-layouts.h \
465 src/linux/keyboard-list.h \
466 src/linux/keyboard-tables.h \
467 src/linux/Makefile
468VBoxKeyboard4_LIBS = X11
469VBoxKeyboard4_LIBPATH = $(VBOX_LIBPATH_X11)
470
471
472#
473# vboxkeyboard.tar.gz - the LGPLed keyboard library must always be
474# redistributed with usable sources.
475#
476SOURCE_DIRECTORY = vboxkeyboard4
477DIRECTORY_PREFIX = src/linux/
478
479$(PATH_TARGET)/$(SOURCE_DIRECTORY):
480 $(MKDIR) -p $(@D)
481 $(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
482
483$(PATH_BIN)/vboxkeyboard4.tar.gz: $(VBoxKeyboard4_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY)
484 $(call MSG_TOOL,tar/gzip,,$@)
485 $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard4_TARSOURCES))) | gzip - > $@
486
487
488#
489# VirtualBox - The GUI program.
490#
491VirtualBox_TEMPLATE = VBOXQT4GUIEXE
492VirtualBox_NAME = VirtualBox4
493VirtualBox_SDKS.win = WINPSDK DXSDK
494#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(KBUILD_TARGET)),) - later
495ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(KBUILD_TARGET)),) # X11 + os2
496VirtualBox_SDKS += LIBSDL
497endif
498
499ifeq ($(KBUILD_TARGET),darwin)
500# For the launch trick we need different inode numbers.
501VirtualBox_INST = $(INST_BIN)VirtualBox4 $(INST_BIN)VirtualBoxVM4
502
503 # For testing iChat Theater stuff change
504 # the sdk path
505 ifdef VBOX_WITH_ICHAT_THEATER
506 VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk
507 endif
508
509endif
510
511ifndef VBOX_OSE
512ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # linux only, yea, right.
513# Note: I'm doing this right here because the GUI will _not_ run
514# without that file which might be annoying for developers!
515$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
516 $(call MSG_GENERATE,,$@)
517 $(QUIET)$(CP) $< $@
518
519$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
520endif
521endif
522
523# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
524VirtualBox_QT_TRANSLATIONS_QT := \
525 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
526 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
527
528# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
529
530# Headers containing definitions of classes that use the Q_OBJECT macro
531VirtualBox_QT_MOCHDRS = \
532 include/QIWidgetValidator.h \
533 include/QIHotKeyEdit.h \
534 include/QIStatusBar.h \
535 include/QIStateIndicator.h \
536 include/QIMessageBox.h \
537 include/QILabel.h \
538 include/QILabel_p.h \
539 include/QIAbstractWizard.h \
540 include/QIListView.h \
541 include/QITreeWidget.h \
542 include/QIMainDialog.h \
543 include/QIHelpButton.h \
544 include/VBoxGlobalSettings.h \
545 include/VBoxUtils.h \
546 include/VBoxGlobal.h \
547 include/VBoxVMListView.h \
548 include/VBoxMediaComboBox.h \
549 include/VBoxSelectorWnd.h \
550 include/VBoxConsoleWnd.h \
551 include/VBoxConsoleView.h \
552 include/VBoxProblemReporter.h \
553 include/VBoxDownloaderWgt.h \
554 include/VBoxNetworkFramework.h \
555 include/VBoxAboutDlg.h \
556 include/VBoxCloseVMDlg.h \
557 include/VBoxNewVMWzd.h \
558 include/VBoxNewHDWzd.h \
559 include/VBoxVMFirstRunWzd.h \
560 include/VBoxRegistrationDlg.h \
561 include/VBoxSnapshotDetailsDlg.h \
562 include/VBoxVMInformationDlg.h \
563 include/VBoxTakeSnapshotDlg.h \
564 include/VBoxSnapshotsWgt.h \
565 include/VBoxVMLogViewer.h \
566 include/VBoxDiskImageManagerDlg.h \
567 include/VBoxVMSettingsUtils.h \
568 include/VBoxVMSettingsGeneral.h \
569 include/VBoxVMSettingsHD.h \
570 include/VBoxVMSettingsCD.h \
571 include/VBoxVMSettingsFD.h \
572 include/VBoxVMSettingsAudio.h \
573 include/VBoxVMSettingsNetwork.h \
574 include/VBoxVMSettingsSerial.h \
575 include/VBoxVMSettingsParallel.h \
576 include/VBoxVMSettingsUSB.h \
577 include/VBoxVMSettingsSF.h \
578 include/VBoxVMSettingsVRDP.h \
579 include/VBoxVMSettingsDlg.h \
580 include/VBoxGlobalSettingsGeneral.h \
581 include/VBoxGlobalSettingsInput.h \
582 include/VBoxGlobalSettingsLanguage.h \
583 include/VBoxGlobalSettingsDlg.h
584
585# Sources containing local definitions of classes that use the Q_OBJECT macro
586VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
587ifdef VBOX_WITH_XPCOM
588VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
589endif
590
591# All generated sources. Note: this list MUST be in sync with Qt source
592# generation rules defined somewhere below!
593VirtualBox_GENSRCS = \
594 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
595 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS3))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp)
596
597# All generated headers. Note: this list MUST be in sync with Qt source
598# generation rules defined somewhere below!
599VirtualBox_GENHDRS = \
600 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
601 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS3))), $(PATH_VirtualBox)/ui/$(ui).h) \
602 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS4))), $(PATH_VirtualBox)/ui/$(ui).gen.h)
603
604# All existing .ui.h files for known .ui sources
605VirtualBox_QT_UIHDRS = \
606 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS3)))
607
608# All header files
609VirtualBox_HEADERS = \
610 $(wildcard include/*.h) \
611 $(VirtualBox_GENHDRS) \
612 $(VirtualBox_QT_UIHDRS)
613
614
615VirtualBox_SOURCES = \
616 $(VirtualBox_GENSRCS) \
617 src/main.cpp \
618 src/COMDefs.cpp \
619 src/QIWidgetValidator.cpp \
620 src/QIHotKeyEdit.cpp \
621 src/QIStateIndicator.cpp \
622 src/QIStatusBar.cpp \
623 src/QIMessageBox.cpp \
624 src/QILabel.cpp \
625 src/QIAbstractWizard.cpp \
626 src/QIDialog.cpp \
627 src/QIDialogButtonBox.cpp \
628 src/QIListView.cpp \
629 src/QITreeWidget.cpp \
630 src/QIMainDialog.cpp \
631 src/QILineEdit.cpp \
632 src/QIHelpButton.cpp \
633 src/VBoxDefs.cpp \
634 src/VBoxGlobalSettings.cpp \
635 src/VBoxGlobal.cpp \
636 src/VBoxMediaComboBox.cpp \
637 src/VBoxProblemReporter.cpp \
638 src/VBoxSelectorWnd.cpp \
639 src/VBoxConsoleView.cpp \
640 src/VBoxConsoleWnd.cpp \
641 src/VBoxDownloaderWgt.cpp \
642 src/VBoxVMListView.cpp \
643 src/VBoxFrameBuffer.cpp \
644 src/HappyHttp.cpp \
645 src/VBoxNetworkFramework.cpp \
646 src/VBoxAboutDlg.cpp \
647 src/VBoxCloseVMDlg.cpp \
648 src/VBoxNewVMWzd.cpp \
649 src/VBoxNewHDWzd.cpp \
650 src/VBoxVMFirstRunWzd.cpp \
651 src/VBoxRegistrationDlg.cpp \
652 src/VBoxSnapshotDetailsDlg.cpp \
653 src/VBoxVMInformationDlg.cpp \
654 src/VBoxTakeSnapshotDlg.cpp \
655 src/VBoxSnapshotsWgt.cpp \
656 src/VBoxVMLogViewer.cpp \
657 src/VBoxDiskImageManagerDlg.cpp \
658 src/VBoxVMSettingsGeneral.cpp \
659 src/VBoxVMSettingsHD.cpp \
660 src/VBoxVMSettingsCD.cpp \
661 src/VBoxVMSettingsFD.cpp \
662 src/VBoxVMSettingsAudio.cpp \
663 src/VBoxVMSettingsNetwork.cpp \
664 src/VBoxVMSettingsSerial.cpp \
665 src/VBoxVMSettingsParallel.cpp \
666 src/VBoxVMSettingsUSB.cpp \
667 src/VBoxVMSettingsSF.cpp \
668 src/VBoxVMSettingsVRDP.cpp \
669 src/VBoxVMSettingsDlg.cpp \
670 src/VBoxGlobalSettingsGeneral.cpp \
671 src/VBoxGlobalSettingsInput.cpp \
672 src/VBoxGlobalSettingsLanguage.cpp \
673 src/VBoxGlobalSettingsDlg.cpp
674
675ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
676ifndef VBOX_OSE
677VirtualBox_QT_MOCHDRS += \
678 include/VBoxLicenseViewer.h
679VirtualBox_SOURCES += \
680 src/VBoxLicenseViewer.cpp
681endif
682VirtualBox_SOURCES += \
683 src/linux/XKeyboard-new.cpp
684endif
685
686VirtualBox_SOURCES.win += \
687 src/VBoxFBDDRAW.cpp \
688 $(PATH_TARGET)/VirtualBox4.rc
689
690VirtualBox_SOURCES.darwin = \
691 src/darwin/DarwinKeyboard.cpp \
692 src/darwin/DarwinCursor.cpp \
693 src/darwin/VBoxUtils-darwin.cpp \
694 src/VBoxFBQuartz2D.cpp
695# src/darwin/VBoxAquaStyle.cpp \
696
697ifdef VBOX_WITH_ICHAT_THEATER
698 VirtualBox_SOURCES.darwin += \
699 src/darwin/VBoxIChatTheaterWrapper.m
700endif
701
702ifneq ($(KBUILD_TARGET),win)
703src/HappyHttp.cpp_CXXFLAGS += -fexceptions
704src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
705src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
706endif
707src/HappyHttp.cpp_CXXFLAGS.linux += -O2
708
709## @todo how to detect what tool is used?
710## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
711# more generic -Wno-extra
712ifdef VBOX_WITH_XPCOM
713src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
714endif
715
716VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
717VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
718VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
719VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
720VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
721VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
722VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
723VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
724VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
725VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
726VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
727#ifndef VBOX_OSE
728 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
729#endif
730ifdef VBOX_WITH_ICHAT_THEATER
731 VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
732endif
733ifneq ($(KBUILD_TYPE),release)
734 # non-release builds has some extra features.
735 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
736 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
737endif
738ifdef VBOX_WITH_REGISTRATION
739 VirtualBox_DEFS += VBOX_WITH_REGISTRATION
740endif
741ifdef VBOX_WITH_REGISTRATION_REQUEST
742 VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
743endif
744ifdef VBOX_WITH_ALSA
745 VirtualBox_DEFS += VBOX_WITH_ALSA
746endif
747ifdef VBOX_WITH_PULSE
748 VirtualBox_DEFS += VBOX_WITH_PULSE
749endif
750ifdef VBOX_WITH_E1000
751 VirtualBox_DEFS += VBOX_WITH_E1000
752endif
753ifdef VBOX_OSE
754 VirtualBox_DEFS += VBOX_OSE
755endif
756ifdef VBOX_WITH_DEBUGGER_GUI
757 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
758endif
759
760VirtualBox_INCS = \
761 ./include \
762 $(PATH_VirtualBox)/ui \
763 $(PATH_VirtualBox)/moc \
764 $(PATH_VirtualBox)/include \
765
766
767ifeq ($(KBUILD_TYPE),release)
768 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
769else
770 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
771 ifeq ($(USERNAME),dmik)
772 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
773 else
774 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
775 endif
776endif
777VirtualBox_LDFLAGS.os2 = -Zlinker /PM:PM -Zno-fork
778VirtualBox_LDFLAGS.darwin = -framework IOKit -framework AppKit -framework ApplicationServices -framework Foundation -lz
779ifdef VBOX_WITH_ICHAT_THEATER
780 VirtualBox_LDFLAGS.darwin += -framework InstantMessage -framework QuartzCore
781endif
782VirtualBox_LIBS.win = \
783 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
784 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
785 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
786VirtualBox_LIBS.os2 += $(PATH_DLL)/VBoxHlp$(VBOX_SUFF_DLL)
787ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
788VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard4$(VBOX_SUFF_DLL)
789endif
790
791
792ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
793 ifeq ($(KBUILD_TARGET),win)
794 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
795 else
796 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
797 endif
798endif
799
800WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
801WRAPPERSINCFILE = include/COMDefs.h
802WRAPPERSTEMPLATE = include/COMWrappers.xsl
803XIDLFILE = ../../Main/idl/VirtualBox.xidl
804
805VirtualBox_INTERMEDIATES = $(WRAPPERSFILE)
806
807
808# generated files we need to clean manually
809OTHER_CLEAN = \
810 $(VirtualBox_GENSRCS) \
811 $(VirtualBox_GENHDRS) \
812 $(WRAPPERSFILE) \
813 $(PATH_BIN)/vboxkeyboard.tar.gz
814
815#
816# On Windows we'll have to generate/edit the resource file.
817# The IDI_ICON1 name is Qt specific.
818#
819$(PATH_TARGET)/VirtualBox4.rc: Makefile.kmk $(VBOX_WINDOWS_ICON_FILE) | $$(call DIRDEP,$$(@D))
820 $(RM) -f $@
821 $(APPEND) $@ 'IDI_ICON1 ICON "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
822 $(CAT) $@
823
824OTHER_CLEAN.win += $(PATH_TARGET)/VirtualBox4.rc
825
826
827#
828# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
829#
830INSTALLS.darwin += VirtualBox.app
831VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
832VirtualBox.app_MODE = 644
833VirtualBox.app_SOURCES = \
834 src/darwin/PkgInfo \
835 $(PATH_TARGET)/Info.plist \
836 $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
837
838$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
839 $(call MSG_GENERATE,VirtualBox.app,$<,$@)
840 $(QUIET)$(RM) -f $@
841 $(QUIET)$(SED) \
842 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
843 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
844 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
845 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
846 $< > $@
847
848INSTALLS.darwin += VirtualBoxVM.app
849VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
850VirtualBoxVM.app_MODE = 644
851VirtualBoxVM.app_SOURCES = \
852 src/darwin/VM-PkgInfo=>PkgInfo \
853 $(PATH_TARGET)/VM-Info.plist=>Info.plist \
854 $(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
855VirtualBoxVM.app_SYMLINKS = \
856 MacOS=>../../../MacOS/
857
858$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
859 $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
860 $(QUIET)$(RM) -f $@
861 $(QUIET)$(SED) \
862 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
863 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
864 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
865 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
866 --output $@ $<
867
868#
869# Translation installation
870#
871VirtualBox.nls_INST = $(INST_BIN)nls4/
872VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
873VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
874VirtualBox.nls_MODE = 644
875
876
877#
878# Testcase for the darwin keyboard routines.
879#
880ifdef VBOX_WITH_TESTCASES
881PROGRAMS.darwin += tstDarwinKeyboard4
882tstDarwinKeyboard4_TEMPLATE = VBOXR3TSTEXE
883tstDarwinKeyboard4_INCS = include
884tstDarwinKeyboard4_SOURCES = \
885 src/darwin/tstDarwinKeyboard.cpp \
886 src/darwin/DarwinKeyboard.cpp
887tstDarwinKeyboard4_LDFLAGS = -framework IOKit -framework Carbon
888tstDarwinKeyboard4_LIBS = \
889 $(LIB_RUNTIME)
890endif
891
892# grep the images out of the resource file for dependency tracking
893VirtualBox_QT_RC += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox.qrc)
894VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application.cpp
895
896# We have different about dialogs in OSE and PUEL. Therefor two independent
897# resource files exists.
898ifdef VBOX_OSE
899VirtualBox_QT_RC_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_OSE.qrc)
900VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_ose.cpp
901else
902VirtualBox_QT_RC_NON_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_NonOSE.qrc)
903VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp
904VirtualBox_SOURCES += src/VBoxAboutNonOSEDlg.cpp
905VirtualBox_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h
906endif
907
908# OSE version is always necessary for lupdate/lrelease
909VirtualBox_QT_UISRCS4 += ui/VBoxAboutDlg.ui
910
911# Commit the magic.
912# (note: before custom rules that make usage of generated variables!).
913include $(KBUILD_PATH)/footer.kmk
914
915
916#
917# Qt source file generation rules
918#
919
920## @todo move QT source generation macros to kBuild
921
922## Generate a rule to create a MOC source file from a header containing
923# classes that use the Q_OBJECT macro.
924# @param $mochdr header file with Q_OBJECT
925define def_qt_gen_src_moc
926
927$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
928
929$(target)_GENSRCS_REAL += $(mocsrc)
930## @todo The source should be added to GEN_SOURCES: $ (target)_GEN_SOURCES += $ (mocsrc)
931
932$(mocsrc): $(mochdr)
933 $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
934 $$(QUIET)$$(MKDIR) -p $$(@D)
935 $$(QUIET)$$(VBOX_MOC4) \
936 $(addprefix -D,$($(target)_DEFS)) \
937 $(addprefix -I,$($(target)_INCS)) \
938 $(mochdr) -o $$@
939
940endef
941
942## Generate a rule to create a MOC include file from a source containing
943# local classes that use the Q_OBJECT macro. This include is then included
944# by that source, so it must be generated before the source gets compiled.
945# @param $mocsrc source file with Q_OBJECT
946define def_qt_gen_inc_moc
947
948$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
949$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
950
951$(target)_GENHDRS_REAL += $(mocinc)
952$(target)_INTERMEDIATES += $(mocinc)
953
954$(mocobj): $(mocinc)
955
956$(mocinc): $(mocsrc)
957 $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
958 $$(QUIET)$$(MKDIR) -p $$(@D)
959 $$(QUIET)$$(VBOX_MOC4) \
960 $(addprefix -D,$($(target)_DEFS)) \
961 $(addprefix -I,$($(target)_INCS)) \
962 -i $(mocsrc) -o $$@
963
964endef
965
966## Generate a rule to create a MOC include file from a UI header (ui.h) containing
967# local classes that use the Q_OBJECT macro. This include is then included
968# by that header, so it must be generated before the UI source gets compiled.
969# @param $mocuihdr UI header file with Q_OBJECT
970define def_qt_gen_inc_mocuihdr
971
972$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
973$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
974$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
975
976$(target)_GENHDRS_REAL += $(mocuiinc)
977$(target)_INTERMEDIATES += $(mocuiinc)
978
979$(uisrc): $(mocuiinc)
980$(mocuiinc): $(mocuihdr)
981 $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
982 $$(QUIET)$$(MKDIR) -p $$(@D)
983 $$(QUIET)$$(VBOX_MOC4) \
984 $(addprefix -D,$($(target)_DEFS)) \
985 $(addprefix -I,$($(target)_INCS)) \
986 -i $(mocuihdr) -o $$@
987
988endef
989
990## Generate a rule to create a header and source files from an UI3
991# definition source (.ui).
992# @param $uifile UI definintion source file
993define def_qt_gen_src_ui3
994
995$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
996$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
997$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
998
999
1000$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
1001$(target)_GENHDRS_REAL += $(uihdr)
1002$(target)_INTERMEDIATES += $(uihdr)
1003## @todo The source should be added to GEN_SOURCES: $ (target)_GEN_SOURCES += $ (uisrc) $ (mocsrc)
1004
1005$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
1006 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
1007 $$(QUIET)$$(VBOX_UIC3) $(uifile) -o $$@
1008
1009$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
1010 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
1011 $$(QUIET)$$(VBOX_UIC3) -impl $(uihdr) $(uifile) -o $$@
1012
1013#$$(QUIET)$$(VBOX_UIC3) $(uifile) -i $(uihdr) -o $$@
1014
1015$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
1016 $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
1017 $$(QUIET)$$(VBOX_MOC4) \
1018 $(addprefix -D,$($(target)_DEFS)) \
1019 $(addprefix -I,$($(target)_INCS)) \
1020 $(uihdr) -o $$@
1021
1022endef
1023
1024## Generate a rule to create a header file from an UI4
1025# definition source (.ui).
1026# @param $uifile UI definintion source file
1027define def_qt_gen_src_ui4
1028
1029$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).gen.h)
1030
1031$(target)_GENHDRS_REAL += $(uihdr)
1032$(target)_INTERMEDIATES += $(uihdr)
1033
1034$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
1035 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
1036 $$(QUIET)$$(VBOX_UIC4) $(uifile) -o $$@
1037
1038# we assume that the generated header is at least included by
1039# the normal header with the same name
1040include/$(notdir $(basename $(uifile))).h: $(uihdr)
1041
1042endef
1043
1044## Generate a rule to create a .qm file from a NLS translation
1045# source (.ts).
1046# @param $tsfile Translation source file
1047define def_qt_gen_nls
1048
1049$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
1050
1051OTHER_CLEAN += $(qmfile)
1052
1053# Note that we use -nocompress in lrelease to avoid stripping comments and
1054# other information from .qm files. If we don't do that, we get .qm files two
1055# times smaller, but QTranslator::findMessage() will start searching for
1056# translations in all existing contexts in case if it cannot find it in the
1057# original context (which is of course not acceptable, no matter if it's a
1058# special Qt "feature" or just a bug).
1059
1060$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
1061 $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
1062 $$(QUIET)$$(VBOX_LRELEASE4) -nocompress -silent $(tsfile) -qm $$@
1063
1064endef
1065
1066## Generate rules for generating the Qt source for a target.
1067# @param $target Target name.
1068define def_qt_gen_src
1069
1070# moc srcs from hdrs with Q_OBJECT
1071$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
1072# moc includes from srcs with Q_OBJECT
1073$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
1074# moc includes from UI headers with Q_OBJECT
1075$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
1076# UI3 sources
1077$(foreach uifile,$($(target)_QT_UISRCS3),$(eval $(def_qt_gen_src_ui3)))
1078# UI4 sources
1079$(foreach uifile,$($(target)_QT_UISRCS4),$(eval $(def_qt_gen_src_ui4)))
1080# NLS files
1081$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
1082$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
1083# dirs
1084$$(call DIRDEP,$(PATH_$(target))/ui/) \
1085$$(call DIRDEP,$(PATH_$(target))/moc/) \
1086$$(call DIRDEP,$(PATH_$(target))/nls/):
1087 $$(call MSG_MKDIR,$$@)
1088 $$(QUIET)$$(MKDIR) -p $$@
1089
1090endef
1091
1092# Generate Qt source rules.
1093$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
1094
1095
1096# Generate COM Wrappers
1097$(WRAPPERSINCFILE): $(WRAPPERSFILE)
1098
1099$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
1100 $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
1101 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
1102
1103$(call DIRDEP,$(PATH_VirtualBox)/include/):
1104 $(call MSG_MKDIR,$@)
1105 $(QUIET)$(MKDIR) -p $@
1106
1107# rules for resources file creation
1108$(PATH_VirtualBox)/ui/qrc_application.cpp: VirtualBox.qrc $(VirtualBox_QT_RC)
1109 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
1110 $(QUIET)$(VBOX_RCC4) -o $@ $<
1111
1112$(PATH_VirtualBox)/ui/qrc_application_ose.cpp: VirtualBox_OSE.qrc $(VirtualBox_QT_RC_OSE)
1113 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
1114 $(QUIET)$(VBOX_RCC4) -name "OSE" -o $@ $<
1115
1116$(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp: VirtualBox_NonOSE.qrc $(VirtualBox_QT_RC_NON_OSE)
1117 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
1118 $(QUIET)$(VBOX_RCC4) -name "NonOSE" -o $@ $<
1119
1120#
1121# Hand made dependencies go here.
1122# Basically, here are dependencies for generated UI source files that
1123# include generated headers in turn.
1124#
1125
1126# Make all generated UI sources dependent on all generated headers (since they
1127# may include them). This is safer than indifidual dependencies above but
1128# currently disabled, because will cause all UI sources to be rebuilt one a
1129# single one changes.
1130#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS3)))) : $(VirtualBox_GENHDRS)
1131
1132
1133#
1134# Custom targets
1135#
1136
1137# Update all known NLS translation (.ts) files in the nls/ subdirectory.
1138# NOTE: This target is intened to be run only by the GUI maintainer shortly
1139# before a new product release. VirtualBox_xx_YY.ts is a template for new
1140# languages and should never be actually translated or installed.
1141updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
1142 $(call MSG_L1,lupdate all languages (nls/*.ts))
1143 $(QUIET)$(VBOX_LUPDATE4) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
1144
1145
1146#
1147# Test targets
1148#
1149
1150test:
1151 @echo ====================
1152 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
1153 @echo --------------------
1154 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
1155 @echo ====================
1156 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
1157 @echo --------------------
1158 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
1159 @echo ====================
1160
1161test2:
1162 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
1163
1164test3:
1165 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
1166
1167testwrappers: $(WRAPPERSFILE)
1168
Note: See TracBrowser for help on using the repository browser.

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