VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk@ 6659

Last change on this file since 6659 was 6645, checked in by vboxsync, 17 years ago

Mac OS X: Added Quartz2D framebuffer implementation.
This fixes the outstanding seamless issues also. Added commandline switch
"-rmode quartz2d" to VirtualBox. As from now the Quartz2D framebuffer
is the default painting engine on Mac OS X.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 20.4 KB
Line 
1# $Id: Makefile.kmk 6645 2008-01-31 10:02:59Z vboxsync $
2## @file
3# Makefile for the VirtualBox Qt GUI.
4#
5
6#
7# Copyright (C) 2006-2007 innotek GmbH
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16#
17
18# include qmake project file
19include VBoxUI.pro
20
21# Import QDesigner UI sources
22VirtualBox_QT_UISRCS := $(FORMS)
23# Import translation sources
24VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
25# Import images
26VirtualBox_QT_IMAGES := $(IMAGES)
27
28# reset things to avoid possible conflicts with kBuild
29TEMPLATE :=
30LANGUAGE :=
31FORMS :=
32TRANSLATIONS :=
33IMAGES :=
34
35VBOX_WITH_REGISTRATION := 1
36VBOX_WITH_REGISTRATION_REQUEST := 1
37
38DEPTH = ../../../..
39include $(PATH_KBUILD)/header.kmk
40
41
42#
43# exclude inappropriate UI content
44#
45ifndef VBOX_WITH_REGISTRATION
46VirtualBox_QT_UISRCS := $(filter-out ui/VBoxRegistrationDlg.ui,$(VirtualBox_QT_UISRCS))
47endif
48
49
50#
51# The targets.
52#
53PROGRAMS = VirtualBox
54ifeq ($(filter-out freebsd linux openbsd netbsd solaris,$(BUILD_TARGET)),) # X11
55DLLS = VBoxKeyboard
56OTHERS = $(PATH_BIN)/vboxkeyboard.tar.gz
57endif
58INSTALLS = VirtualBox.nls
59
60ifeq ($(BUILD_TARGET),os2)
61 DLLS += VBoxHlp
62 ifneq ($(strip $(VBOX_DLL_QT)),)
63 INSTALLS += qt.dll
64 qt.dll_INST = $(INST_BIN)
65 qt.dll_SOURCES += \
66 $(VBOX_DLL_QT)=>$(not-dir $(VBOX_DLL_QT))
67 endif
68endif
69
70
71#
72# VBoxHlp - helper DLL for OS/2.
73#
74VBoxHlp_ASTOOL = NASM
75VBoxHlp_ASFLAGS = -f obj
76VBoxHlp_DEFS = IN_RING3 IN_VBOXHLP
77VBoxHlp_CXXFLAGS = -fno-exceptions
78VBoxHlp_LDFLAGS = -nostdlib -los2
79VBoxHlp_LDFLAGS += -Zlinker option -Zlinker manyautodata
80VBoxHlp_SOURCES = \
81 src/os2/VBoxHlp.asm \
82 src/os2/VBoxHlp.cpp
83
84
85#
86# VBoxKeyboard - keyboard library for X11.
87#
88VBoxKeyboard_TEMPLATE = VBOXR3
89VBoxKeyboard_SOURCES = \
90 src/linux/keyboard-new.c
91VBoxKeyboard_TARSOURCES = \
92 $(VBoxKeyboard_SOURCES) \
93 src/linux/COPYING.LIB \
94 src/linux/keyboard.h \
95 src/linux/keyboard-layouts.h \
96 src/linux/keyboard-list.h \
97 src/linux/keyboard-tables.h \
98 src/linux/Makefile
99VBoxKeyboard_LIBS = X11
100VBoxKeyboard_LIBPATH = $(VBOX_LIBPATH_X11)
101
102
103#
104# vboxkeyboard.tar.gz - the LGPLed keyboard library must always be
105# redistributed with usable sources.
106#
107SOURCE_DIRECTORY = vboxkeyboard
108DIRECTORY_PREFIX = src/linux/
109
110$(PATH_TARGET)/$(SOURCE_DIRECTORY):
111 $(MKDIR) -p $(@D)
112 $(LN_SYMLINK) $(abspath $(PATH_CURRENT))/$(DIRECTORY_PREFIX) $@
113
114$(PATH_BIN)/vboxkeyboard.tar.gz: $(VBoxKeyboard_TARSOURCES) $(PATH_TARGET)/$(SOURCE_DIRECTORY)
115 $(call MSG_TOOL,tar/gzip,,$@)
116 $(QUIET)cd $(PATH_TARGET) && tar -chf - $(addprefix $(SOURCE_DIRECTORY)/,$(subst $(DIRECTORY_PREFIX),,$(VBoxKeyboard_TARSOURCES))) | gzip - > $@
117
118
119#
120# VirtualBox - The GUI program.
121#
122VirtualBox_TEMPLATE = VBOXQTGUIEXE
123VirtualBox_SDKS.win = WINPSDK DXSDK
124#ifeq ($(filter-out freebsd linux netbsd openbsd os2 solaris,$(BUILD_TARGET)),) - later
125ifeq ($(filter-out freebsd linux netbsd openbsd os2,$(BUILD_TARGET)),) # X11 + os2
126VirtualBox_SDKS += LIBSDL
127endif
128
129ifeq ($(BUILD_TARGET),darwin)
130# For the launch trick we need different inode numbers.
131VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
132endif
133
134ifndef VBOX_OSE
135ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # linux only, yea, right.
136# Note: I'm doing this right here because the GUI will _not_ run
137# without that file which might be annoying for developers!
138$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
139 $(call MSG_GENERATE,,$@)
140 $(QUIET)$(CP) $< $@
141
142$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
143endif
144endif
145
146# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
147VirtualBox_QT_TRANSLATIONS_QT := \
148 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
149 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
150
151# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
152
153# Headers containing definitions of classes that use the Q_OBJECT macro
154VirtualBox_QT_MOCHDRS = \
155 include/QIWidgetValidator.h \
156 include/QIHotKeyEdit.h \
157 include/QIStatusBar.h \
158 include/QIStateIndicator.h \
159 include/QIMessageBox.h \
160 include/QIRichLabel.h \
161 include/VBoxGlobalSettings.h \
162 include/VBoxUtils.h \
163 include/VBoxGlobal.h \
164 include/VBoxVMListBox.h \
165 include/VBoxMediaComboBox.h \
166 include/VBoxSelectorWnd.h \
167 include/VBoxConsoleWnd.h \
168 include/VBoxConsoleView.h \
169 include/VBoxProblemReporter.h \
170 include/VBoxDownloaderWgt.h \
171 include/VBoxNetworkFramework.h
172
173# Sources containing local definitions of classes that use the Q_OBJECT macro
174VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
175ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
176VirtualBox_QT_MOCSRCS += src/VBoxGlobal.cpp
177endif
178ifdef VBOX_WITH_XPCOM
179VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
180endif
181
182# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
183VirtualBox_QT_MOCUIHDRS = \
184 ui/VBoxVMSettingsDlg.ui.h \
185 ui/VBoxVMLogViewer.ui.h \
186 ui/VBoxSharedFoldersSettings.ui.h
187
188
189# All generated sources. Note: this list MUST be in sync with Qt source
190# generation rules defined somewhere below!
191VirtualBox_GENSRCS = \
192 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
193 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
194 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
195
196# All generated headers. Note: this list MUST be in sync with Qt source
197# generation rules defined somewhere below!
198VirtualBox_GENHDRS = \
199 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
200 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
201 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
202
203# All existing .ui.h files for known .ui sources
204VirtualBox_QT_UIHDRS = \
205 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
206
207# All header files
208VirtualBox_HEADERS = \
209 $(wildcard include/*.h) \
210 $(VirtualBox_GENHDRS) \
211 $(VirtualBox_QT_UIHDRS)
212
213
214VirtualBox_SOURCES = \
215 $(VirtualBox_GENSRCS) \
216 src/main.cpp \
217 src/COMDefs.cpp \
218 src/QIWidgetValidator.cpp \
219 src/QIHotKeyEdit.cpp \
220 src/QIStateIndicator.cpp \
221 src/QIStatusBar.cpp \
222 src/QIMessageBox.cpp \
223 src/QIRichLabel.cpp \
224 src/VBoxDefs.cpp \
225 src/VBoxGlobalSettings.cpp \
226 src/VBoxGlobal.cpp \
227 src/VBoxMediaComboBox.cpp \
228 src/VBoxProblemReporter.cpp \
229 src/VBoxSelectorWnd.cpp \
230 src/VBoxConsoleView.cpp \
231 src/VBoxConsoleWnd.cpp \
232 src/VBoxDownloaderWgt.cpp \
233 src/VBoxVMListBox.cpp \
234 src/VBoxFrameBuffer.cpp \
235 src/HappyHttp.cpp \
236 src/VBoxNetworkFramework.cpp
237
238ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
239VirtualBox_SOURCES += \
240 src/linux/XKeyboard-new.cpp
241endif
242
243VirtualBox_SOURCES.win += \
244 src/win32/VirtualBox.rc
245
246VirtualBox_SOURCES.win += \
247 src/VBoxFBDDRAW.cpp
248
249VirtualBox_SOURCES.darwin = \
250 src/darwin/DarwinKeyboard.cpp \
251 src/darwin/DarwinCursor.cpp \
252 src/darwin/VBoxAquaStyle.cpp \
253 src/darwin/VBoxUtils-darwin.cpp \
254 src/VBoxFBQuartz2D.cpp
255
256ifneq ($(BUILD_TARGET),win)
257src/HappyHttp.cpp_CXXFLAGS += -fexceptions
258src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
259src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
260endif
261src/HappyHttp.cpp_CXXFLAGS.linux += -O2
262
263## @todo how to detect what tool is used?
264## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
265# more generic -Wno-extra
266ifdef VBOX_WITH_XPCOM
267src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
268endif
269
270VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
271VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
272VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
273VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
274VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
275VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
276VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
277VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
278VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
279VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
280VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
281#ifndef VBOX_OSE
282 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
283#endif
284ifneq ($(BUILD_TYPE),release)
285 # non-release builds has some extra features.
286 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER
287 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
288 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
289endif
290ifdef VBOX_WITH_REGISTRATION
291 VirtualBox_DEFS += VBOX_WITH_REGISTRATION
292endif
293ifdef VBOX_WITH_REGISTRATION_REQUEST
294 VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
295endif
296ifdef VBOX_WITH_ALSA
297 VirtualBox_DEFS += VBOX_WITH_ALSA
298endif
299ifdef VBOX_WITH_PULSE
300 VirtualBox_DEFS += VBOX_WITH_PULSE
301endif
302ifdef VBOX_OSE
303 VirtualBox_DEFS += VBOX_OSE
304endif
305ifdef VBOX_WITH_DEBUGGER_GUI
306 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
307endif
308
309VirtualBox_INCS = \
310 ./include \
311 $(PATH_VirtualBox)/ui \
312 $(PATH_VirtualBox)/moc \
313 $(PATH_VirtualBox)/include \
314
315
316ifeq ($(BUILD_TYPE),release)
317 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
318else
319 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
320 ifeq ($(USERNAME),dmik)
321 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
322 else
323 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
324 endif
325endif
326VirtualBox_LDFLAGS.darwin = -framework IOKit
327VirtualBox_LIBS.win = \
328 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
329 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
330 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
331VirtualBox_LIBS.os2 += $(PATH_DLL)/VBoxHlp$(VBOX_SUFF_DLL)
332ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
333VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
334endif
335
336
337ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
338 ifeq ($(BUILD_TARGET),win)
339 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
340 else
341 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
342 endif
343endif
344
345WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
346WRAPPERSINCFILE = include/COMDefs.h
347WRAPPERSTEMPLATE = include/COMWrappers.xsl
348XIDLFILE = ../../Main/idl/VirtualBox.xidl
349
350
351# generated files we need to clean manually
352OTHER_CLEAN = \
353 $(VirtualBox_GENSRCS) \
354 $(VirtualBox_GENHDRS) \
355 $(WRAPPERSFILE) \
356 $(PATH_BIN)/vboxkeyboard.tar.gz
357
358
359#
360# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
361#
362INSTALLS.darwin += VirtualBox.app
363VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
364VirtualBox.app_MODE = 644
365VirtualBox.app_SOURCES = \
366 src/darwin/PkgInfo \
367 $(PATH_TARGET)/Info.plist \
368 images/VirtualBox.icns=>Resources/virtualbox.icns
369
370$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
371 $(call MSG_GENERATE,VirtualBox.app,$<,$@)
372 $(QUIET)$(RM) -f $@
373 $(QUIET)$(SED) \
374 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
375 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
376 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
377 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
378 $< > $@
379
380INSTALLS.darwin += VirtualBoxVM.app
381VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
382VirtualBoxVM.app_MODE = 644
383VirtualBoxVM.app_SOURCES = \
384 src/darwin/VM-PkgInfo=>PkgInfo \
385 $(PATH_TARGET)/VM-Info.plist=>Info.plist \
386 images/VirtualBox.icns=>Resources/virtualbox.icns
387VirtualBoxVM.app_SYMLINKS = \
388 MacOS=>../../../MacOS/
389
390$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
391 $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
392 $(QUIET)$(RM) -f $@
393 $(QUIET)$(SED) \
394 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
395 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
396 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
397 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
398 --output $@ $<
399
400#
401# Translation installation
402#
403VirtualBox.nls_INST = $(INST_BIN)nls/
404VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
405VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
406VirtualBox.nls_MODE = 644
407
408
409#
410# Testcase for the darwin keyboard routines.
411#
412ifdef VBOX_WITH_TESTCASES
413PROGRAMS.darwin += tstDarwinKeyboard
414tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
415tstDarwinKeyboard_INCS = include
416tstDarwinKeyboard_SOURCES = \
417 src/darwin/tstDarwinKeyboard.cpp \
418 src/darwin/DarwinKeyboard.cpp
419tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
420tstDarwinKeyboard_LIBS = \
421 $(LIB_RUNTIME)
422endif
423
424
425
426# Commit the magic.
427# (note: before custom rules that make usage of generated variables!).
428include $(PATH_KBUILD)/footer.kmk
429
430
431
432#
433# Qt source file generation rules
434#
435
436## @todo move QT source generation macros to kBuild
437
438## Generate a rule to create a MOC source file from a header containing
439# classes that use the Q_OBJECT macro.
440# @param $mochdr header file with Q_OBJECT
441define def_qt_gen_src_moc
442
443$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
444
445$(target)_GENSRCS_REAL += $(mocsrc)
446
447$(mocsrc): $(mochdr)
448 $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
449 $$(QUIET)$$(MKDIR) -p $$(@D)
450 $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
451
452endef
453
454## Generate a rule to create a MOC include file from a source containing
455# local classes that use the Q_OBJECT macro. This include is then included
456# by that source, so it must be generated before the source gets compiled.
457# @param $mocsrc source file with Q_OBJECT
458define def_qt_gen_inc_moc
459
460$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
461$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
462
463$(target)_GENHDRS_REAL += $(mocinc)
464
465$(mocobj): $(mocinc)
466
467.NOTPARALLEL: $(mocinc)
468$(mocinc): $(mocsrc)
469 $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
470 $$(QUIET)$$(MKDIR) -p $$(@D)
471 $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
472
473endef
474
475## Generate a rule to create a MOC include file from a UI header (ui.h) containing
476# local classes that use the Q_OBJECT macro. This include is then included
477# by that header, so it must be generated before the UI source gets compiled.
478# @param $mocuihdr UI header file with Q_OBJECT
479define def_qt_gen_inc_mocuihdr
480
481$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
482$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
483$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
484
485$(target)_GENHDRS_REAL += $(mocuiinc)
486
487.NOTPARALLEL: $(mocuiinc)
488$(uisrc): $(mocuiinc)
489$(mocuiinc): $(mocuihdr)
490 $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
491 $$(QUIET)$$(MKDIR) -p $$(@D)
492 $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
493
494endef
495
496## Generate a rule to create a header and source files from an UI
497# definition source (.ui).
498# @param $uifile UI definintion source file
499define def_qt_gen_src_ui
500
501$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
502$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
503$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
504
505$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
506$(target)_GENHDRS_REAL += $(uihdr)
507
508.NOTPARALLEL: $(uihdr)
509$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
510 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
511 $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
512
513$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
514 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
515 $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
516
517$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
518 $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
519 $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
520
521endef
522
523## Generate a rule to create a .qm file from a NLS translation
524# source (.ts).
525# @param $tsfile Translation source file
526define def_qt_gen_nls
527
528$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
529
530OTHER_CLEAN += $(qmfile)
531
532# Note that we use -nocompress in lrelease to avoid stripping comments and
533# other information from .qm files. If we don't do that, we get .qm files two
534# times smaller, but QTranslator::findMessage() will start searching for
535# translations in all existing contexts in case if it cannot find it in the
536# original context (which is of course not acceptable, no matter if it's a
537# special Qt "feature" or just a bug).
538
539$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
540 $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
541 $$(QUIET)$$(VBOX_LRELEASE) -nocompress $(tsfile) -qm $$@
542
543endef
544
545## Generate rules for generating the Qt source for a target.
546# @param $target Target name.
547define def_qt_gen_src
548
549# moc srcs from hdrs with Q_OBJECT
550$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
551# moc includes from srcs with Q_OBJECT
552$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
553# moc includes from UI headers with Q_OBJECT
554$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
555# UI sources
556$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
557# NLS files
558$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
559$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
560# dirs
561$$(call DIRDEP,$(PATH_$(target))/ui/) \
562$$(call DIRDEP,$(PATH_$(target))/moc/) \
563$$(call DIRDEP,$(PATH_$(target))/nls/):
564 $$(call MSG_MKDIR,$$@)
565 $$(QUIET)$$(MKDIR) -p $$@
566
567endef
568
569# Generate Qt source rules.
570$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
571
572
573# Generate COM Wrappers
574.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
575
576$(WRAPPERSINCFILE): $(WRAPPERSFILE)
577
578$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
579 $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
580 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
581
582$(call DIRDEP,$(PATH_VirtualBox)/include/):
583 $(call MSG_MKDIR,$@)
584 $(QUIET)$(MKDIR) -p $@
585
586# this is actually necessary only for Win32 target with disabled dependencies
587define def_wrapper_deps
588$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
589endef
590
591$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
592
593# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
594
595$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
596 $(RM) -f $@
597 $(APPEND) -v $@ VirtualBox_QT_IMAGES
598
599$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
600 $(call MSG_TOOL,uic,VirtualBox,$<,$@)
601 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
602
603VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
604OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
605
606
607#
608# Hand made dependencies go here.
609# Basically, here are dependencies for generated UI source files that
610# include generated headers in turn.
611#
612
613$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
614 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
615
616# Make all generated UI sources dependent on all generated headers (since they
617# may include them). This is safer than indifidual dependencies above but
618# currently disabled, because will cause all UI sources to be rebuilt one a
619# single one changes.
620#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
621
622
623#
624# Custom targets
625#
626
627# Update all known NLS translation (.ts) files in the nls/ subdirectory.
628# NOTE: This target is intened to be run only by the GUI maintainer shortly
629# before a new product release. VirtualBox_xx_YY.ts is a template for new
630# languages and should never be actually translated or installed.
631updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
632 $(call MSG_L1,lupdate all languages (nls/*.ts))
633 $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
634
635
636#
637# Test targets
638#
639
640test:
641 @echo ====================
642 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
643 @echo --------------------
644 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
645 @echo ====================
646 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
647 @echo --------------------
648 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
649 @echo ====================
650
651test2:
652 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
653
654test3:
655 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
656
657testwrappers: $(WRAPPERSFILE)
658
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette