VirtualBox

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

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

Use addprefix instead of foreach (couple of .darwin places left). Hacked it so it'll build here on my gentoo - we will add *proper* detection later.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 27.9 KB
Line 
1# $Id: Makefile.kmk 7373 2008-03-07 15:19:40Z vboxsync $
2## @file
3# Makefile for the VirtualBox Qt GUI.
4#
5
6#
7# Copyright (C) 2006-2007 innotek GmbH
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
18# include qmake project file
19include VBoxUI.pro
20
21# Import QDesigner UI sources
22VirtualBox_QT_UISRCS := $(FORMS)
23# Import translation sources
24VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
25
26# reset things to avoid possible conflicts with kBuild
27TEMPLATE :=
28LANGUAGE :=
29FORMS :=
30TRANSLATIONS :=
31IMAGES :=
32
33VBOX_WITH_REGISTRATION := 1
34VBOX_WITH_REGISTRATION_REQUEST := 1
35
36DEPTH = ../../../..
37include $(PATH_KBUILD)/header.kmk
38
39# Disable the debugger for now, this is another story.
40VBOX_WITH_DEBUGGER_GUI :=
41DEFS := $(filter-out VBOX_WITH_DEBUGGER_GUI,$(DEFS))
42
43#
44# Handmade configuration of qt4 - very annoying, this needs to
45# be cleaned up properly later some time (not important now).
46#
47ifndef VBOX_PATH_QT4
48 if1of ($(USERNAME), bird)
49 # gentoo (64-bit)
50 VBOX_PATH_QT4 ?= /usr
51 VBOX_PATH_QT4_BIN ?= /usr/bin
52 VBOX_PATH_QT4_INCLUDE ?= /usr/include/qt4
53 VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
54 VBOX_PATH_QT4_LIB64 ?= /usr/lib/qt4
55 VBOX_PATH_QT4_SHARE ?= /usr/share/qt4
56 endif
57endif
58VBOX_PATH_QT4 ?= /usr
59VBOX_PATH_QT4_BIN ?= $(VBOX_PATH_QT4)/bin
60VBOX_PATH_QT4_INCLUDE ?= $(VBOX_PATH_QT4)/include
61VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
62VBOX_PATH_QT4_LIB64 ?= $(VBOX_PATH_QT4)/lib64
63VBOX_PATH_QT4_SHARE ?= $(VBOX_PATH_QT4)
64
65VBOX_MODULE_QT4 = QtCore QtGui QtNetwork Qt3Support
66VBOX_DEFS_QT4 = QT_CORE_LIB QT_GUI_LIB QT_NETWORK_LIB QT_QT3SUPPORT_LIB
67
68ifeq ($(BUILD_TARGET),darwin)
69 VBOX_MODULE_QT4 += QtSql QtXml
70 VBOX_DEFS_QT4 = QT_SQL_LIB QT_XML_LIB
71 VBOX_INCS_QT4 = $(foreach mod, $(VBOX_MODULE_QT4), $(join $(join /Library/Frameworks/, $(mod)), .framework/Headers))
72 VBOX_LIBS_QT4 =
73else
74 VBOX_INCS_QT4 = \
75 $(VBOX_PATH_QT4_SHARE)/mkspecs/linux-g++ \
76 $(addprefix $(VBOX_PATH_QT4_INCLUDE)/, $(VBOX_MODULE_QT4) Qt) \
77 $(VBOX_PATH_QT4_INCLUDE)
78 VBOX_LIBS_QT4 = $(VBOX_MODULE_QT4)
79endif
80
81# Warn about all what you know about porting qt3->qt4.
82# Disable this if you like to see something on your screen.
83#VBOX_DEFS_QT4 += QT3_SUPPORT_WARNINGS
84# Some default defs
85VBOX_DEFS_QT4 += QT3_SUPPORT QT_SHARED HAVE_CONFIG_H QT_NO_DEBUG
86
87VBOX_UIC4 ?= $(VBOX_PATH_QT4_BIN)/uic3
88VBOX_MOC4 ?= $(VBOX_PATH_QT4_BIN)/moc
89VBOX_RCC4 ?= $(VBOX_PATH_QT4_BIN)/rcc
90VBOX_LUPDATE4 ?= $(VBOX_PATH_QT4_BIN)/lupdate
91VBOX_LRELEASE4 ?= $(VBOX_PATH_QT4_BIN)/lrelease
92
93# Template copy from the qt3 stuff. Appended a "4" on the
94# relevant places.
95
96#
97# Template for building Qt GUI executables.
98#
99
100TEMPLATE_VBOXQT4GUIEXE = VBox Qt4 GUI Executable
101TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS) $(VBOX_DEFS_QT4)
102TEMPLATE_VBOXQT4GUIEXE_INCS = \
103 $(VBOX_PATH_SDK)/include \
104 $(VBOX_INCS_QT4)
105
106ifeq ($(BUILD_TARGET),win)
107 # drag in library configuration (we need QMAKE_PRL_DEFINES)
108 ifneq ($(LIB_QT_PRL),)
109 include $(LIB_QT_PRL)
110 endif
111 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
112 TEMPLATE_VBOXQT4GUIEXE_DEFS += \
113 _WIN32_WINNT=0x0500 UNICODE _UNICODE \
114 QT_DLL _CRT_SECURE_NO_DEPRECATE \
115 $(QMAKE_PRL_DEFINES)
116 ## @todo VCC70 flags?
117 ifdef VBOX_USE_VCC80
118 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
119 -nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
120 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
121 else
122 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
123 -nologo -Zm200 -W3 -MD -Zi -GX
124 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -GZ
125 endif
126 TEMPLATE_VBOXQT4GUIEXE_INCS += \
127 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
128 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
129 /NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
130 /DELAYLOAD:oleaut32.dll
131 TEMPLATE_VBOXQT4GUIEXE_SDKS = WINPSDK
132 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
133 $(LIB_QT) \
134 $(LIB_QTMAIN) \
135 $(LIB_RUNTIME) \
136 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
137 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
138 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
139 $(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
140 $(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
141 TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
142
143else # the gcc guys:
144 TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
145 TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
146
147 TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
148
149 TEMPLATE_VBOXQT4GUIEXE_INCS += \
150 $(LIB_SDL_INC)
151 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
152 -pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
153 -Wno-long-long -fshort-wchar -fno-strict-aliasing \
154 $(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
155 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
156 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
157 TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
158 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
159 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
160 TEMPLATE_VBOXQT4GUIEXE_LIBS = \
161 $(VBOX_LIBS_QT4) \
162 $(LIB_SDL) \
163 $(LIB_RUNTIME) \
164 $(LIB_REM) \
165 $(LIB_VMM)
166
167 ifeq ($(BUILD_TARGET_ARCH),amd64)
168 TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
169 $(VBOX_PATH_QT4_LIB64) $(VBOX_PATH_QT4_LIB)
170 else
171 TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
172 $(VBOX_PATH_QT4_LIB)
173 endif
174
175 ifeq ($(BUILD_TARGET),linux)
176 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
177 else ifeq ($(BUILD_TARGET),darwin)
178 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(foreach mod, $(VBOX_MODULE_QT4), -framework $(mod)) \
179 -framework Carbon -framework QuickTime -bind_at_load
180 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
181 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
182 else ifeq ($(BUILD_TARGET),os2)
183 # drag in library configuration (we need QMAKE_PRL_DEFINES)
184 ifneq ($(LIB_QT_PRL),)
185 include $(LIB_QT_PRL)
186 endif
187 TEMPLATE_VBOXQT4GUIEXE_DEFS += $(QMAKE_PRL_DEFINES)
188 TEMPLATE_VBOXQT4GUIEXE_LIBS +=
189 TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
190 else
191 TEMPLATE_VBOXQT4GUIEXE_INCS += \
192 $(VBOX_XCURSOR_INCS)
193 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
194 $(VBOX_XCURSOR_LIBS) \
195 Xext \
196 X11 \
197 m \
198 $(LIB_PTHREAD)
199 TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
200 $(VBOX_LIBPATH_X11)
201 ifeq ($(BUILD_TARGET),freebsd)
202 TEMPLATE_VBOXQT4GUIEXE_INCS += \
203 /usr/include \
204 /usr/X11R6/include \
205 /usr/local/include
206 endif
207 ifeq ($(BUILD_TARGET),solaris)
208 TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '-R$$(VBOX_ORIGIN):$$(VBOX_ORIGIN)/qtgcc/lib'
209 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
210 rt socket nsl
211 endif
212 endif
213
214endif
215
216# Add COM/XPCOM stuff
217TEMPLATE_VBOXQT4GUIEXE_LIBS += \
218 $(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
219ifdef VBOX_WITH_XPCOM
220 ## @todo may be worth creating the VBOX_XPCOM SDK def
221 TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
222 TEMPLATE_VBOXQT4GUIEXE_INCS += \
223 $(VBOX_XPCOM_INCS)
224 TEMPLATE_VBOXQT4GUIEXE_LIBS += \
225 $(LIB_XPCOM)
226endif
227
228#
229# Template for building Qt GUI components.
230#
231TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
232TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQTGUIEXE
233TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
234ifeq ($(BUILD_TARGET),darwin)
235 TEMPLATE_VBOXQT4GUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS))
236endif
237ifeq ($(filter-out solaris.x86 %.amd64,$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),)
238 ifneq ($(BUILD_TARGET),win)
239 TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
240 TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
241 TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
242 TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
243 endif
244endif
245
246
247#
248# exclude inappropriate UI content
249#
250ifndef VBOX_WITH_REGISTRATION
251VirtualBox_QT_UISRCS := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS))
252endif
253
254
255#
256# The targets.
257#
258PROGRAMS = VirtualBox
259ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(BUILD_TARGET)),) # X11
260DLLS = VBoxKeyboard
261OTHERS = $(PATH_BIN)/vboxkeyboard.tar.gz
262endif
263INSTALLS = VirtualBox.nls
264
265ifeq ($(BUILD_TARGET),os2)
266 DLLS += VBoxHlp
267 ifneq ($(strip $(VBOX_DLL_QT)),)
268 INSTALLS += qt.dll
269 qt.dll_INST = $(INST_BIN)
270 qt.dll_SOURCES += \
271 $(VBOX_DLL_QT)=>$(not-dir $(VBOX_DLL_QT))
272 endif
273endif
274
275
276#
277# VBoxHlp - helper DLL for OS/2.
278#
279VBoxHlp_ASTOOL = NASM
280VBoxHlp_ASFLAGS = -f obj
281VBoxHlp_DEFS = IN_RING3 IN_VBOXHLP
282VBoxHlp_CXXFLAGS = -fno-exceptions
283VBoxHlp_LDFLAGS = -nostdlib -los2
284VBoxHlp_LDFLAGS += -Zlinker option -Zlinker manyautodata
285VBoxHlp_SOURCES = \
286 src/os2/VBoxHlp.asm \
287 src/os2/VBoxHlp.cpp
288
289
290#
291# VBoxKeyboard - keyboard library for X11.
292#
293VBoxKeyboard_TEMPLATE = VBOXR3
294VBoxKeyboard_SOURCES = \
295 src/linux/keyboard-new.c
296VBoxKeyboard_TARSOURCES = \
297 $(VBoxKeyboard_SOURCES) \
298 src/linux/COPYING.LIB \
299 src/linux/keyboard.h \
300 src/linux/keyboard-layouts.h \
301 src/linux/keyboard-list.h \
302 src/linux/keyboard-tables.h \
303 src/linux/Makefile
304VBoxKeyboard_LIBS = X11
305VBoxKeyboard_LIBPATH = $(VBOX_LIBPATH_X11)
306
307
308#
309# vboxkeyboard.tar.gz - the LGPLed keyboard library must always be
310# redistributed with usable sources.
311#
312SOURCE_DIRECTORY = vboxkeyboard
313DIRECTORY_PREFIX = src/linux/
314
315$(PATH_TARGET)/$(SOURCE_DIRECTORY):
316 $(MKDIR) -p $(@D)
317 $(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
318
319$(PATH_BIN)/vboxkeyboard.tar.gz: $(VBoxKeyboard_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY)
320 $(call MSG_TOOL,tar/gzip,,$@)
321 $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard_TARSOURCES))) | gzip - > $@
322
323
324#
325# VirtualBox - The GUI program.
326#
327VirtualBox_TEMPLATE = VBOXQT4GUIEXE
328VirtualBox_NAME = VirtualBox4
329VirtualBox_SDKS.win = WINPSDK DXSDK
330#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(BUILD_TARGET)),) - later
331ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(BUILD_TARGET)),) # X11 + os2
332VirtualBox_SDKS += LIBSDL
333endif
334
335ifeq ($(BUILD_TARGET),darwin)
336# For the launch trick we need different inode numbers.
337VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
338
339 # For testing iChat Theater stuff change
340 # the sdk path
341 ifdef VBOX_WITH_ICHAT_THEATER
342 VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk
343 endif
344
345endif
346
347ifndef VBOX_OSE
348ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # linux only, yea, right.
349# Note: I'm doing this right here because the GUI will _not_ run
350# without that file which might be annoying for developers!
351$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
352 $(call MSG_GENERATE,,$@)
353 $(QUIET)$(CP) $< $@
354
355$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
356endif
357endif
358
359# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
360VirtualBox_QT_TRANSLATIONS_QT := \
361 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
362 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
363
364# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
365
366# Headers containing definitions of classes that use the Q_OBJECT macro
367VirtualBox_QT_MOCHDRS = \
368 include/QIWidgetValidator.h \
369 include/QIHotKeyEdit.h \
370 include/QIStatusBar.h \
371 include/QIStateIndicator.h \
372 include/QIMessageBox.h \
373 include/QIRichLabel.h \
374 include/VBoxGlobalSettings.h \
375 include/VBoxUtils.h \
376 include/VBoxGlobal.h \
377 include/VBoxVMListBox.h \
378 include/VBoxMediaComboBox.h \
379 include/VBoxSelectorWnd.h \
380 include/VBoxConsoleWnd.h \
381 include/VBoxConsoleView.h \
382 include/VBoxProblemReporter.h \
383 include/VBoxDownloaderWgt.h \
384 include/VBoxNetworkFramework.h
385
386# Sources containing local definitions of classes that use the Q_OBJECT macro
387VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
388ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
389VirtualBox_QT_MOCSRCS += src/VBoxGlobal.cpp
390endif
391ifdef VBOX_WITH_XPCOM
392VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
393endif
394
395# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
396VirtualBox_QT_MOCUIHDRS = \
397 ui/VBoxVMSettingsDlg.ui.h \
398 ui/VBoxVMLogViewer.ui.h \
399 ui/VBoxSharedFoldersSettings.ui.h
400
401
402# All generated sources. Note: this list MUST be in sync with Qt source
403# generation rules defined somewhere below!
404VirtualBox_GENSRCS = \
405 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
406 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
407 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
408
409# All generated headers. Note: this list MUST be in sync with Qt source
410# generation rules defined somewhere below!
411VirtualBox_GENHDRS = \
412 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
413 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
414 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
415
416# All existing .ui.h files for known .ui sources
417VirtualBox_QT_UIHDRS = \
418 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
419
420# All header files
421VirtualBox_HEADERS = \
422 $(wildcard include/*.h) \
423 $(VirtualBox_GENHDRS) \
424 $(VirtualBox_QT_UIHDRS)
425
426
427VirtualBox_SOURCES = \
428 $(VirtualBox_GENSRCS) \
429 src/main.cpp \
430 src/COMDefs.cpp \
431 src/QIWidgetValidator.cpp \
432 src/QIHotKeyEdit.cpp \
433 src/QIStateIndicator.cpp \
434 src/QIStatusBar.cpp \
435 src/QIMessageBox.cpp \
436 src/QIRichLabel.cpp \
437 src/VBoxDefs.cpp \
438 src/VBoxGlobalSettings.cpp \
439 src/VBoxGlobal.cpp \
440 src/VBoxMediaComboBox.cpp \
441 src/VBoxProblemReporter.cpp \
442 src/VBoxSelectorWnd.cpp \
443 src/VBoxConsoleView.cpp \
444 src/VBoxConsoleWnd.cpp \
445 src/VBoxDownloaderWgt.cpp \
446 src/VBoxVMListBox.cpp \
447 src/VBoxFrameBuffer.cpp \
448 src/HappyHttp.cpp \
449 src/VBoxNetworkFramework.cpp
450
451ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
452VirtualBox_SOURCES += \
453 src/linux/XKeyboard-new.cpp
454endif
455
456VirtualBox_SOURCES.win += \
457 src/win32/VirtualBox.rc
458
459VirtualBox_SOURCES.win += \
460 src/VBoxFBDDRAW.cpp
461
462VirtualBox_SOURCES.darwin = \
463 src/darwin/DarwinKeyboard.cpp \
464 src/darwin/DarwinCursor.cpp \
465 src/darwin/VBoxUtils-darwin.cpp \
466 src/VBoxFBQuartz2D.cpp
467# src/darwin/VBoxAquaStyle.cpp \
468
469ifdef VBOX_WITH_ICHAT_THEATER
470 VirtualBox_SOURCES.darwin += \
471 src/darwin/VBoxIChatTheaterWrapper.m
472endif
473
474ifneq ($(BUILD_TARGET),win)
475src/HappyHttp.cpp_CXXFLAGS += -fexceptions
476src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
477src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
478endif
479src/HappyHttp.cpp_CXXFLAGS.linux += -O2
480
481## @todo how to detect what tool is used?
482## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
483# more generic -Wno-extra
484ifdef VBOX_WITH_XPCOM
485src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
486endif
487
488VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
489VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
490VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
491VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
492VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
493VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
494VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
495VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
496VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
497VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
498VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
499#ifndef VBOX_OSE
500 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
501#endif
502ifdef VBOX_WITH_ICHAT_THEATER
503 VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
504endif
505ifneq ($(BUILD_TYPE),release)
506 # non-release builds has some extra features.
507 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER
508 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
509 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
510endif
511ifdef VBOX_WITH_REGISTRATION
512 VirtualBox_DEFS += VBOX_WITH_REGISTRATION
513endif
514ifdef VBOX_WITH_REGISTRATION_REQUEST
515 VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
516endif
517ifdef VBOX_WITH_ALSA
518 VirtualBox_DEFS += VBOX_WITH_ALSA
519endif
520ifdef VBOX_WITH_PULSE
521 VirtualBox_DEFS += VBOX_WITH_PULSE
522endif
523ifdef VBOX_OSE
524 VirtualBox_DEFS += VBOX_OSE
525endif
526ifdef VBOX_WITH_DEBUGGER_GUI
527 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
528endif
529
530VirtualBox_INCS = \
531 ./include \
532 $(PATH_VirtualBox)/ui \
533 $(PATH_VirtualBox)/moc \
534 $(PATH_VirtualBox)/include \
535
536
537ifeq ($(BUILD_TYPE),release)
538 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
539else
540 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
541 ifeq ($(USERNAME),dmik)
542 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
543 else
544 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
545 endif
546endif
547VirtualBox_LDFLAGS.os2 = -Zlinker /PM:PM -Zno-fork
548VirtualBox_LDFLAGS.darwin = -framework IOKit -framework AppKit -framework ApplicationServices -framework Foundation -lz
549ifdef VBOX_WITH_ICHAT_THEATER
550 VirtualBox_LDFLAGS.darwin += -framework InstantMessage -framework QuartzCore
551endif
552VirtualBox_LIBS.win = \
553 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
554 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
555 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
556VirtualBox_LIBS.os2 += $(PATH_DLL)/VBoxHlp$(VBOX_SUFF_DLL)
557ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
558VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
559endif
560
561
562ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
563 ifeq ($(BUILD_TARGET),win)
564 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
565 else
566 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
567 endif
568endif
569
570WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
571WRAPPERSINCFILE = include/COMDefs.h
572WRAPPERSTEMPLATE = include/COMWrappers.xsl
573XIDLFILE = ../../Main/idl/VirtualBox.xidl
574
575
576# generated files we need to clean manually
577OTHER_CLEAN = \
578 $(VirtualBox_GENSRCS) \
579 $(VirtualBox_GENHDRS) \
580 $(WRAPPERSFILE) \
581 $(PATH_BIN)/vboxkeyboard.tar.gz
582
583
584#
585# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
586#
587INSTALLS.darwin += VirtualBox.app
588VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
589VirtualBox.app_MODE = 644
590VirtualBox.app_SOURCES = \
591 src/darwin/PkgInfo \
592 $(PATH_TARGET)/Info.plist \
593 images/VirtualBox.icns=>Resources/virtualbox.icns
594
595$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
596 $(call MSG_GENERATE,VirtualBox.app,$<,$@)
597 $(QUIET)$(RM) -f $@
598 $(QUIET)$(SED) \
599 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
600 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
601 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
602 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
603 $< > $@
604
605INSTALLS.darwin += VirtualBoxVM.app
606VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
607VirtualBoxVM.app_MODE = 644
608VirtualBoxVM.app_SOURCES = \
609 src/darwin/VM-PkgInfo=>PkgInfo \
610 $(PATH_TARGET)/VM-Info.plist=>Info.plist \
611 images/VirtualBox.icns=>Resources/virtualbox.icns
612VirtualBoxVM.app_SYMLINKS = \
613 MacOS=>../../../MacOS/
614
615$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
616 $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
617 $(QUIET)$(RM) -f $@
618 $(QUIET)$(SED) \
619 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
620 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
621 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
622 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
623 --output $@ $<
624
625#
626# Translation installation
627#
628VirtualBox.nls_INST = $(INST_BIN)nls/
629VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
630VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
631VirtualBox.nls_MODE = 644
632
633
634#
635# Testcase for the darwin keyboard routines.
636#
637ifdef VBOX_WITH_TESTCASES
638PROGRAMS.darwin += tstDarwinKeyboard
639tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
640tstDarwinKeyboard_INCS = include
641tstDarwinKeyboard_SOURCES = \
642 src/darwin/tstDarwinKeyboard.cpp \
643 src/darwin/DarwinKeyboard.cpp
644tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
645tstDarwinKeyboard_LIBS = \
646 $(LIB_RUNTIME)
647endif
648
649
650
651# Commit the magic.
652# (note: before custom rules that make usage of generated variables!).
653include $(PATH_KBUILD)/footer.kmk
654
655
656
657#
658# Qt source file generation rules
659#
660
661## @todo move QT source generation macros to kBuild
662
663## Generate a rule to create a MOC source file from a header containing
664# classes that use the Q_OBJECT macro.
665# @param $mochdr header file with Q_OBJECT
666define def_qt_gen_src_moc
667
668$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
669
670$(target)_GENSRCS_REAL += $(mocsrc)
671
672$(mocsrc): $(mochdr)
673 $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
674 $$(QUIET)$$(MKDIR) -p $$(@D)
675 $$(QUIET)$$(VBOX_MOC4) \
676 $(addprefix -D,$($(target)_DEFS)) \
677 $(addprefix -I,$($(target)_INCS)) \
678 $(mochdr) -o $$@
679
680endef
681
682## Generate a rule to create a MOC include file from a source containing
683# local classes that use the Q_OBJECT macro. This include is then included
684# by that source, so it must be generated before the source gets compiled.
685# @param $mocsrc source file with Q_OBJECT
686define def_qt_gen_inc_moc
687
688$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
689$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
690
691$(target)_GENHDRS_REAL += $(mocinc)
692
693$(mocobj): $(mocinc)
694
695.NOTPARALLEL: $(mocinc)
696$(mocinc): $(mocsrc)
697 $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
698 $$(QUIET)$$(MKDIR) -p $$(@D)
699 $$(QUIET)$$(VBOX_MOC4) \
700 $(addprefix -D,$($(target)_DEFS)) \
701 $(addprefix -I,$($(target)_INCS)) \
702 -i $(mocsrc) -o $$@
703
704endef
705
706## Generate a rule to create a MOC include file from a UI header (ui.h) containing
707# local classes that use the Q_OBJECT macro. This include is then included
708# by that header, so it must be generated before the UI source gets compiled.
709# @param $mocuihdr UI header file with Q_OBJECT
710define def_qt_gen_inc_mocuihdr
711
712$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
713$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
714$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
715
716$(target)_GENHDRS_REAL += $(mocuiinc)
717
718.NOTPARALLEL: $(mocuiinc)
719$(uisrc): $(mocuiinc)
720$(mocuiinc): $(mocuihdr)
721 $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
722 $$(QUIET)$$(MKDIR) -p $$(@D)
723 $$(QUIET)$$(VBOX_MOC4) \
724 $(addprefix -D,$($(target)_DEFS)) \
725 $(addprefix -I,$($(target)_INCS)) \
726 -i $(mocuihdr) -o $$@
727
728endef
729
730## Generate a rule to create a header and source files from an UI
731# definition source (.ui).
732# @param $uifile UI definintion source file
733define def_qt_gen_src_ui
734
735$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
736$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
737$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
738
739$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
740$(target)_GENHDRS_REAL += $(uihdr)
741
742.NOTPARALLEL: $(uihdr)
743$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
744 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
745 $$(QUIET)$$(VBOX_UIC4) $(uifile) -o $$@
746
747$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
748 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
749 $$(QUIET)$$(VBOX_UIC4) -impl $(uihdr) $(uifile) -o $$@
750
751#$$(QUIET)$$(VBOX_UIC4) $(uifile) -i $(uihdr) -o $$@
752
753$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
754 $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
755 $$(QUIET)$$(VBOX_MOC4) \
756 $(addprefix -D,$($(target)_DEFS)) \
757 $(addprefix -I,$($(target)_INCS)) \
758 $(uihdr) -o $$@
759
760endef
761
762## Generate a rule to create a .qm file from a NLS translation
763# source (.ts).
764# @param $tsfile Translation source file
765define def_qt_gen_nls
766
767$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
768
769OTHER_CLEAN += $(qmfile)
770
771# Note that we use -nocompress in lrelease to avoid stripping comments and
772# other information from .qm files. If we don't do that, we get .qm files two
773# times smaller, but QTranslator::findMessage() will start searching for
774# translations in all existing contexts in case if it cannot find it in the
775# original context (which is of course not acceptable, no matter if it's a
776# special Qt "feature" or just a bug).
777
778$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
779 $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
780 $$(QUIET)$$(VBOX_LRELEASE4) -nocompress $(tsfile) -qm $$@
781
782endef
783
784## Generate rules for generating the Qt source for a target.
785# @param $target Target name.
786define def_qt_gen_src
787
788# moc srcs from hdrs with Q_OBJECT
789$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
790# moc includes from srcs with Q_OBJECT
791$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
792# moc includes from UI headers with Q_OBJECT
793$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
794# UI sources
795$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
796# NLS files
797$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
798$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
799# dirs
800$$(call DIRDEP,$(PATH_$(target))/ui/) \
801$$(call DIRDEP,$(PATH_$(target))/moc/) \
802$$(call DIRDEP,$(PATH_$(target))/nls/):
803 $$(call MSG_MKDIR,$$@)
804 $$(QUIET)$$(MKDIR) -p $$@
805
806endef
807
808# Generate Qt source rules.
809$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
810
811
812# Generate COM Wrappers
813.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
814
815$(WRAPPERSINCFILE): $(WRAPPERSFILE)
816
817$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
818 $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
819 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
820
821$(call DIRDEP,$(PATH_VirtualBox)/include/):
822 $(call MSG_MKDIR,$@)
823 $(QUIET)$(MKDIR) -p $@
824
825# this is actually necessary only for Win32 target with disabled dependencies
826define def_wrapper_deps
827$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
828endef
829
830$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
831
832# grep the images out of the resource file for dependency tracking
833VirtualBox_QT_IMAGES = $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox.qrc)
834
835$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: VirtualBox.qrc $(VirtualBox_QT_IMAGES)
836 $(call MSG_TOOL,rcc,VirtualBox,$<,$@)
837 $(QUIET)$(VBOX_RCC4) -o $@ $<
838
839VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
840
841#
842# Hand made dependencies go here.
843# Basically, here are dependencies for generated UI source files that
844# include generated headers in turn.
845#
846
847$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
848 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
849
850# Make all generated UI sources dependent on all generated headers (since they
851# may include them). This is safer than indifidual dependencies above but
852# currently disabled, because will cause all UI sources to be rebuilt one a
853# single one changes.
854#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
855
856
857#
858# Custom targets
859#
860
861# Update all known NLS translation (.ts) files in the nls/ subdirectory.
862# NOTE: This target is intened to be run only by the GUI maintainer shortly
863# before a new product release. VirtualBox_xx_YY.ts is a template for new
864# languages and should never be actually translated or installed.
865updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
866 $(call MSG_L1,lupdate all languages (nls/*.ts))
867 $(QUIET)$(VBOX_LUPDATE4) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
868
869
870#
871# Test targets
872#
873
874test:
875 @echo ====================
876 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
877 @echo --------------------
878 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
879 @echo ====================
880 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
881 @echo --------------------
882 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
883 @echo ====================
884
885test2:
886 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
887
888test3:
889 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
890
891testwrappers: $(WRAPPERSFILE)
892
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