VirtualBox

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

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

FE/Qt4: Named the Qt3 version VirtualBox3 & the Qt4 version VirtualBox.

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