VirtualBox

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

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

USE_KBUILD_QT_UNIT: compile and install translation files. updatenls.

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