VirtualBox

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

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

Fe/Qt4: VirtualBox New Version Notifier dialog implemented.

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