VirtualBox

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

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

Hopefully fixed the missing installation.

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