VirtualBox

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

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

Try enable the qt4 unit.

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