Makefile.kmk revision 159bd7205b28fd1fee70f667507a597b6edd67aa
# $Id$
## @file
# Makefile for the VirtualBox Qt GUI.
#
#
# Copyright (C) 2006-2007 Sun Microsystems, Inc.
#
# This file is part of VirtualBox Open Source Edition (OSE), as
# available from http://www.virtualbox.org. This file is free software;
# you can redistribute it and/or modify it under the terms of the GNU
# General Public License (GPL) as published by the Free Software
# Foundation, in version 2 as it comes in the "COPYING" file of the
# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
#
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
# Clara, CA 95054 USA or visit http://www.sun.com if you need
# additional information or have any questions.
#
# include qmake project file
include VBoxUI.pro
# Import QDesigner UI sources
VirtualBox_QT_UISRCS3 := $(FORMS)
# Import translation sources
VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
# reset things to avoid possible conflicts with kBuild
TEMPLATE :=
LANGUAGE :=
FORMS :=
TRANSLATIONS :=
IMAGES :=
VBOX_WITH_REGISTRATION := 1
VBOX_WITH_REGISTRATION_REQUEST := 1
DEPTH = ../../../..
include $(KBUILD_PATH)/header.kmk
# Disable the debugger for now, this is another story.
VBOX_WITH_DEBUGGER_GUI :=
DEFS := $(filter-out VBOX_WITH_DEBUGGER_GUI,$(DEFS))
#
# Handmade configuration of qt4 - very annoying, this needs to
# be cleaned up properly later some time (not important now).
#
ifeq ($(VBOX_PATH_QT4),)
ifeq ($(KBUILD_TARGET),darwin)
VBOX_PATH_QT4 := $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
ifeq ($(VBOX_PATH_QT4),)
ifneq ($(wildcard /Library/Frameworks/QtCore.framework),)
# Using the global installation (for OSE).
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_FRAMEWORKS ?= /Library/Frameworks
endif
endif
else ifeq ($(KBUILD_TARGET),win)
VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*)))
endif
endif
ifeq ($(VBOX_PATH_QT4),)
if1of ($(USERNAME), bird)
# gentoo (64-bit)
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_BIN ?= /usr/bin
VBOX_PATH_QT4_INCLUDE ?= /usr/include/qt4
VBOX_PATH_QT4_LIB ?= /usr/lib/qt4
VBOX_PATH_QT4_LIB64 ?= /usr/lib/qt4
VBOX_PATH_QT4_SHARE ?= /usr/share/qt4
endif
endif
VBOX_PATH_QT4 ?= /usr
VBOX_PATH_QT4_BIN ?= $(VBOX_PATH_QT4)/bin
VBOX_PATH_QT4_INCLUDE ?= $(VBOX_PATH_QT4)/include
VBOX_PATH_QT4_LIB ?= $(VBOX_PATH_QT4)/lib
VBOX_PATH_QT4_LIB64 ?= $(VBOX_PATH_QT4)/lib64
VBOX_PATH_QT4_FRAMEWORKS ?= $(VBOX_PATH_QT4)/Frameworks
VBOX_PATH_QT4_SHARE ?= $(VBOX_PATH_QT4)
VBOX_MODULE_QT4 = QtCore QtGui QtNetwork
VBOX_DEFS_QT4 = QT_CORE_LIB QT_GUI_LIB QT_NETWORK_LIB
# @todo: remove later: this is necessary only as long as Qt3Support is necessary
# (it links to them)
VBOX_MODULE_QT4 += Qt3Support QtSql QtXml
VBOX_DEFS_QT4 += QT_QT3SUPPORT_LIB QT_SQL_LIB QT_XML_LIB
ifeq ($(KBUILD_TARGET),darwin)
# This is necessary because we didn't include the Qt header in framework
# notation (e.g.: <QtCore/QObject>)).
VBOX_INCS_QT4 = $(patsubst %, $(VBOX_PATH_QT4_FRAMEWORKS)/%.framework/Headers, $(VBOX_MODULE_QT4))
# No libs cause we are using frameworks
VBOX_PATH_QT4_LIB =
VBOX_LIBS_QT4 =
else
VBOX_INCS_QT4 = \
$(addprefix $(VBOX_PATH_QT4_INCLUDE)/, $(VBOX_MODULE_QT4) Qt) \
$(VBOX_PATH_QT4_INCLUDE)
ifeq ($(KBUILD_TARGET),win)
ifeq ($(KBUILD_TARGET_ARCH),amd64)
$(error Port me!)
else
VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc.net
endif
else ifeq ($(KBUILD_TARGET),linux)
VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/linux-g++
endif
# add the VBox prefix to Qt libs if they are built by us
ifeq ($(KBUILD_TARGET),win)
VBOX_LIBS_QT4 = $(patsubst %, VBox%4, $(VBOX_MODULE_QT4))
VBOX_QT4_RUNTIME = $(patsubst %, $(VBOX_PATH_QT4_LIB)/VBox%4.dll, $(VBOX_MODULE_QT4))
else ifdef VBOX_WITH_QT4_SUN
# Qt4 compiled by Sun with altered library names
VBOX_LIBS_QT4 = $(patsubst %, VBox%, $(VBOX_MODULE_QT4))
VBOX_QT4_RUNTIME = $(patsubst %, $(VBOX_PATH_QT4_LIB)/libVBox%.so.4, $(VBOX_MODULE_QT4))
else
VBOX_LIBS_QT4 = $(VBOX_MODULE_QT4)
VBOX_QT4_RUNTIME =
endif
ifeq ($(KBUILD_TARGET),win)
VBOX_LIBS_QT4 := $(addsuffix .lib, $(VBOX_LIBS_QT4)) VBoxqtmain.lib
endif
endif
# Warn about all what you know about porting qt3->qt4.
# Disable this if you like to see something on your screen.
VBOX_DEFS_QT4 += QT3_SUPPORT_WARNINGS
# Some default defs
VBOX_DEFS_QT4 += QT3_SUPPORT QT_SHARED HAVE_CONFIG_H QT_NO_DEBUG
VBOX_UIC3 ?= $(VBOX_PATH_QT4_BIN)/uic3
VBOX_UIC4 ?= $(VBOX_PATH_QT4_BIN)/uic
VBOX_MOC4 ?= $(VBOX_PATH_QT4_BIN)/moc
VBOX_RCC4 ?= $(VBOX_PATH_QT4_BIN)/rcc
VBOX_LUPDATE4 ?= $(VBOX_PATH_QT4_BIN)/lupdate
VBOX_LRELEASE4 ?= $(VBOX_PATH_QT4_BIN)/lrelease
# tell moc what platform we are on to let it properly define
# Q_OS_* and Q_WS_* macros when including qglobal.h
# (is there a better way?)
ifeq ($(KBUILD_TARGET),win)
ifeq ($(KBUILD_TARGET_ARCH),amd64)
VBOX_MOC4 += -DWIN64
else
VBOX_MOC4 += -DWIN32
endif
else ifeq ($(KBUILD_TARGET),linux)
# when nothing special is defined, Q_OS_UNIX/Q_WS_X11 will be set
else ifeq ($(KBUILD_TARGET),darwin)
VBOX_MOC4 += -D__APPLE__ -D__GNUC__
else
$(error Port me!)
endif
# All the following should be done in some root Makefile and removed from this
# one.
ifeq ($(KBUILD_TARGET),darwin)
# The following is necessary on Non OSE only. On the OSE version the Qt
# frameworks provided by Trolltech have to be installed on the target system
# in the system wide Frameworks directory (/Library/Frameworks).
ifndef VBOX_OSE
# Create the targets of the form
# @executable_path/../Frameworks/Qt???.framework/Versions/4/Qt???
QT_LIB_INSTALL=$(foreach mod, $(VBOX_MODULE_QT4), $(join $(join $(PATH_BIN)/../Frameworks/, $(mod)), .framework/Versions/4/$(mod)))
# The target for the libs. This is a special target cause is creates the
# necessary directory structure. @Bird: is there something for this in
# kBuild already? Todo: What about uninstall?
$(QT_LIB_INSTALL): $(PATH_BIN)/../Frameworks/%: $(VBOX_PATH_QT4_FRAMEWORKS)/%
$(call MSG_INST_FILE,$<,$@)
$(QUIET)$(MKDIR) -p $(@D)
$(QUIET)$(INSTALL) -m 0644 $< $(@D)
# Add the lib targets to the OTHER dependencies.
OTHERS = $(QT_LIB_INSTALL)
endif
else
# The Qt DLLs (move to the root Makefile.kmk, and remove bin from INSTALLS below).
bin_SOURCES += $(VBOX_QT4_RUNTIME)
bin_INST = $(INST_BIN)
bin_MODE = 644
endif
# Template copy from the qt3 stuff. Appended a "4" on the
# relevant places.
#
# Template for building Qt GUI executables.
#
TEMPLATE_VBOXQT4GUIEXE = VBox Qt4 GUI Executable
TEMPLATE_VBOXQT4GUIEXE_DEFS = IN_RING3 QT_NO_DEBUG QT_THREAD_SUPPORT $(ARCH_BITS_DEFS) $(VBOX_DEFS_QT4)
TEMPLATE_VBOXQT4GUIEXE_INCS = \
$(VBOX_PATH_SDK)/include \
$(VBOX_INCS_QT4)
ifeq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_VCC_TOOL)
TEMPLATE_VBOXQT4GUIEXE_DEFS += \
_WIN32_WINNT=0x0500 UNICODE _UNICODE \
QT_DLL _CRT_SECURE_NO_DEPRECATE \
$(QMAKE_PRL_DEFINES)
## @todo VCC70 flags?
ifdef VBOX_USE_VCC80
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
-nologo -Zm200 -W3 -MD -Zi -EHsc -Zc:wchar_t-
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -RTCsu
else
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
-nologo -Zm200 -W3 -MD -Zi -GX
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.debug = -GZ
endif
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_INC)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS = \
/NOD /NOLOGO /INCREMENTAL:NO /MAPINFO:EXPORTS /DEBUG \
/DELAYLOAD:oleaut32.dll
TEMPLATE_VBOXQT4GUIEXE_SDKS = WINPSDK
TEMPLATE_VBOXQT4GUIEXE_LIBS = \
$(VBOX_LIBS_QT4) \
$(LIB_RUNTIME) \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcprt.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/msvcrt.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/oldnames.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_LIB)/delayimp.lib \
$(PATH_TOOL_$(VBOX_VCC_TOOL)_ATLMFC_LIB)/atls.lib
TEMPLATE_VBOXQT4GUIEXE_LIBPATH = $(VBOX_PATH_QT4_LIB)
TEMPLATE_VBOXQT4GUIEXE_POST_CMDS = $(VBOX_SIGN_IMAGE_CMDS)
else # the gcc guys:
TEMPLATE_VBOXQT4GUIEXE_TOOL = $(VBOX_GCC_TOOL)
TEMPLATE_VBOXQT4GUIEXE_DEFS.linux = _REENTRANT
TEMPLATE_VBOXQT4GUIEXE_DEFS.solaris = _REENTRANT
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(LIB_SDL_INC)
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS = \
-pipe -Wall -W -frtti -fno-exceptions -Wno-non-virtual-dtor \
-Wno-long-long -fshort-wchar -fno-strict-aliasing \
$(VBOX_GCC_fvisibility-hidden) $(VBOX_GCC_fvisibility-inlines-hidden)
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.x86 = -m32
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.amd64 = -m64
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS.linux = -pthread
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.x86 = -m32
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS.amd64 = -m64
TEMPLATE_VBOXQT4GUIEXE_LIBS = \
$(VBOX_LIBS_QT4) \
$(LIB_SDL) \
$(LIB_RUNTIME) \
$(LIB_REM) \
$(LIB_VMM)
ifeq ($(KBUILD_TARGET_ARCH),amd64)
TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
$(VBOX_PATH_QT4_LIB64) $(VBOX_PATH_QT4_LIB)
else
TEMPLATE_VBOXQT4GUIEXE_LIBPATH = \
$(VBOX_PATH_QT4_LIB)
endif
ifeq ($(KBUILD_TARGET),linux)
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += $(VBOX_LD_as_needed)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(VBOX_XCURSOR_LIBS)
TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
$(VBOX_LIBPATH_X11)
else ifeq ($(KBUILD_TARGET),darwin)
# We have to add the framework path to both the linker and the compiler also.
# Note that the -F flag is apple gcc only.
TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -F$(VBOX_PATH_QT4_FRAMEWORKS) $(addprefix -framework , $(VBOX_MODULE_QT4)) \
-framework Carbon -framework QuickTime -bind_at_load
TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS += -F$(VBOX_PATH_QT4_FRAMEWORKS)
TEMPLATE_VBOXQT4GUIEXE_LIBS +=
TEMPLATE_VBOXQT4GUIEXE_LIBPATH +=
else
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(VBOX_XCURSOR_INCS)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(VBOX_XCURSOR_LIBS) \
Xext \
X11 \
m \
$(LIB_PTHREAD)
TEMPLATE_VBOXQT4GUIEXE_LIBPATH += \
$(VBOX_LIBPATH_X11)
ifeq ($(KBUILD_TARGET),freebsd)
TEMPLATE_VBOXQT4GUIEXE_INCS += \
/usr/include \
/usr/X11R6/include \
/usr/local/include
endif
endif
endif
# Add COM/XPCOM stuff
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(PATH_LIB)/VBoxCOM$(VBOX_SUFF_LIB)
ifdef VBOX_WITH_XPCOM
## @todo may be worth creating the VBOX_XPCOM SDK def
TEMPLATE_VBOXQT4GUIEXE_DEFS += VBOX_WITH_XPCOM
TEMPLATE_VBOXQT4GUIEXE_INCS += \
$(VBOX_XPCOM_INCS)
TEMPLATE_VBOXQT4GUIEXE_LIBS += \
$(LIB_XPCOM)
endif
#
# Template for building Qt GUI components.
#
TEMPLATE_VBOXQT4GUI = VBox Qt GUI Components
TEMPLATE_VBOXQT4GUI_EXTENDS = VBOXQTGUIEXE
TEMPLATE_VBOXQT4GUI_LIBS = $(filter-out $(QTMAIN),$(TEMPLATE_VBOXQT4GUIEXE_LIBS))
ifeq ($(KBUILD_TARGET),darwin)
TEMPLATE_VBOXQT4GUI_LDFLAGS = $(filter-out -framework Carbon -framework QuickTime -bind_at_load,$(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS))
endif
ifeq ($(filter-out solaris.x86 %.amd64,$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)),)
ifneq ($(KBUILD_TARGET),win)
TEMPLATE_VBOXQT4GUI_DEFS = PIC $(TEMPLATE_VBOXQT4GUIEXE_DEFS)
TEMPLATE_VBOXQT4GUI_CFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CFLAGS)
TEMPLATE_VBOXQT4GUI_CXXFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS)
TEMPLATE_VBOXQT4GUI_LDFLAGS = -fPIC $(TEMPLATE_VBOXQT4GUIEXE_LDFLAGS)
endif
endif
#
# exclude inappropriate UI content
#
ifndef VBOX_WITH_REGISTRATION
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS3))
endif
#
# filter ported UI content
#
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxCloseVMDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxCloseVMDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxNewVMWzd.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxNewVMWzd.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxNewHDWzd.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxNewHDWzd.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMFirstRunWzd.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMFirstRunWzd.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxRegistrationDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxSnapshotDetailsDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxSnapshotDetailsDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMInformationDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMInformationDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxTakeSnapshotDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxTakeSnapshotDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxSnapshotsWgt.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxSnapshotsWgt.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMLogViewer.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMLogViewer.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxDiskImageManagerDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxDiskImageManagerDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsGeneral.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsGeneral.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsHD.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsHD.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsCD.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsCD.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsFD.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsFD.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsAudio.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsAudio.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsNetwork.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsNetwork.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsSerial.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsSerial.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsParallel.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsParallel.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsUSB.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsUSB.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsSF.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsSF.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsVRDP.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsVRDP.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxVMSettingsDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxVMSettingsDlg.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsGeneral.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsGeneral.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsInput.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsInput.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsLanguage.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsLanguage.ui
VirtualBox_QT_UISRCS3 := $(filter-out ui/VBoxGlobalSettingsDlg.ui,$(VirtualBox_QT_UISRCS3))
VirtualBox_QT_UISRCS4 += ui/VBoxGlobalSettingsDlg.ui
#
# The targets.
#
PROGRAMS = VirtualBox
ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(KBUILD_TARGET)),) # X11
DLLS = VBoxKeyboard4
OTHERS = $(PATH_BIN)/vboxkeyboard4.tar.gz
endif
INSTALLS = VirtualBox.nls bin
ifeq ($(KBUILD_TARGET),os2)
DLLS += VBoxHlp
ifneq ($(strip $(VBOX_DLL_QT)),)
INSTALLS += qt.dll
qt.dll_INST = $(INST_BIN)
qt.dll_SOURCES += \
$(VBOX_DLL_QT)=>$(not-dir $(VBOX_DLL_QT))
endif
endif
#
# VBoxHlp - helper DLL for OS/2.
#
VBoxHlp_ASTOOL = NASM
VBoxHlp_ASFLAGS = -f obj
VBoxHlp_DEFS = IN_RING3 IN_VBOXHLP
VBoxHlp_CXXFLAGS = -fno-exceptions
VBoxHlp_LDFLAGS = -nostdlib -los2
VBoxHlp_LDFLAGS += -Zlinker option -Zlinker manyautodata
VBoxHlp_SOURCES = \
src/os2/VBoxHlp.asm \
src/os2/VBoxHlp.cpp
#
# VBoxKeyboard - keyboard library for X11.
#
VBoxKeyboard4_TEMPLATE = VBOXR3
VBoxKeyboard4_SOURCES = \
src/linux/keyboard-new.c
VBoxKeyboard4_TARSOURCES = \
$(VBoxKeyboard4_SOURCES) \
src/linux/COPYING.LIB \
src/linux/keyboard.h \
src/linux/keyboard-layouts.h \
src/linux/keyboard-list.h \
src/linux/keyboard-tables.h \
src/linux/Makefile
VBoxKeyboard4_LIBS = X11
VBoxKeyboard4_LIBPATH = $(VBOX_LIBPATH_X11)
#
# vboxkeyboard.tar.gz - the LGPLed keyboard library must always be
# redistributed with usable sources.
#
SOURCE_DIRECTORY = vboxkeyboard4
DIRECTORY_PREFIX = src/linux/
$(PATH_TARGET)/$(SOURCE_DIRECTORY):
$(MKDIR) -p $(@D)
$(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
$(PATH_BIN)/vboxkeyboard4.tar.gz: $(VBoxKeyboard4_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY)
$(call MSG_TOOL,tar/gzip,,$@)
$(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard4_TARSOURCES))) | gzip - > $@
#
# VirtualBox - The GUI program.
#
VirtualBox_TEMPLATE = VBOXQT4GUIEXE
VirtualBox_NAME = VirtualBox4
VirtualBox_SDKS.win = WINPSDK DXSDK
#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(KBUILD_TARGET)),) - later
ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(KBUILD_TARGET)),) # X11 + os2
VirtualBox_SDKS += LIBSDL
endif
ifeq ($(KBUILD_TARGET),darwin)
# For the launch trick we need different inode numbers.
VirtualBox_INST = $(INST_BIN)VirtualBox4 $(INST_BIN)VirtualBoxVM4
# For testing iChat Theater stuff change
# the sdk path
ifdef VBOX_WITH_ICHAT_THEATER
VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk
endif
endif
ifndef VBOX_OSE
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # linux only, yea, right.
# Note: I'm doing this right here because the GUI will _not_ run
# without that file which might be annoying for developers!
$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
$(call MSG_GENERATE,,$@)
$(QUIET)$(CP) $< $@
$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
endif
endif
# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
VirtualBox_QT_TRANSLATIONS_QT := \
$(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
$(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
# Headers containing definitions of classes that use the Q_OBJECT macro
VirtualBox_QT_MOCHDRS = \
include/QIWidgetValidator.h \
include/QIHotKeyEdit.h \
include/QIStatusBar.h \
include/QIStateIndicator.h \
include/QIMessageBox.h \
include/QILabel.h \
include/QILabel_p.h \
include/QIAbstractWizard.h \
include/QIListView.h \
include/QITreeWidget.h \
include/QIMainDialog.h \
include/QIHelpButton.h \
include/VBoxGlobalSettings.h \
include/VBoxUtils.h \
include/VBoxGlobal.h \
include/VBoxVMListView.h \
include/VBoxMediaComboBox.h \
include/VBoxSelectorWnd.h \
include/VBoxConsoleWnd.h \
include/VBoxConsoleView.h \
include/VBoxProblemReporter.h \
include/VBoxDownloaderWgt.h \
include/VBoxNetworkFramework.h \
include/VBoxAboutDlg.h \
include/VBoxCloseVMDlg.h \
include/VBoxNewVMWzd.h \
include/VBoxNewHDWzd.h \
include/VBoxVMFirstRunWzd.h \
include/VBoxRegistrationDlg.h \
include/VBoxSnapshotDetailsDlg.h \
include/VBoxVMInformationDlg.h \
include/VBoxTakeSnapshotDlg.h \
include/VBoxSnapshotsWgt.h \
include/VBoxVMLogViewer.h \
include/VBoxDiskImageManagerDlg.h \
include/VBoxVMSettingsUtils.h \
include/VBoxVMSettingsGeneral.h \
include/VBoxVMSettingsHD.h \
include/VBoxVMSettingsCD.h \
include/VBoxVMSettingsFD.h \
include/VBoxVMSettingsAudio.h \
include/VBoxVMSettingsNetwork.h \
include/VBoxVMSettingsSerial.h \
include/VBoxVMSettingsParallel.h \
include/VBoxVMSettingsUSB.h \
include/VBoxVMSettingsSF.h \
include/VBoxVMSettingsVRDP.h \
include/VBoxVMSettingsDlg.h \
include/VBoxGlobalSettingsGeneral.h \
include/VBoxGlobalSettingsInput.h \
include/VBoxGlobalSettingsLanguage.h \
include/VBoxGlobalSettingsDlg.h
# Sources containing local definitions of classes that use the Q_OBJECT macro
VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
ifdef VBOX_WITH_XPCOM
VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
endif
# All generated sources. Note: this list MUST be in sync with Qt source
# generation rules defined somewhere below!
VirtualBox_GENSRCS = \
$(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
$(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS3))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp)
# All generated headers. Note: this list MUST be in sync with Qt source
# generation rules defined somewhere below!
VirtualBox_GENHDRS = \
$(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
$(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS3))), $(PATH_VirtualBox)/ui/$(ui).h) \
$(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS4))), $(PATH_VirtualBox)/ui/$(ui).gen.h)
# All existing .ui.h files for known .ui sources
VirtualBox_QT_UIHDRS = \
$(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS3)))
# All header files
VirtualBox_HEADERS = \
$(wildcard include/*.h) \
$(VirtualBox_GENHDRS) \
$(VirtualBox_QT_UIHDRS)
VirtualBox_SOURCES = \
$(VirtualBox_GENSRCS) \
src/main.cpp \
src/COMDefs.cpp \
src/QIWidgetValidator.cpp \
src/QIHotKeyEdit.cpp \
src/QIStateIndicator.cpp \
src/QIStatusBar.cpp \
src/QIMessageBox.cpp \
src/QILabel.cpp \
src/QIAbstractWizard.cpp \
src/QIDialog.cpp \
src/QIDialogButtonBox.cpp \
src/QIListView.cpp \
src/QITreeWidget.cpp \
src/QIMainDialog.cpp \
src/QILineEdit.cpp \
src/QIHelpButton.cpp \
src/VBoxDefs.cpp \
src/VBoxGlobalSettings.cpp \
src/VBoxGlobal.cpp \
src/VBoxMediaComboBox.cpp \
src/VBoxProblemReporter.cpp \
src/VBoxSelectorWnd.cpp \
src/VBoxConsoleView.cpp \
src/VBoxConsoleWnd.cpp \
src/VBoxDownloaderWgt.cpp \
src/VBoxVMListView.cpp \
src/VBoxFrameBuffer.cpp \
src/HappyHttp.cpp \
src/VBoxNetworkFramework.cpp \
src/VBoxAboutDlg.cpp \
src/VBoxCloseVMDlg.cpp \
src/VBoxNewVMWzd.cpp \
src/VBoxNewHDWzd.cpp \
src/VBoxVMFirstRunWzd.cpp \
src/VBoxRegistrationDlg.cpp \
src/VBoxSnapshotDetailsDlg.cpp \
src/VBoxVMInformationDlg.cpp \
src/VBoxTakeSnapshotDlg.cpp \
src/VBoxSnapshotsWgt.cpp \
src/VBoxVMLogViewer.cpp \
src/VBoxDiskImageManagerDlg.cpp \
src/VBoxVMSettingsGeneral.cpp \
src/VBoxVMSettingsHD.cpp \
src/VBoxVMSettingsCD.cpp \
src/VBoxVMSettingsFD.cpp \
src/VBoxVMSettingsAudio.cpp \
src/VBoxVMSettingsNetwork.cpp \
src/VBoxVMSettingsSerial.cpp \
src/VBoxVMSettingsParallel.cpp \
src/VBoxVMSettingsUSB.cpp \
src/VBoxVMSettingsSF.cpp \
src/VBoxVMSettingsVRDP.cpp \
src/VBoxVMSettingsDlg.cpp \
src/VBoxGlobalSettingsGeneral.cpp \
src/VBoxGlobalSettingsInput.cpp \
src/VBoxGlobalSettingsLanguage.cpp \
src/VBoxGlobalSettingsDlg.cpp
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
ifndef VBOX_OSE
VirtualBox_QT_MOCHDRS += \
include/VBoxLicenseViewer.h
VirtualBox_SOURCES += \
src/VBoxLicenseViewer.cpp
endif
VirtualBox_SOURCES += \
src/linux/XKeyboard-new.cpp
endif
VirtualBox_SOURCES.win += \
src/VBoxFBDDRAW.cpp \
$(PATH_TARGET)/VirtualBox4.rc
VirtualBox_SOURCES.darwin = \
src/darwin/DarwinKeyboard.cpp \
src/darwin/DarwinCursor.cpp \
src/darwin/VBoxUtils-darwin.cpp \
src/VBoxFBQuartz2D.cpp
# src/darwin/VBoxAquaStyle.cpp \
ifdef VBOX_WITH_ICHAT_THEATER
VirtualBox_SOURCES.darwin += \
src/darwin/VBoxIChatTheaterWrapper.m
endif
ifneq ($(KBUILD_TARGET),win)
src/HappyHttp.cpp_CXXFLAGS += -fexceptions
src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
endif
src/HappyHttp.cpp_CXXFLAGS.linux += -O2
## @todo how to detect what tool is used?
## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
# more generic -Wno-extra
ifdef VBOX_WITH_XPCOM
src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
endif
VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
#ifndef VBOX_OSE
VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
#endif
ifdef VBOX_WITH_ICHAT_THEATER
VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
endif
ifneq ($(KBUILD_TYPE),release)
# non-release builds has some extra features.
VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
endif
ifdef VBOX_WITH_REGISTRATION
VirtualBox_DEFS += VBOX_WITH_REGISTRATION
endif
ifdef VBOX_WITH_REGISTRATION_REQUEST
VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
endif
ifdef VBOX_WITH_ALSA
VirtualBox_DEFS += VBOX_WITH_ALSA
endif
ifdef VBOX_WITH_PULSE
VirtualBox_DEFS += VBOX_WITH_PULSE
endif
ifdef VBOX_WITH_E1000
VirtualBox_DEFS += VBOX_WITH_E1000
endif
ifdef VBOX_OSE
VirtualBox_DEFS += VBOX_OSE
endif
ifdef VBOX_WITH_DEBUGGER_GUI
VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
endif
VirtualBox_INCS = \
./include \
$(PATH_VirtualBox)/ui \
$(PATH_VirtualBox)/moc \
$(PATH_VirtualBox)/include \
ifeq ($(KBUILD_TYPE),release)
VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
else
VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
ifeq ($(USERNAME),dmik)
VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
else
VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
endif
endif
VirtualBox_LDFLAGS.os2 = -Zlinker /PM:PM -Zno-fork
VirtualBox_LDFLAGS.darwin = -framework IOKit -framework AppKit -framework ApplicationServices -framework Foundation -lz
ifdef VBOX_WITH_ICHAT_THEATER
VirtualBox_LDFLAGS.darwin += -framework InstantMessage -framework QuartzCore
endif
VirtualBox_LIBS.win = \
$(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
$(PATH_SDK_DXSDK_LIB)/ddraw.lib \
$(PATH_SDK_DXSDK_LIB)/dxguid.lib
VirtualBox_LIBS.os2 += $(PATH_DLL)/VBoxHlp$(VBOX_SUFF_DLL)
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11
VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard4$(VBOX_SUFF_DLL)
endif
ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
ifeq ($(KBUILD_TARGET),win)
VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
else
VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
endif
endif
WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
WRAPPERSINCFILE = include/COMDefs.h
WRAPPERSTEMPLATE = include/COMWrappers.xsl
XIDLFILE = ../../Main/idl/VirtualBox.xidl
VirtualBox_INTERMEDIATES = $(WRAPPERSFILE)
# generated files we need to clean manually
OTHER_CLEAN = \
$(VirtualBox_GENSRCS) \
$(VirtualBox_GENHDRS) \
$(WRAPPERSFILE) \
$(PATH_BIN)/vboxkeyboard.tar.gz
#
# On Windows we'll have to generate/edit the resource file.
# The IDI_ICON1 name is Qt specific.
#
$(PATH_TARGET)/VirtualBox4.rc: Makefile.kmk $(VBOX_WINDOWS_ICON_FILE) | $$(call DIRDEP,$$(@D))
$(RM) -f $@
$(APPEND) $@ 'IDI_ICON1 ICON "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"'
$(CAT) $@
OTHER_CLEAN.win += $(PATH_TARGET)/VirtualBox4.rc
#
# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
#
INSTALLS.darwin += VirtualBox.app
VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
VirtualBox.app_MODE = 644
VirtualBox.app_SOURCES = \
src/darwin/PkgInfo \
$(PATH_TARGET)/Info.plist \
$(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
$(call MSG_GENERATE,VirtualBox.app,$<,$@)
$(QUIET)$(RM) -f $@
$(QUIET)$(SED) \
-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
$< > $@
INSTALLS.darwin += VirtualBoxVM.app
VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
VirtualBoxVM.app_MODE = 644
VirtualBoxVM.app_SOURCES = \
src/darwin/VM-PkgInfo=>PkgInfo \
$(PATH_TARGET)/VM-Info.plist=>Info.plist \
$(VBOX_MACOSX_ICON_FILE)=>Resources/virtualbox.icns
VirtualBoxVM.app_SYMLINKS = \
MacOS=>../../../MacOS/
$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
$(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
$(QUIET)$(RM) -f $@
$(QUIET)$(SED) \
-e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
-e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
-e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
-e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
--output $@ $<
#
# Translation installation
#
VirtualBox.nls_INST = $(INST_BIN)nls4/
VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
VirtualBox.nls_MODE = 644
#
# Testcase for the darwin keyboard routines.
#
ifdef VBOX_WITH_TESTCASES
PROGRAMS.darwin += tstDarwinKeyboard4
tstDarwinKeyboard4_TEMPLATE = VBOXR3TSTEXE
tstDarwinKeyboard4_INCS = include
tstDarwinKeyboard4_SOURCES = \
src/darwin/tstDarwinKeyboard.cpp \
src/darwin/DarwinKeyboard.cpp
tstDarwinKeyboard4_LDFLAGS = -framework IOKit -framework Carbon
tstDarwinKeyboard4_LIBS = \
$(LIB_RUNTIME)
endif
# grep the images out of the resource file for dependency tracking
VirtualBox_QT_RC += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox.qrc)
VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application.cpp
# We have different about dialogs in OSE and PUEL. Therefor two independent
# resource files exists.
ifdef VBOX_OSE
VirtualBox_QT_RC_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_OSE.qrc)
VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_ose.cpp
else
VirtualBox_QT_RC_NON_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_NonOSE.qrc)
VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp
VirtualBox_SOURCES += src/VBoxAboutNonOSEDlg.cpp
VirtualBox_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h
endif
# OSE version is always necessary for lupdate/lrelease
VirtualBox_QT_UISRCS4 += ui/VBoxAboutDlg.ui
# Commit the magic.
# (note: before custom rules that make usage of generated variables!).
include $(KBUILD_PATH)/footer.kmk
#
# Qt source file generation rules
#
## @todo move QT source generation macros to kBuild
## Generate a rule to create a MOC source file from a header containing
# classes that use the Q_OBJECT macro.
# @param $mochdr header file with Q_OBJECT
define def_qt_gen_src_moc
$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
$(target)_GENSRCS_REAL += $(mocsrc)
## @todo The source should be added to GEN_SOURCES: $ (target)_GEN_SOURCES += $ (mocsrc)
$(mocsrc): $(mochdr)
$$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC4) \
$(addprefix -D,$($(target)_DEFS)) \
$(addprefix -I,$($(target)_INCS)) \
$(mochdr) -o $$@
endef
## Generate a rule to create a MOC include file from a source containing
# local classes that use the Q_OBJECT macro. This include is then included
# by that source, so it must be generated before the source gets compiled.
# @param $mocsrc source file with Q_OBJECT
define def_qt_gen_inc_moc
$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
$(target)_GENHDRS_REAL += $(mocinc)
$(target)_INTERMEDIATES += $(mocinc)
$(mocobj): $(mocinc)
$(mocinc): $(mocsrc)
$$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC4) \
$(addprefix -D,$($(target)_DEFS)) \
$(addprefix -I,$($(target)_INCS)) \
-i $(mocsrc) -o $$@
endef
## Generate a rule to create a MOC include file from a UI header (ui.h) containing
# local classes that use the Q_OBJECT macro. This include is then included
# by that header, so it must be generated before the UI source gets compiled.
# @param $mocuihdr UI header file with Q_OBJECT
define def_qt_gen_inc_mocuihdr
$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
$(target)_GENHDRS_REAL += $(mocuiinc)
$(target)_INTERMEDIATES += $(mocuiinc)
$(uisrc): $(mocuiinc)
$(mocuiinc): $(mocuihdr)
$$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC4) \
$(addprefix -D,$($(target)_DEFS)) \
$(addprefix -I,$($(target)_INCS)) \
-i $(mocuihdr) -o $$@
endef
## Generate a rule to create a header and source files from an UI3
# definition source (.ui).
# @param $uifile UI definintion source file
define def_qt_gen_src_ui3
$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
$(target)_GENHDRS_REAL += $(uihdr)
$(target)_INTERMEDIATES += $(uihdr)
## @todo The source should be added to GEN_SOURCES: $ (target)_GEN_SOURCES += $ (uisrc) $ (mocsrc)
$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
$$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
$$(QUIET)$$(VBOX_UIC3) $(uifile) -o $$@
$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
$$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
$$(QUIET)$$(VBOX_UIC3) -impl $(uihdr) $(uifile) -o $$@
#$$(QUIET)$$(VBOX_UIC3) $(uifile) -i $(uihdr) -o $$@
$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
$$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
$$(QUIET)$$(VBOX_MOC4) \
$(addprefix -D,$($(target)_DEFS)) \
$(addprefix -I,$($(target)_INCS)) \
$(uihdr) -o $$@
endef
## Generate a rule to create a header file from an UI4
# definition source (.ui).
# @param $uifile UI definintion source file
define def_qt_gen_src_ui4
$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).gen.h)
$(target)_GENHDRS_REAL += $(uihdr)
$(target)_INTERMEDIATES += $(uihdr)
$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
$$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
$$(QUIET)$$(VBOX_UIC4) $(uifile) -o $$@
# we assume that the generated header is at least included by
# the normal header with the same name
include/$(notdir $(basename $(uifile))).h: $(uihdr)
endef
## Generate a rule to create a .qm file from a NLS translation
# source (.ts).
# @param $tsfile Translation source file
define def_qt_gen_nls
$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
OTHER_CLEAN += $(qmfile)
# Note that we use -nocompress in lrelease to avoid stripping comments and
# other information from .qm files. If we don't do that, we get .qm files two
# times smaller, but QTranslator::findMessage() will start searching for
# translations in all existing contexts in case if it cannot find it in the
# original context (which is of course not acceptable, no matter if it's a
# special Qt "feature" or just a bug).
$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
$$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
$$(QUIET)$$(VBOX_LRELEASE4) -nocompress -silent $(tsfile) -qm $$@
endef
## Generate rules for generating the Qt source for a target.
# @param $target Target name.
define def_qt_gen_src
# moc srcs from hdrs with Q_OBJECT
$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
# moc includes from srcs with Q_OBJECT
$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
# moc includes from UI headers with Q_OBJECT
$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
# UI3 sources
$(foreach uifile,$($(target)_QT_UISRCS3),$(eval $(def_qt_gen_src_ui3)))
# UI4 sources
$(foreach uifile,$($(target)_QT_UISRCS4),$(eval $(def_qt_gen_src_ui4)))
# NLS files
$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
# dirs
$$(call DIRDEP,$(PATH_$(target))/ui/) \
$$(call DIRDEP,$(PATH_$(target))/moc/) \
$$(call DIRDEP,$(PATH_$(target))/nls/):
$$(call MSG_MKDIR,$$@)
$$(QUIET)$$(MKDIR) -p $$@
endef
# Generate Qt source rules.
$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
# Generate COM Wrappers
$(WRAPPERSINCFILE): $(WRAPPERSFILE)
$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
$(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
$(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
$(call DIRDEP,$(PATH_VirtualBox)/include/):
$(call MSG_MKDIR,$@)
$(QUIET)$(MKDIR) -p $@
# rules for resources file creation
$(PATH_VirtualBox)/ui/qrc_application.cpp: VirtualBox.qrc $(VirtualBox_QT_RC)
$(call MSG_TOOL,rcc,VirtualBox,$<,$@)
$(QUIET)$(VBOX_RCC4) -o $@ $<
$(PATH_VirtualBox)/ui/qrc_application_ose.cpp: VirtualBox_OSE.qrc $(VirtualBox_QT_RC_OSE)
$(call MSG_TOOL,rcc,VirtualBox,$<,$@)
$(QUIET)$(VBOX_RCC4) -name "OSE" -o $@ $<
$(PATH_VirtualBox)/ui/qrc_application_non_ose.cpp: VirtualBox_NonOSE.qrc $(VirtualBox_QT_RC_NON_OSE)
$(call MSG_TOOL,rcc,VirtualBox,$<,$@)
$(QUIET)$(VBOX_RCC4) -name "NonOSE" -o $@ $<
#
# Hand made dependencies go here.
# Basically, here are dependencies for generated UI source files that
# include generated headers in turn.
#
# Make all generated UI sources dependent on all generated headers (since they
# may include them). This is safer than indifidual dependencies above but
# currently disabled, because will cause all UI sources to be rebuilt one a
# single one changes.
#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS3)))) : $(VirtualBox_GENHDRS)
#
# Custom targets
#
# Update all known NLS translation (.ts) files in the nls/ subdirectory.
# NOTE: This target is intened to be run only by the GUI maintainer shortly
# before a new product release. VirtualBox_xx_YY.ts is a template for new
# languages and should never be actually translated or installed.
updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
$(call MSG_L1,lupdate all languages (nls/*.ts))
$(QUIET)$(VBOX_LUPDATE4) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
#
# Test targets
#
test:
@echo ====================
@echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
@echo --------------------
@echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
@echo ====================
@echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
@echo --------------------
@echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
@echo ====================
test2:
@echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
test3:
@echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
testwrappers: $(WRAPPERSFILE)