VirtualBox

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

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

Need a prefix for standard qt4 installations.

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