VirtualBox

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

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

USE_KBUILD_QT_UNIT_PART_2 stuff.

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