VirtualBox

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

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

Set VBOX_WITH_QT4_SUN on non-ose builds of darwin, solaris and windows. Linux users have to set it them selves until the tools server have been updated (todo). (The configure script should override it if internal builds.) qt4 unit part 2: Added a QT_PREFIX to the template based on the

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