VirtualBox

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

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

Both win.x86 and win.amd64 should look for qt/v4*.

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