# $Id: Makefile.kmk 10583 2008-07-14 01:20:36Z vboxsync $ ## @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. # DEPTH = ../../../.. include $(KBUILD_PATH)/header.kmk # # Globals. # VBOX_VIRTUALBOX4_SRC := $(PATH_SUB_CURRENT) if1of ($(KBUILD_TARGET), darwin win) USE_KBUILD_QT_UNIT := 1 # Testing before enabling it. endif VBOX_WITH_REGISTRATION := 1 # Ask the user to register at Sun. If this setting is disabled the user can # still register using the menu if desired. VBOX_WITH_REGISTRATION_REQUEST := 1 # Show the update notifier dialog during startup. If this setting is disabled # the user can still register using the menu if desired. VBOX_WITH_UPDATE_REQUEST := 1 # Disable the debugger for now, this is another story. VBOX_WITH_DEBUGGER_GUI := DEFS := $(filter-out VBOX_WITH_DEBUGGER_GUI,$(DEFS)) # Guess VBOX_WITH_QT4_SUN ifndef VBOX_WITH_QT4_SUN ifndef VBOX_OSE if1of ($(KBUILD_TARGET), darwin solaris win) VBOX_WITH_QT4_SUN := 1 endif endif endif # # 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 if1of ($(KBUILD_TARGET),win) VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*))) else if1of ($(KBUILD_TARGET),solaris) VBOX_PATH_QT4 ?= $(lastword $(sort $(wildcard $(PATH_DEVTOOLS_TRG)/qt/v4*))) ifneq ($(VBOX_PATH_QT4),) VBOX_WITH_QT4_SUN = 1 endif 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) ifndef USE_KBUILD_QT_UNIT_PART_2 VBOX_MODULE_QT4 = QtCore QtGui VBOX_DEFS_QT4 = QT_CORE_LIB QT_GUI_LIB endif # !USE_KBUILD_QT_UNIT_PART_2 ifeq ($(KBUILD_TARGET),darwin) ifndef USE_KBUILD_QT_UNIT_PART_2 # This is necessary because we didn't include the Qt header in framework # notation (e.g.: )). 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 = endif # !USE_KBUILD_QT_UNIT_PART_2 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) ## @todo This is the correct one here: VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc2005 VBOX_INCS_QT4 += $(VBOX_PATH_QT4_SHARE)/mkspecs/win32-msvc.net 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)) # Export the ld library path export LD_LIBRARY_PATH := $(VBOX_PATH_QT4_LIB):$(LD_LIBRARY_PATH) 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 # Some default defs VBOX_DEFS_QT4 += QT_SHARED HAVE_CONFIG_H QT_NO_DEBUG 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),darwin) VBOX_MOC4 += -D__APPLE__ -D__GNUC__ else ifeq ($(KBUILD_TARGET),solaris) VBOX_MOC4 += -D__sun else ifeq ($(KBUILD_TARGET),linux) # when nothing special is defined, Q_OS_UNIX/Q_WS_X11 will be set 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? ## @todo bird: a qt4-framework install target with a source list like this: # QtCore.framework/Versions/4/QtCore=>QtCore.framework/Versions/4/QtCore \ # QtGui.framework/Versions/4/QtGui=>QtGui.framework/Versions/4/QtGui $(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 ## @todo move to the root Makefile.kmk, and remove qt4-bin from INSTALLS below. qt4-bin_SOURCES += $(VBOX_QT4_RUNTIME) qt4-bin_INST = $(INST_BIN) qt4-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 ifdef USE_KBUILD_QT_UNIT USES += qt4 TEMPLATE_VBOXQT4GUIEXE_USES = qt4 TEMPLATE_VBOXQT4GUIEXE_QTTOOL = QT4 TEMPLATE_VBOXQT4GUIEXE_MOCTOOL = QT4 TEMPLATE_VBOXQT4GUIEXE_UICTOOL = QT4 TEMPLATE_VBOXQT4GUIEXE_RCCTOOL = QT4 TEMPLATE_VBOXQT4GUIEXE_LRCTOOL = QT4 TEMPLATE_VBOXQT4GUIEXE_SDKS = QT4 ifdef VBOX_WITH_QT4_SUN ifneq ($(KBUILD_TARGET),darwin) ## @todo The next darwin build should also make use the prefix just to make things more uniform. TEMPLATE_VBOXQT4GUIEXE_QT_PREFIX = VBox endif endif endif # USE_KBUILD_QT_UNIT 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) ifndef USE_KBUILD_QT_UNIT_PART_2 # 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)) TEMPLATE_VBOXQT4GUIEXE_CXXFLAGS += -F$(VBOX_PATH_QT4_FRAMEWORKS) endif TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += -framework Carbon -framework QuickTime -bind_at_load 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 ifeq ($(KBUILD_TARGET),solaris) TEMPLATE_VBOXQT4GUIEXE_LIBS += \ rt socket nsl endif ifdef VBOX_WITH_ORIGIN # Assume the Qt shared objects are in the same directory as the executable, on Solaris too. TEMPLATE_VBOXQT4GUIEXE_LDFLAGS += '$(VBOX_GCC_RPATH_OPT)$$(VBOX_ORIGIN)' 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 # # The targets. # PROGRAMS += VirtualBox4 ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(KBUILD_TARGET)),) # X11 DLLS += VBoxKeyboard ## @todo convert to install target. OTHERS += $(PATH_BIN)/vboxkeyboard.tar.gz CLEAN += $(PATH_BIN)/vboxkeyboard.tar.gz endif INSTALLS += VirtualBox4.nls qt4-bin # # VBoxKeyboard - keyboard library for X11. # VBoxKeyboard_TEMPLATE = VBOXR3 VBoxKeyboard_SOURCES = \ src/linux/keyboard-new.c VBoxKeyboard_LIBS = X11 VBoxKeyboard_LIBPATH = $(VBOX_LIBPATH_X11) # # vboxkeyboard.tar.gz - the LGPLed keyboard library must always be # redistributed with usable sources. # # This rule will link create a temporary symlink to src/linux/ and tar # up the selected files into a tarball that is installed into the # bin directory (probably belongs in /usr/shared/somewhere really, # but wtf, it's not like we're even trying to be FHS compliant). # ## @todo this should be tar'ed down into the output directory and installed using an install target. $(PATH_BIN)/vboxkeyboard.tar.gz: \ $(VBoxKeyboard_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/keyboard-types.h \ src/linux/Makefile $(call MSG_TOOL,tar/gzip,,$@) $(QUIET2)$(RM) -f $(PATH_TARGET)/vboxkeyboard $@ $(QUIET)$(LN_SYMLINK) $(VBOX_VIRTUALBOX4_SRC)/src/linux/ $(PATH_TARGET)/vboxkeyboard $(QUIET)cd $(PATH_TARGET) \ && tar -chvf - $(addprefix vboxkeyboard/,$(notdir $^)) \ | gzip - > $@ $(QUIET2)$(RM) -f $(PATH_TARGET)/vboxkeyboard # # Include Qt project file, we'll use FORMS and TRANSLATIONS in # the VirtualBox4 setup below. # SAVED_TEMPLATE := $(TEMPLATE) include $(PATH_SUB_CURRENT)/VBoxUI.pro # # VirtualBox4 - The GUI program. # VirtualBox4_TEMPLATE = VBOXQT4GUIEXE VirtualBox4_NAME = VirtualBox VirtualBox4_SDKS.win = WINPSDK DXSDK ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(KBUILD_TARGET)),) # X11 + os2 ## @todo solaris VirtualBox4_SDKS += LIBSDL endif ifeq ($(KBUILD_TARGET),darwin) # For the launch trick we need different inode numbers. VirtualBox4_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM # For testing iChat Theater stuff change the sdk path (HACK ALERT!) ifdef VBOX_WITH_ICHAT_THEATER VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk endif endif # darwin VirtualBox4_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS VirtualBox4_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT VirtualBox4_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP VirtualBox4_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL VirtualBox4_DEFS.linux = VBOX_GUI_USE_SDL VirtualBox4_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL VirtualBox4_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL VirtualBox4_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL VirtualBox4_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL VirtualBox4_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP #ifndef VBOX_OSE ## @todo VBOX_WITH_HACKED_QT doesn't apply to Qt4, so why is this still here? VirtualBox4_DEFS.darwin += VBOX_WITH_HACKED_QT #endif ifdef VBOX_WITH_ICHAT_THEATER VirtualBox4_DEFS.darwin += VBOX_WITH_ICHAT_THEATER endif ifneq ($(KBUILD_TYPE),release) # non-release builds has some extra features. VirtualBox4_DEFS.win += VBOX_GUI_USE_DDRAW VirtualBox4_DEFS.linux += VBOX_GUI_USE_QIMAGE endif ifdef VBOX_WITH_REGISTRATION VirtualBox4_DEFS += VBOX_WITH_REGISTRATION endif ifdef VBOX_WITH_REGISTRATION_REQUEST VirtualBox4_DEFS += VBOX_WITH_REGISTRATION_REQUEST endif ifdef VBOX_WITH_UPDATE_REQUEST VirtualBox4_DEFS += VBOX_WITH_UPDATE_REQUEST endif ifdef VBOX_WITH_ALSA VirtualBox4_DEFS += VBOX_WITH_ALSA endif ifdef VBOX_WITH_PULSE VirtualBox4_DEFS += VBOX_WITH_PULSE endif ifdef VBOX_WITH_E1000 VirtualBox4_DEFS += VBOX_WITH_E1000 endif ifdef VBOX_OSE VirtualBox4_DEFS += VBOX_OSE endif ifdef VBOX_WITH_DEBUGGER_GUI VirtualBox4_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU endif VirtualBox4_INCS = \ ./include \ $(PATH_VirtualBox4)/include ifndef USE_KBUILD_QT_UNIT VirtualBox4_INCS += \ $(PATH_VirtualBox4)/ui \ $(PATH_VirtualBox4)/moc endif ifeq ($(KBUILD_TYPE),release) VirtualBox4_LDFLAGS.win += /SUBSYSTEM:windows else VirtualBox4_LDFLAGS.linux+= -rdynamic # for backtrace_symbols() ifeq ($(USERNAME),dmik) VirtualBox4_LDFLAGS.win += /SUBSYSTEM:windows else VirtualBox4_LDFLAGS.win += /SUBSYSTEM:console endif endif # r=bird: what is -lz doing here? it belongs in LIBS VirtualBox4_LDFLAGS.darwin = -framework IOKit -framework AppKit -framework ApplicationServices -framework Foundation -lz ifdef VBOX_WITH_ICHAT_THEATER VirtualBox4_LDFLAGS.darwin += -framework InstantMessage -framework QuartzCore endif VirtualBox4_LIBS.win = \ $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \ $(PATH_SDK_DXSDK_LIB)/ddraw.lib \ $(PATH_SDK_DXSDK_LIB)/dxguid.lib ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11 VirtualBox4_LIBS += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL) endif ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too. ifeq ($(KBUILD_TARGET),win) VirtualBox4_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB) else VirtualBox4_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL) endif endif # Headers containing definitions of classes that use the Q_OBJECT macro. VirtualBox4_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/VBoxUtils.h \ include/VBoxGlobalSettings.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/VBoxUpdateDlg.h \ include/VBoxSnapshotDetailsDlg.h \ include/VBoxVMInformationDlg.h \ include/VBoxTakeSnapshotDlg.h \ include/VBoxSnapshotsWgt.h \ include/VBoxVMLogViewer.h \ include/VBoxDiskImageManagerDlg.h \ include/VBoxSettingsUtils.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/VBoxGLSettingsGeneral.h \ include/VBoxGLSettingsInput.h \ include/VBoxGLSettingsUpdate.h \ include/VBoxGLSettingsLanguage.h \ include/VBoxSettingsDialog.h \ include/VBoxSettingsDialogSpecific.h \ include/VBoxSettingsPage.h \ include/VBoxSettingsSelector.h # Sources containing local definitions of classes that use the Q_OBJECT macro. VirtualBox4_QT_MOCSRCS = \ src/VBoxSelectorWnd.cpp ifdef VBOX_WITH_XPCOM VirtualBox4_QT_MOCSRCS += \ src/COMDefs.cpp endif VirtualBox4_SOURCES = \ 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/VBoxUpdateDlg.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/VBoxGLSettingsGeneral.cpp \ src/VBoxGLSettingsInput.cpp \ src/VBoxGLSettingsUpdate.cpp \ src/VBoxGLSettingsLanguage.cpp \ src/VBoxSettingsDialog.cpp \ src/VBoxSettingsDialogSpecific.cpp \ src/VBoxSettingsSelector.cpp ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) # X11 ifndef VBOX_OSE VirtualBox4_QT_MOCHDRS += \ include/VBoxLicenseViewer.h VirtualBox4_SOURCES += \ src/VBoxLicenseViewer.cpp endif VirtualBox4_SOURCES += \ src/linux/XKeyboard-new.cpp endif VirtualBox4_SOURCES.win += \ src/VBoxFBDDRAW.cpp \ $(PATH_TARGET)/VirtualBox4.rc VirtualBox4_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 VirtualBox4_SOURCES.darwin += \ src/darwin/VBoxIChatTheaterWrapper.m endif ifdef USE_KBUILD_QT_UNIT ## @todo Move to the appropriate places. ifdef USE_KBUILD_QT_UNIT_PART_2 # The Qt modules we're using. # (The include directory and lib/framework for each module will be added by the Qt4 unit.) VirtualBox4_QT_MODULES = Core Gui endif # Import QDesigner UI sources and translations from VBoxUI.pro. # Note that the OSE about dialog is always required by lupdate/lrelease. ifndef VBOX_WITH_REGISTRATION FORMS := $(filter-out ui/VBoxRegistrationDlg.ui,$(FORMS)) endif VirtualBox4_SOURCES := \ $(VirtualBox4_SOURCES) \ $(FORMS) \ ui/VBoxAboutDlg.ui # Resource files with some OSE differences. VirtualBox4_SOURCES += VirtualBox.qrc ifdef VBOX_OSE VirtualBox4_SOURCES += VirtualBox_OSE.qrc else VirtualBox4_SOURCES += VirtualBox_NonOSE.qrc VirtualBox4_SOURCES += src/VBoxAboutNonOSEDlg.cpp VirtualBox4_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h endif VirtualBox_OSE.qrc_RCCFLAGS = -name OSE VirtualBox_NonOSE.qrc_RCCFLAGS = -name NonOSE # Import the translation source from VBoxUI.pro and add the qt_xx_YY counterparts VirtualBox4_QT_TRANSLATIONS := $(TRANSLATIONS) \ $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts, $(filter nls/VirtualBox_%.ts,$(TRANSLATIONS))) # Compress the translation units. VirtualBox4_LRCFLAGS = -compress # Where to install the translations (a separate install target, VirtualBox4-nls-inst is created). VirtualBox4_QT_TRANSLATIONS_INST = $(INST_BIN)nls/ else # !USE_KBUILD_QT_UNIT # Import QDesigner UI sources from VBoxUI.pro. VirtualBox4_QT_UISRCS := $(FORMS) ifndef VBOX_WITH_REGISTRATION VirtualBox4_QT_UISRCS := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox4_QT_UISRCS)) endif # Import translation sources from VBoxUI.pro. VirtualBox4_QT_TRANSLATIONS := $(TRANSLATIONS) # Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart VirtualBox4_QT_TRANSLATIONS_QT := \ $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\ $(filter nls/VirtualBox_%.ts,$(VirtualBox4_QT_TRANSLATIONS))) # All generated sources. Note: this list MUST be in sync with Qt source # generation rules defined somewhere below! VirtualBox4_GENSRCS = \ $(foreach moc,$(notdir $(basename $(VirtualBox4_QT_MOCHDRS))), $(PATH_VirtualBox4)/moc/moc_$(moc).cpp) VirtualBox4_SOURCES += $(VirtualBox4_GENSRCS) # All generated headers. Note: this list MUST be in sync with Qt source # generation rules defined somewhere below! VirtualBox4_GENHDRS = \ $(foreach moc,$(notdir $(basename $(VirtualBox4_QT_MOCSRCS))), $(PATH_VirtualBox4)/moc/$(moc).moc) \ $(foreach ui,$(notdir $(basename $(VirtualBox4_QT_UISRCS))), $(PATH_VirtualBox4)/ui/$(ui).gen.h) # grep the images out of the resource file for dependency tracking VirtualBox4_QT_RC += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox.qrc) VirtualBox4_GENSRCS += $(PATH_VirtualBox4)/ui/qrc_application.cpp # We have different about dialogs in OSE and PUEL. Therefor two independent # resource files exists. ifdef VBOX_OSE VirtualBox4_QT_RC_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_OSE.qrc) VirtualBox4_GENSRCS += $(PATH_VirtualBox4)/ui/qrc_application_ose.cpp else VirtualBox4_QT_RC_NON_OSE += $(shell $(SED) '/images/!d;{s/^.*\(images\/.*\)<.*$$/\1/}' VirtualBox_NonOSE.qrc) VirtualBox4_GENSRCS += $(PATH_VirtualBox4)/ui/qrc_application_non_ose.cpp VirtualBox4_SOURCES += src/VBoxAboutNonOSEDlg.cpp VirtualBox4_QT_MOCHDRS += include/VBoxAboutNonOSEDlg.h endif # OSE version is always necessary for lupdate/lrelease VirtualBox4_QT_UISRCS += ui/VBoxAboutDlg.ui # All header files VirtualBox4_HEADERS = \ $(wildcard include/*.h) \ $(VirtualBox4_GENHDRS) endif # !USE_KBUILD_QT_UNIT # Some flag hacks (should go away). 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 # bird: What about $(if $(VBOX_GCC_Wno-missing-base-class-initializer),$(VBOX_GCC_Wno-missing-base-class-initializer),$(VBOX_GCC_Wno-extra))? ifdef VBOX_WITH_XPCOM src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra) endif # # On Windows we'll have to generate/edit the resource file. # The IDI_ICON1 name is Qt specific. # $(PATH_TARGET)/VirtualBox4.rc: $(PATH_SUB_CURRENT)/Makefile.kmk $(VBOX_WINDOWS_ICON_FILE) | $$(call DIRDEP,$$(@D)) $(RM) -f $@ $(APPEND) $@ 'IDI_ICON1 ICON "$(subst /,\\,$(VBOX_WINDOWS_ICON_FILE))"' VirtualBox4_CLEAN.win += $(PATH_TARGET)/VirtualBox4.rc # # Other stuff. # VBOX_WRAPPERS_FILE4 = $(PATH_VirtualBox4)/include/COMWrappers.h VirtualBox4_BLDDIRS += $(PATH_VirtualBox4)/include/ VirtualBox4_INTERMEDIATES = $(VBOX_WRAPPERS_FILE4) VBOX_WRAPPERS_INC_FILE4 = include/COMDefs.h VBOX_WRAPPERS_TEMPLATE4 = include/COMWrappers.xsl VBOX_WRAPPERS_XIDLFILE4 = ../../Main/idl/VirtualBox.xidl # generated files we need to clean manually OTHER_CLEAN = \ $(VirtualBox4_GENSRCS) \ $(VirtualBox4_GENHDRS) \ $(VBOX_WRAPPERS_FILE4) \ $(PATH_BIN)/vboxkeyboard.tar.gz # # On OS X (darwin) we need to install icon resources and compusory bundle contents. # The VirtualBoxVM.app helper is for launching VMs (fixes some issues with the dock). # 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 # ifndef USE_KBUILD_QT_UNIT ## @todo later VirtualBox4.nls_INST = $(INST_BIN)nls/ VirtualBox4.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox4)/nls/%.qm,$(notdir $(VirtualBox4_QT_TRANSLATIONS))) VirtualBox4.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox4)/nls/%.qm,$(notdir $(VirtualBox4_QT_TRANSLATIONS_QT))) VirtualBox4.nls_MODE = 644 endif # !USE_KBUILD_QT_UNIT # # Testcase for the darwin keyboard routines. # ifdef VBOX_WITH_TESTCASES PROGRAMS.darwin += tstDarwinKeyboard4 tstDarwinKeyboard4_NAME = tstDarwinKeyboard 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 # # Install the license file. Belongs in the root makefile really. # # Note: I'm doing this right here because the GUI will _not_ run # without that file which might be annoying for developers! # ifndef VBOX_OSE ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(KBUILD_TARGET)),) $(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC) $(call MSG_GENERATE,,$@) $(QUIET)$(CP) $< $@ $(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN) endif endif # Unset everything that was loaded from VBoxUI.pro. TEMPLATE := $(SAVED_TEMPLATE) SAVED_TEMPLATE := LANGUAGE := FORMS := TRANSLATIONS := IMAGES := # Commit the magic. # (note: before custom rules that make usage of generated variables!). include $(KBUILD_PATH)/footer.kmk ifndef USE_KBUILD_QT_UNIT # # 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 file from an UI # definition source (.ui). # @param $uifile UI definintion source file define def_qt_gen_src_ui $(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))) # UI sources $(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui))) # 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,VirtualBox4,$(eval $(def_qt_gen_src))) # rules for resources file creation $(PATH_VirtualBox4)/ui/qrc_application.cpp: VirtualBox.qrc $(VirtualBox4_QT_RC) $(call MSG_TOOL,rcc,VirtualBox4,$<,$@) $(QUIET)$(VBOX_RCC4) -o $@ $< $(PATH_VirtualBox4)/ui/qrc_application_ose.cpp: VirtualBox_OSE.qrc $(VirtualBox4_QT_RC_OSE) $(call MSG_TOOL,rcc,VirtualBox4,$<,$@) $(QUIET)$(VBOX_RCC4) -name "OSE" -o $@ $< $(PATH_VirtualBox4)/ui/qrc_application_non_ose.cpp: VirtualBox_NonOSE.qrc $(VirtualBox4_QT_RC_NON_OSE) $(call MSG_TOOL,rcc,VirtualBox4,$<,$@) $(QUIET)$(VBOX_RCC4) -name "NonOSE" -o $@ $< endif # !USE_KBUILD_QT_UNIT # # Generate the COM wrappers. # $(VBOX_WRAPPERS_INC_FILE4): $(VBOX_WRAPPERS_FILE4) $(VBOX_WRAPPERS_FILE4): $(VBOX_WRAPPERS_XIDLFILE4) $(VBOX_WRAPPERS_TEMPLATE4) | $(call DIRDEP,$(PATH_VirtualBox4)/include/) $(call MSG_TOOL,xsltproc,VirtualBox4,$<,$@) $(QUIET)$(VBOX_XSLTPROC) -o $@ $(VBOX_WRAPPERS_TEMPLATE4) $< ifdef USE_KBUILD_QT_UNIT # # 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:: \ $(VirtualBox4_QT_UISRCS) \ $(filter-out %.qrc,$(VirtualBox4_SOURCES)) \ $(wildcard include/*.h) $(call MSG_L1,lupdate all languages (nls/*.ts)) $(QUIET)$(TOOL_QT4_LUPDATE) \ $^ \ -ts \ $(filter-out nls/qt_%.ts,$(VirtualBox4_QT_TRANSLATIONS)) \ nls/VirtualBox_xx_YY.ts else # # 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:: $(VirtualBox4_SOURCES) $(VirtualBox4_HEADERS) $(call MSG_L1,lupdate all languages (nls/*.ts)) $(QUIET)$(VBOX_LUPDATE4) $^ -ts $(VirtualBox4_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts # # Test targets # test: @echo ==================== @echo $(VirtualBox4_GENSRCS) | $(SED) -e "s/ /\n/g" @echo -------------------- @echo $(VirtualBox4_GENSRCS_REAL) | $(SED) -e "s/ /\n/g" @echo ==================== @echo $(VirtualBox4_GENHDRS) | $(SED) -e "s/ /\n/g" @echo -------------------- @echo $(VirtualBox4_GENHDRS_REAL) | $(SED) -e "s/ /\n/g" @echo ==================== test2: @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g" test3: @echo $(VirtualBox4_HEADERS) | $(SED) -e "s/ /\n/g" endif # !USE_KBUILD_QT_UNIT # alias for generating the COM Wrappers file. testwrappers:: $(VBOX_WRAPPERS_FILE4)