3853N/A# Makefile for the VirtualBox Qt GUI.
3853N/A# Copyright (C) 2006-2007 Sun Microsystems, Inc.
3853N/A# This file is part of VirtualBox Open Source Edition (OSE), as
3853N/A# you can redistribute it
and/or modify it under the terms of the GNU
3853N/A# General Public License (GPL) as published by the Free Software
3853N/A# Foundation, in version 2 as it comes in the "COPYING" file of the
3853N/A# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3853N/A# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3853N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
3853N/A# additional information or have any questions.
3853N/A# include qmake project file
3853N/A# Import QDesigner UI sources
3853N/AVirtualBox_QT_UISRCS := $(FORMS)
3853N/A# Import translation sources
3853N/AVirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
3853N/AVirtualBox_QT_IMAGES := $(IMAGES)
3853N/A# reset things to avoid possible conflicts with kBuild
VBOX_WITH_REGISTRATION := 1
VBOX_WITH_REGISTRATION_REQUEST := 1
# Additional images that depend on the version type
VirtualBox_QT_IMAGES += \
VirtualBox_QT_IMAGES += \
# exclude inappropriate UI content
ifndef VBOX_WITH_REGISTRATION
ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(BUILD_TARGET)),) # X11
ifeq ($(BUILD_TARGET),os2)
ifneq ($(strip $(VBOX_DLL_QT)),)
$(VBOX_DLL_QT)=>$(not-dir $(VBOX_DLL_QT))
# VBoxHlp - helper DLL for OS/2.
VBoxHlp_DEFS = IN_RING3 IN_VBOXHLP
VBoxHlp_CXXFLAGS = -fno-exceptions
VBoxHlp_LDFLAGS = -nostdlib -los2
VBoxHlp_LDFLAGS += -Zlinker option -Zlinker manyautodata
# VBoxKeyboard - keyboard library for X11.
VBoxKeyboard_TEMPLATE = VBOXR3
VBoxKeyboard_TARSOURCES = \
$(VBoxKeyboard_SOURCES) \
VBoxKeyboard_LIBPATH = $(VBOX_LIBPATH_X11)
# redistributed with usable sources.
SOURCE_DIRECTORY = vboxkeyboard
$(PATH_TARGET)/$(SOURCE_DIRECTORY):
$(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
$(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard_TARSOURCES))) | gzip - > $@
# VirtualBox - The GUI program.
VirtualBox_TEMPLATE = VBOXQTGUIEXE
#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(BUILD_TARGET)),) - later
ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(BUILD_TARGET)),) # X11 + os2
VirtualBox_SDKS += LIBSDL
ifeq ($(BUILD_TARGET),darwin)
# For the launch trick we need different inode numbers.
VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
# For testing iChat Theater stuff change
ifdef VBOX_WITH_ICHAT_THEATER
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_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)
$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
VirtualBox_QT_TRANSLATIONS_QT := \
# 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 = \
# Sources containing local definitions of classes that use the Q_OBJECT macro
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
# UI headers (
ui.h) containing local definitions of classes that use the Q_OBJECT macro
VirtualBox_QT_MOCUIHDRS = \
# All generated sources. Note: this list MUST be in sync with Qt source
# generation rules defined somewhere below!
$(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)
/moc/moc_$(moc).cpp) \
$(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(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!
$(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
$(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
$(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
# All existing
.ui.h files for known .ui sources
$(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
$(wildcard include/*.h) \
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
ifdef VBOX_WITH_ICHAT_THEATER
ifneq ($(BUILD_TARGET),win)
## @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
VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
ifdef VBOX_WITH_ICHAT_THEATER
ifneq ($(BUILD_TYPE),release)
# non-release builds has some extra features.
ifdef VBOX_WITH_REGISTRATION
VirtualBox_DEFS += VBOX_WITH_REGISTRATION
ifdef VBOX_WITH_REGISTRATION_REQUEST
VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
VirtualBox_DEFS += VBOX_WITH_ALSA
VirtualBox_DEFS += VBOX_WITH_PULSE
VirtualBox_DEFS += VBOX_OSE
ifdef VBOX_WITH_DEBUGGER_GUI
VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
$(PATH_VirtualBox)/include \
ifeq ($(BUILD_TYPE),release)
ifdef VBOX_WITH_ICHAT_THEATER
ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
ifeq ($(BUILD_TARGET),win)
VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
# generated files we need to clean manually
# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
-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' \
-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_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
# Testcase for the darwin keyboard routines.
ifdef VBOX_WITH_TESTCASES
tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
tstDarwinKeyboard_INCS = include
tstDarwinKeyboard_SOURCES = \
tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
tstDarwinKeyboard_LIBS = \
# (note: before custom rules that make usage of generated variables!).
# 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)
$$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
## 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)
$$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
## 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)
$$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
$$(QUIET)$$(MKDIR) -p $$(@D)
$$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
## Generate a rule to create a header and source files from an UI
# definition source (.ui).
# @param $uifile UI definintion source file
$(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)
$(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 $$@
## Generate a rule to create a .qm file from a NLS translation
# @param $tsfile Translation source file
$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
# 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 $$@
## Generate rules for generating the Qt source for a target.
# @param $target Target name.
# 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)))
$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
$$(call DIRDEP,$(PATH_$(target))/ui/) \
$$(call DIRDEP,$(PATH_$(target))/moc/) \
$$(call DIRDEP,$(PATH_$(target))/nls/):
$$(QUIET)$$(MKDIR) -p $$@
# Generate Qt source rules.
$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
.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/):
# this is actually necessary only for Win32 target with disabled dependencies
$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
# static images imported from
VBoxUI.pro as VirtualBox_QT_IMAGES
$(APPEND) -v $@ VirtualBox_QT_IMAGES
$(call MSG_TOOL,uic,VirtualBox,$<,$@)
$(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
# 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
#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
# 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
# languages and should never be actually translated or installed.
updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
$(call MSG_L1,lupdate all languages (nls/*.ts))
@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 ====================
@echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
@echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
testwrappers: $(WRAPPERSFILE)