VirtualBox

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

最後變更 在這個檔案從5921是 5898,由 vboxsync 提交於 17 年 前

kBuild 0.1.2 preps: Avoid the shell at all costs because cygwin is messing up on smp boxes and screwing up the tinderbox.

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

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