VirtualBox

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

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

VBoxKeyboard4_TARSOURCES isn't right. Added missing cleanup of the tar.gz.

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