# $Id: Makefile.kmk 8155 2008-04-18 15:16:47Z 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. # # include qmake project file include VBoxUI.pro # Import QDesigner UI sources VirtualBox_QT_UISRCS := $(FORMS) # Import translation sources VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS) # Import images VirtualBox_QT_IMAGES := $(IMAGES) # reset things to avoid possible conflicts with kBuild TEMPLATE := LANGUAGE := FORMS := TRANSLATIONS := IMAGES := VBOX_WITH_REGISTRATION := 1 VBOX_WITH_REGISTRATION_REQUEST := 1 DEPTH = ../../../.. include $(PATH_KBUILD)/header.kmk # # exclude inappropriate UI content # ifndef VBOX_WITH_REGISTRATION VirtualBox_QT_UISRCS := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS)) endif # # The targets. # PROGRAMS = VirtualBox ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(BUILD_TARGET)),) # X11 DLLS = VBoxKeyboard OTHERS = $(PATH_BIN)/vboxkeyboard.tar.gz endif INSTALLS = VirtualBox.nls ifeq ($(BUILD_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. # VBoxKeyboard_TEMPLATE = VBOXR3 VBoxKeyboard_SOURCES = \ src/linux/keyboard-new.c VBoxKeyboard_TARSOURCES = \ $(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/Makefile VBoxKeyboard_LIBS = X11 VBoxKeyboard_LIBPATH = $(VBOX_LIBPATH_X11) # # vboxkeyboard.tar.gz - the LGPLed keyboard library must always be # redistributed with usable sources. # SOURCE_DIRECTORY = vboxkeyboard DIRECTORY_PREFIX = src/linux/ $(PATH_TARGET)/$(SOURCE_DIRECTORY): $(MKDIR) -p $(@D) $(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@ $(PATH_BIN)/vboxkeyboard.tar.gz: $(VBoxKeyboard_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY) $(call MSG_TOOL,tar/gzip,,$@) $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard_TARSOURCES))) | gzip - > $@ # # VirtualBox - The GUI program. # VirtualBox_TEMPLATE = VBOXQTGUIEXE VirtualBox_SDKS.win = WINPSDK DXSDK #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 endif 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 # 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,$(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) $(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/QIRichLabel.h \ include/VBoxGlobalSettings.h \ include/VBoxUtils.h \ include/VBoxGlobal.h \ include/VBoxVMListBox.h \ include/VBoxMediaComboBox.h \ include/VBoxSelectorWnd.h \ include/VBoxConsoleWnd.h \ include/VBoxConsoleView.h \ include/VBoxProblemReporter.h \ include/VBoxDownloaderWgt.h \ include/VBoxNetworkFramework.h # Sources containing local definitions of classes that use the Q_OBJECT macro VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11 VirtualBox_QT_MOCSRCS += src/VBoxGlobal.cpp endif ifdef VBOX_WITH_XPCOM VirtualBox_QT_MOCSRCS += src/COMDefs.cpp endif # UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro VirtualBox_QT_MOCUIHDRS = \ ui/VBoxVMSettingsDlg.ui.h \ ui/VBoxVMLogViewer.ui.h \ ui/VBoxSharedFoldersSettings.ui.h \ ui/VBoxHardDiskSettings.ui.h # 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_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \ $(PATH_VirtualBox)/ui/vbox_image_collection.cpp # All generated headers. Note: this list MUST be in sync with Qt source # generation rules defined somewhere below! VirtualBox_GENHDRS = \ $(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 VirtualBox_QT_UIHDRS = \ $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS))) # 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/QIRichLabel.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/VBoxVMListBox.cpp \ src/VBoxFrameBuffer.cpp \ src/HappyHttp.cpp \ src/VBoxNetworkFramework.cpp ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11 VirtualBox_SOURCES += \ src/linux/XKeyboard-new.cpp endif VirtualBox_SOURCES.win += \ src/win32/VirtualBox.rc VirtualBox_SOURCES.win += \ src/VBoxFBDDRAW.cpp VirtualBox_SOURCES.darwin = \ src/darwin/DarwinKeyboard.cpp \ src/darwin/DarwinCursor.cpp \ src/darwin/VBoxAquaStyle.cpp \ src/darwin/VBoxUtils-darwin.cpp \ src/VBoxFBQuartz2D.cpp ifdef VBOX_WITH_ICHAT_THEATER VirtualBox_SOURCES.darwin += \ src/darwin/VBoxIChatTheaterWrapper.m endif ifndef VBOX_OSE VirtualBox_QT_IMAGES += images/about_sun.png VirtualBox_SOURCES += src/VBoxAboutNonOSEDlg.cpp else VirtualBox_QT_UISRCS += ui/VBoxAboutDlg.ui endif ifneq ($(BUILD_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 ($(BUILD_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_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 ($(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.os2 = -Zlinker /PM:PM -Zno-fork VirtualBox_LDFLAGS.darwin = -framework IOKit ifdef VBOX_WITH_ICHAT_THEATER VirtualBox_LDFLAGS.darwin += -framework Foundation -framework AppKit -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,$(BUILD_TARGET)),) # X11 VirtualBox_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 ($(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) \ $(PATH_BIN)/vboxkeyboard.tar.gz # # 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' \ --output $@ $< # # 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) $(RM) -f $@ $(APPEND) -v $@ 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)