VirtualBox

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

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

Mac OS X: Build on the mac as from now.

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