VirtualBox

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

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

Moved DEFS into the right place (before SOURCES). LIBS and LDFLAGS was also put before SOURCES, because SOURCES are a mess and goes on for half of the file. :-)

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