VirtualBox

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

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

FE/Qt4: Made it possible to build VirtualBox4 on a system where Qt3 is the default alternative.

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