VirtualBox

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

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

FE/Qt4-OSX: Macified help button.

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