VirtualBox

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

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

Qt4: allow to link Linux/Solaris builds against our Qt4 compiled by Sun

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