VirtualBox

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

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

The darwin qt is (soon) available on the tools server, so, made some adjustments for this.

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