VirtualBox

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

Last change on this file since 10574 was 10574, checked in by vboxsync, 16 years ago

Try use the qt4 unit.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette