Makefile.kmk revision c91ab7d0648260621550e62e2ac5b30c8050646c
6ae232055d4d8a97267517c5e50074c2c819941and# $Id$
6ae232055d4d8a97267517c5e50074c2c819941and## @file
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd# Makefile for the VirtualBox Qt GUI.
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd#
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd
6ae232055d4d8a97267517c5e50074c2c819941and#
6ae232055d4d8a97267517c5e50074c2c819941and# Copyright (C) 2006-2007 innotek GmbH
6ae232055d4d8a97267517c5e50074c2c819941and#
6ae232055d4d8a97267517c5e50074c2c819941and# This file is part of VirtualBox Open Source Edition (OSE), as
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc# available from http://www.virtualbox.org. This file is free software;
6ae232055d4d8a97267517c5e50074c2c819941and# you can redistribute it and/or modify it under the terms of the GNU
6ae232055d4d8a97267517c5e50074c2c819941and# General Public License as published by the Free Software Foundation,
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
2e545ce2450a9953665f701bb05350f0d3f26275nd# distribution. VirtualBox OSE is distributed in the hope that it will
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen# be useful, but WITHOUT ANY WARRANTY of any kind.
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen#
6ae232055d4d8a97267517c5e50074c2c819941and# If you received this file as part of a commercial VirtualBox
6ae232055d4d8a97267517c5e50074c2c819941and# distribution, then only the terms of your commercial VirtualBox
6ae232055d4d8a97267517c5e50074c2c819941and# license agreement apply instead of the previous paragraph.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen#
3f08db06526d6901aa08c110b5bc7dde6bc39905nd
6ae232055d4d8a97267517c5e50074c2c819941and# include qmake project file
6ae232055d4d8a97267517c5e50074c2c819941andinclude VBoxUI.pro
6ae232055d4d8a97267517c5e50074c2c819941and
b43f840409794ed298e8634f6284741f193b6c4ftakashi# Import QDesigner UI sources
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_UISRCS := $(FORMS)
6ae232055d4d8a97267517c5e50074c2c819941and# Import translation sources
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
b43f840409794ed298e8634f6284741f193b6c4ftakashi# Import images
053bfa8a288528fafab2b7a032c15116bb5de711ndVirtualBox_QT_IMAGES := $(IMAGES)
6ae232055d4d8a97267517c5e50074c2c819941and
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung# reset things to avoid possible conflicts with kBuild
6ae232055d4d8a97267517c5e50074c2c819941andTEMPLATE :=
b43f840409794ed298e8634f6284741f193b6c4ftakashiLANGUAGE :=
b43f840409794ed298e8634f6284741f193b6c4ftakashiFORMS :=
b43f840409794ed298e8634f6284741f193b6c4ftakashiTRANSLATIONS :=
b43f840409794ed298e8634f6284741f193b6c4ftakashiIMAGES :=
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andDEPTH = ../../../..
6ae232055d4d8a97267517c5e50074c2c819941andinclude $(PATH_KBUILD)/header.kmk
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andPROGRAMS = VirtualBox
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andINSTALLS = VirtualBox.nls
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_TEMPLATE = VBOXQTGUIEXE
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_SDKS.win = WINPSDK DXSDK
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_SDKS.linux = LIBSDL
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_SDKS.os2 = LIBSDL
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andifeq ($(BUILD_TARGET),darwin)
6ae232055d4d8a97267517c5e50074c2c819941and# For the launch trick we need different inode numbers.
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
6ae232055d4d8a97267517c5e50074c2c819941andendif
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_TRANSLATIONS_QT := \
6ae232055d4d8a97267517c5e50074c2c819941and $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
6ae232055d4d8a97267517c5e50074c2c819941and $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# Headers containing definitions of classes that use the Q_OBJECT macro
070897b4d34cbd17fd2846289189f2a9891f9c84takashiVirtualBox_QT_MOCHDRS = \
070897b4d34cbd17fd2846289189f2a9891f9c84takashi include/QIWidgetValidator.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/QIHotKeyEdit.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/QIStatusBar.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/QIStateIndicator.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/QIMessageBox.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/QIRichLabel.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxGlobalSettings.h \
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh include/VBoxUtils.h \
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar include/VBoxGlobal.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxVMListBox.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxMediaComboBox.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxSelectorWnd.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxConsoleWnd.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxConsoleView.h \
6ae232055d4d8a97267517c5e50074c2c819941and include/VBoxProblemReporter.h
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# Sources containing local definitions of classes that use the Q_OBJECT macro
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
6ae232055d4d8a97267517c5e50074c2c819941andifdef VBOX_WITH_XPCOM
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_MOCSRCS += src/COMDefs.cpp
6ae232055d4d8a97267517c5e50074c2c819941andendif
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_MOCUIHDRS = \
6ae232055d4d8a97267517c5e50074c2c819941and ui/VBoxVMSettingsDlg.ui.h \
6ae232055d4d8a97267517c5e50074c2c819941and ui/VBoxVMLogViewer.ui.h \
6ae232055d4d8a97267517c5e50074c2c819941and ui/VBoxSharedFoldersSettings.ui.h
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# All generated sources. Note: this list MUST be in sync with Qt source
6ae232055d4d8a97267517c5e50074c2c819941and# generation rules defined somewhere below!
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_GENSRCS = \
6ae232055d4d8a97267517c5e50074c2c819941and $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
6ae232055d4d8a97267517c5e50074c2c819941and $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
6ae232055d4d8a97267517c5e50074c2c819941and $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# All generated headers. Note: this list MUST be in sync with Qt source
6ae232055d4d8a97267517c5e50074c2c819941and# generation rules defined somewhere below!
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_GENHDRS = \
6ae232055d4d8a97267517c5e50074c2c819941and $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
6ae232055d4d8a97267517c5e50074c2c819941and $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
6ae232055d4d8a97267517c5e50074c2c819941and $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# All existing .ui.h files for known .ui sources
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_QT_UIHDRS = \
6ae232055d4d8a97267517c5e50074c2c819941and $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and# All header files
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_HEADERS = \
6ae232055d4d8a97267517c5e50074c2c819941and $(wildcard include/*.h) \
6ae232055d4d8a97267517c5e50074c2c819941and $(VirtualBox_GENHDRS) \
6ae232055d4d8a97267517c5e50074c2c819941and $(VirtualBox_QT_UIHDRS)
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941and
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_SOURCES = \
6ae232055d4d8a97267517c5e50074c2c819941and $(VirtualBox_GENSRCS) \
6ae232055d4d8a97267517c5e50074c2c819941and src/main.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/COMDefs.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIWidgetValidator.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIHotKeyEdit.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIStateIndicator.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIStatusBar.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIMessageBox.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/QIRichLabel.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxDefs.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxGlobalSettings.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxGlobal.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxMediaComboBox.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxProblemReporter.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxSelectorWnd.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxConsoleView.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxConsoleWnd.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxVMListBox.cpp \
6ae232055d4d8a97267517c5e50074c2c819941and src/VBoxFrameBuffer.cpp
b43f840409794ed298e8634f6284741f193b6c4ftakashi
053bfa8a288528fafab2b7a032c15116bb5de711ndVirtualBox_SOURCES.win += \
6ae232055d4d8a97267517c5e50074c2c819941and src/win32/VirtualBox.rc
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung
727872d18412fc021f03969b8641810d8896820bhumbedoohVirtualBox_SOURCES.win += \
0d0ba3a410038e179b695446bb149cce6264e0abnd src/VBoxFBDDRAW.cpp
727872d18412fc021f03969b8641810d8896820bhumbedooh
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohVirtualBox_SOURCES.linux = \
0d0ba3a410038e179b695446bb149cce6264e0abnd src/linux/XKeyboard.cpp \
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh src/linux/keyboard.c
727872d18412fc021f03969b8641810d8896820bhumbedooh
0d0ba3a410038e179b695446bb149cce6264e0abndVirtualBox_SOURCES.darwin = \
0d0ba3a410038e179b695446bb149cce6264e0abnd src/darwin/DarwinKeyboard.cpp \
0d0ba3a410038e179b695446bb149cce6264e0abnd src/darwin/DarwinCursor.cpp \
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh src/darwin/VBoxAquaStyle.cpp \
0d0ba3a410038e179b695446bb149cce6264e0abnd src/darwin/VBoxUtils-darwin.cpp
0d0ba3a410038e179b695446bb149cce6264e0abnd
0d0ba3a410038e179b695446bb149cce6264e0abnd## @todo how to detect what tool is used?
727872d18412fc021f03969b8641810d8896820bhumbedooh## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
0d0ba3a410038e179b695446bb149cce6264e0abnd# more generic -Wno-extra
0d0ba3a410038e179b695446bb149cce6264e0abndifdef VBOX_WITH_XPCOM
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedoohsrc/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
205f749042ed530040a4f0080dbcb47ceae8a374rjungendif
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen
0d0ba3a410038e179b695446bb149cce6264e0abndVirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
7fec19672a491661b2fe4b29f685bc7f4efa64d4ndVirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
7fec19672a491661b2fe4b29f685bc7f4efa64d4ndVirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE
7fec19672a491661b2fe4b29f685bc7f4efa64d4ndVirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
6ae232055d4d8a97267517c5e50074c2c819941andVirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
#ifndef VBOX_OSE
VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
#endif
ifneq ($(BUILD_TYPE),release)
# non-release builds has some extra features.
VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER VBOX_WITH_DEBUGGER_GUI_MENU
VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
endif
ifdef VBOX_WITH_ALSA
VirtualBox_DEFS += VBOX_WITH_ALSA
endif
ifdef VBOX_OSE
VirtualBox_DEFS += VBOX_OSE
endif
VirtualBox_INCS = \
./include \
$(PATH_VirtualBox)/ui \
$(PATH_VirtualBox)/moc \
$(PATH_VirtualBox)/include \
ifeq ($(BUILD_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.darwin = -framework IOKit
VirtualBox_LIBS.win = \
$(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
$(PATH_SDK_DXSDK_LIB)/ddraw.lib \
$(PATH_SDK_DXSDK_LIB)/dxguid.lib
ifdef VBOX_WITH_DEBUGGER_GUI
ifeq ($(BUILD_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
# generated files we need to clean manually
OTHER_CLEAN = \
$(VirtualBox_GENSRCS) \
$(VirtualBox_GENHDRS) \
$(WRAPPERSFILE)
#
# 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 \
images/VirtualBox.icns=>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 \
images/VirtualBox.icns=>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' \
$< > $@
#
# Translation installation
#
VirtualBox.nls_INST = $(INST_BIN)nls/
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 += tstDarwinKeyboard
tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
tstDarwinKeyboard_INCS = include
tstDarwinKeyboard_SOURCES = \
src/darwin/tstDarwinKeyboard.cpp \
src/darwin/DarwinKeyboard.cpp
tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
tstDarwinKeyboard_LIBS = \
$(LIB_RUNTIME)
endif
# Commit the magic.
# (note: before custom rules that make usage of generated variables!).
include $(PATH_KBUILD)/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)
$(mocsrc): $(mochdr)
$$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) $(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)
$(mocobj): $(mocinc)
.NOTPARALLEL: $(mocinc)
$(mocinc): $(mocsrc)
$$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) -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)
.NOTPARALLEL: $(mocuiinc)
$(uisrc): $(mocuiinc)
$(mocuiinc): $(mocuihdr)
$$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
endef
## Generate a rule to create a header and source files from an UI
# definition source (.ui).
# @param $uifile UI definintion source file
define def_qt_gen_src_ui
$(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)
.NOTPARALLEL: $(uihdr)
$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
$$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
$$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
$$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
$$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
$$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
$$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
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_LRELEASE) -nocompress $(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,VirtualBox,$(eval $(def_qt_gen_src)))
# Generate COM Wrappers
.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
$(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 $@
# this is actually necessary only for Win32 target with disabled dependencies
define def_wrapper_deps
$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
endef
$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
@echo " \
$(VirtualBox_QT_IMAGES) \
" > $@
$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
$(call MSG_TOOL,uic,VirtualBox,$<,$@)
$(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
#
# Hand made dependencies go here.
# Basically, here are dependencies for generated UI source files that
# include generated headers in turn.
#
$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
$(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
# 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_UISRCS)))) : $(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_LUPDATE) $^ -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)