VirtualBox

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

Last change on this file since 8094 was 8071, checked in by vboxsync, 17 years ago

New Hard Disk GUI (including SATA support) implemented:

  1. Attachment list is a table (QListView) with two columns.
  2. Each attachment represented by cortege of two cells. First of them allows to select unique attachment slot (IDE00, IDE01, IDE11, SLOT[0..max]). Second allows to select necessary VDI image (through standard VBoxMediaComboBox selector).
  3. Each cell contain hidden combo-box invoked by double-mouse-click or F2, Space, Ctrl/Alt+Up/Down keys.
  4. User can navigate through the table cells with cursor keys.
  5. There are three buttons which allows "Add new attachment", "Remove selected attachment" and "open Virtual Disk Manager" to directly select necessary vdi image there.
  6. There are context-menu in each cortege of attachments list.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 21.0 KB
Line 
1# $Id: Makefile.kmk 8071 2008-04-17 00:36:49Z 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
132
133 # For testing iChat Theater stuff change
134 # the sdk path
135 ifdef VBOX_WITH_ICHAT_THEATER
136 VBOX_PATH_MACOSX_SDK = /Developer/SDKs/MacOSX10.5.sdk
137 endif
138
139endif
140
141ifndef VBOX_OSE
142ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # linux only, yea, right.
143# Note: I'm doing this right here because the GUI will _not_ run
144# without that file which might be annoying for developers!
145$(VBOX_LICENSE_BIN): $(VBOX_LICENSE_SRC)
146 $(call MSG_GENERATE,,$@)
147 $(QUIET)$(CP) $< $@
148
149$(PATH_BIN)/VirtualBox: $(VBOX_LICENSE_BIN)
150endif
151endif
152
153# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
154VirtualBox_QT_TRANSLATIONS_QT := \
155 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
156 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
157
158# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
159
160# Headers containing definitions of classes that use the Q_OBJECT macro
161VirtualBox_QT_MOCHDRS = \
162 include/QIWidgetValidator.h \
163 include/QIHotKeyEdit.h \
164 include/QIStatusBar.h \
165 include/QIStateIndicator.h \
166 include/QIMessageBox.h \
167 include/QIRichLabel.h \
168 include/VBoxGlobalSettings.h \
169 include/VBoxUtils.h \
170 include/VBoxGlobal.h \
171 include/VBoxVMListBox.h \
172 include/VBoxMediaComboBox.h \
173 include/VBoxSelectorWnd.h \
174 include/VBoxConsoleWnd.h \
175 include/VBoxConsoleView.h \
176 include/VBoxProblemReporter.h \
177 include/VBoxDownloaderWgt.h \
178 include/VBoxNetworkFramework.h
179
180# Sources containing local definitions of classes that use the Q_OBJECT macro
181VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
182ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
183VirtualBox_QT_MOCSRCS += src/VBoxGlobal.cpp
184endif
185ifdef VBOX_WITH_XPCOM
186VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
187endif
188
189# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
190VirtualBox_QT_MOCUIHDRS = \
191 ui/VBoxVMSettingsDlg.ui.h \
192 ui/VBoxVMLogViewer.ui.h \
193 ui/VBoxSharedFoldersSettings.ui.h \
194 ui/VBoxHardDiskSettings.ui.h
195
196
197# All generated sources. Note: this list MUST be in sync with Qt source
198# generation rules defined somewhere below!
199VirtualBox_GENSRCS = \
200 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
201 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
202 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
203
204# All generated headers. Note: this list MUST be in sync with Qt source
205# generation rules defined somewhere below!
206VirtualBox_GENHDRS = \
207 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
208 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
209 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
210
211# All existing .ui.h files for known .ui sources
212VirtualBox_QT_UIHDRS = \
213 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
214
215# All header files
216VirtualBox_HEADERS = \
217 $(wildcard include/*.h) \
218 $(VirtualBox_GENHDRS) \
219 $(VirtualBox_QT_UIHDRS)
220
221
222VirtualBox_SOURCES = \
223 $(VirtualBox_GENSRCS) \
224 src/main.cpp \
225 src/COMDefs.cpp \
226 src/QIWidgetValidator.cpp \
227 src/QIHotKeyEdit.cpp \
228 src/QIStateIndicator.cpp \
229 src/QIStatusBar.cpp \
230 src/QIMessageBox.cpp \
231 src/QIRichLabel.cpp \
232 src/VBoxDefs.cpp \
233 src/VBoxGlobalSettings.cpp \
234 src/VBoxGlobal.cpp \
235 src/VBoxMediaComboBox.cpp \
236 src/VBoxProblemReporter.cpp \
237 src/VBoxSelectorWnd.cpp \
238 src/VBoxConsoleView.cpp \
239 src/VBoxConsoleWnd.cpp \
240 src/VBoxDownloaderWgt.cpp \
241 src/VBoxVMListBox.cpp \
242 src/VBoxFrameBuffer.cpp \
243 src/HappyHttp.cpp \
244 src/VBoxNetworkFramework.cpp
245
246ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
247VirtualBox_SOURCES += \
248 src/linux/XKeyboard-new.cpp
249endif
250
251VirtualBox_SOURCES.win += \
252 src/win32/VirtualBox.rc
253
254VirtualBox_SOURCES.win += \
255 src/VBoxFBDDRAW.cpp
256
257VirtualBox_SOURCES.darwin = \
258 src/darwin/DarwinKeyboard.cpp \
259 src/darwin/DarwinCursor.cpp \
260 src/darwin/VBoxAquaStyle.cpp \
261 src/darwin/VBoxUtils-darwin.cpp \
262 src/VBoxFBQuartz2D.cpp
263
264ifdef VBOX_WITH_ICHAT_THEATER
265 VirtualBox_SOURCES.darwin += \
266 src/darwin/VBoxIChatTheaterWrapper.m
267endif
268
269ifndef VBOX_OSE
270VirtualBox_QT_IMAGES += images/about_sun.png
271VirtualBox_SOURCES += src/VBoxAboutNonOSEDlg.cpp
272else
273VirtualBox_QT_UISRCS += ui/VBoxAboutDlg.ui
274endif
275
276ifneq ($(BUILD_TARGET),win)
277src/HappyHttp.cpp_CXXFLAGS += -fexceptions
278src/VBoxDownloaderWgt.cpp_CXXFLAGS += -fexceptions
279src/VBoxNetworkFramework.cpp_CXXFLAGS += -fexceptions
280endif
281src/HappyHttp.cpp_CXXFLAGS.linux += -O2
282
283## @todo how to detect what tool is used?
284## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
285# more generic -Wno-extra
286ifdef VBOX_WITH_XPCOM
287src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
288endif
289
290VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
291VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
292VirtualBox_DEFS.darwin = VBOX_GUI_USE_QUARTZ2D VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
293VirtualBox_DEFS.freebsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
294VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
295VirtualBox_DEFS.netbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
296VirtualBox_DEFS.openbsd = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL
297VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
298VirtualBox_DEFS.solaris = VBOX_GUI_USE_QIMAGE #VBOX_GUI_USE_SDL
299VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
300VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
301#ifndef VBOX_OSE
302 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
303#endif
304ifdef VBOX_WITH_ICHAT_THEATER
305 VirtualBox_DEFS.darwin += VBOX_WITH_ICHAT_THEATER
306endif
307ifneq ($(BUILD_TYPE),release)
308 # non-release builds has some extra features.
309 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
310 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
311endif
312ifdef VBOX_WITH_REGISTRATION
313 VirtualBox_DEFS += VBOX_WITH_REGISTRATION
314endif
315ifdef VBOX_WITH_REGISTRATION_REQUEST
316 VirtualBox_DEFS += VBOX_WITH_REGISTRATION_REQUEST
317endif
318ifdef VBOX_WITH_ALSA
319 VirtualBox_DEFS += VBOX_WITH_ALSA
320endif
321ifdef VBOX_WITH_PULSE
322 VirtualBox_DEFS += VBOX_WITH_PULSE
323endif
324ifdef VBOX_OSE
325 VirtualBox_DEFS += VBOX_OSE
326endif
327ifdef VBOX_WITH_DEBUGGER_GUI
328 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
329endif
330
331VirtualBox_INCS = \
332 ./include \
333 $(PATH_VirtualBox)/ui \
334 $(PATH_VirtualBox)/moc \
335 $(PATH_VirtualBox)/include \
336
337
338ifeq ($(BUILD_TYPE),release)
339 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
340else
341 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
342 ifeq ($(USERNAME),dmik)
343 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
344 else
345 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
346 endif
347endif
348VirtualBox_LDFLAGS.os2 = -Zlinker /PM:PM -Zno-fork
349VirtualBox_LDFLAGS.darwin = -framework IOKit
350ifdef VBOX_WITH_ICHAT_THEATER
351 VirtualBox_LDFLAGS.darwin += -framework Foundation -framework AppKit -framework InstantMessage -framework QuartzCore
352endif
353VirtualBox_LIBS.win = \
354 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
355 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
356 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
357VirtualBox_LIBS.os2 += $(PATH_DLL)/VBoxHlp$(VBOX_SUFF_DLL)
358ifeq ($(filter-out freebsd linux netbsd openbsd solaris,$(BUILD_TARGET)),) # X11
359VirtualBox_LIBS += $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
360endif
361
362
363ifdef VBOX_WITH_DEBUGGER_GUI ## @todo make this dynamically loadable and ship with release builds too.
364 ifeq ($(BUILD_TARGET),win)
365 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
366 else
367 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
368 endif
369endif
370
371WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
372WRAPPERSINCFILE = include/COMDefs.h
373WRAPPERSTEMPLATE = include/COMWrappers.xsl
374XIDLFILE = ../../Main/idl/VirtualBox.xidl
375
376
377# generated files we need to clean manually
378OTHER_CLEAN = \
379 $(VirtualBox_GENSRCS) \
380 $(VirtualBox_GENHDRS) \
381 $(WRAPPERSFILE) \
382 $(PATH_BIN)/vboxkeyboard.tar.gz
383
384
385#
386# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
387#
388INSTALLS.darwin += VirtualBox.app
389VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
390VirtualBox.app_MODE = 644
391VirtualBox.app_SOURCES = \
392 src/darwin/PkgInfo \
393 $(PATH_TARGET)/Info.plist \
394 images/VirtualBox.icns=>Resources/virtualbox.icns
395
396$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
397 $(call MSG_GENERATE,VirtualBox.app,$<,$@)
398 $(QUIET)$(RM) -f $@
399 $(QUIET)$(SED) \
400 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
401 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
402 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
403 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
404 $< > $@
405
406INSTALLS.darwin += VirtualBoxVM.app
407VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
408VirtualBoxVM.app_MODE = 644
409VirtualBoxVM.app_SOURCES = \
410 src/darwin/VM-PkgInfo=>PkgInfo \
411 $(PATH_TARGET)/VM-Info.plist=>Info.plist \
412 images/VirtualBox.icns=>Resources/virtualbox.icns
413VirtualBoxVM.app_SYMLINKS = \
414 MacOS=>../../../MacOS/
415
416$(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
417 $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
418 $(QUIET)$(RM) -f $@
419 $(QUIET)$(SED) \
420 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
421 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
422 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
423 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
424 --output $@ $<
425
426#
427# Translation installation
428#
429VirtualBox.nls_INST = $(INST_BIN)nls/
430VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
431VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
432VirtualBox.nls_MODE = 644
433
434
435#
436# Testcase for the darwin keyboard routines.
437#
438ifdef VBOX_WITH_TESTCASES
439PROGRAMS.darwin += tstDarwinKeyboard
440tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
441tstDarwinKeyboard_INCS = include
442tstDarwinKeyboard_SOURCES = \
443 src/darwin/tstDarwinKeyboard.cpp \
444 src/darwin/DarwinKeyboard.cpp
445tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
446tstDarwinKeyboard_LIBS = \
447 $(LIB_RUNTIME)
448endif
449
450
451
452# Commit the magic.
453# (note: before custom rules that make usage of generated variables!).
454include $(PATH_KBUILD)/footer.kmk
455
456
457
458#
459# Qt source file generation rules
460#
461
462## @todo move QT source generation macros to kBuild
463
464## Generate a rule to create a MOC source file from a header containing
465# classes that use the Q_OBJECT macro.
466# @param $mochdr header file with Q_OBJECT
467define def_qt_gen_src_moc
468
469$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
470
471$(target)_GENSRCS_REAL += $(mocsrc)
472
473$(mocsrc): $(mochdr)
474 $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
475 $$(QUIET)$$(MKDIR) -p $$(@D)
476 $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
477
478endef
479
480## Generate a rule to create a MOC include file from a source containing
481# local classes that use the Q_OBJECT macro. This include is then included
482# by that source, so it must be generated before the source gets compiled.
483# @param $mocsrc source file with Q_OBJECT
484define def_qt_gen_inc_moc
485
486$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
487$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
488
489$(target)_GENHDRS_REAL += $(mocinc)
490
491$(mocobj): $(mocinc)
492
493.NOTPARALLEL: $(mocinc)
494$(mocinc): $(mocsrc)
495 $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
496 $$(QUIET)$$(MKDIR) -p $$(@D)
497 $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
498
499endef
500
501## Generate a rule to create a MOC include file from a UI header (ui.h) containing
502# local classes that use the Q_OBJECT macro. This include is then included
503# by that header, so it must be generated before the UI source gets compiled.
504# @param $mocuihdr UI header file with Q_OBJECT
505define def_qt_gen_inc_mocuihdr
506
507$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
508$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
509$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
510
511$(target)_GENHDRS_REAL += $(mocuiinc)
512
513.NOTPARALLEL: $(mocuiinc)
514$(uisrc): $(mocuiinc)
515$(mocuiinc): $(mocuihdr)
516 $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
517 $$(QUIET)$$(MKDIR) -p $$(@D)
518 $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
519
520endef
521
522## Generate a rule to create a header and source files from an UI
523# definition source (.ui).
524# @param $uifile UI definintion source file
525define def_qt_gen_src_ui
526
527$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
528$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
529$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
530
531$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
532$(target)_GENHDRS_REAL += $(uihdr)
533
534.NOTPARALLEL: $(uihdr)
535$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
536 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
537 $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
538
539$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
540 $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
541 $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
542
543$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
544 $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
545 $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
546
547endef
548
549## Generate a rule to create a .qm file from a NLS translation
550# source (.ts).
551# @param $tsfile Translation source file
552define def_qt_gen_nls
553
554$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
555
556OTHER_CLEAN += $(qmfile)
557
558# Note that we use -nocompress in lrelease to avoid stripping comments and
559# other information from .qm files. If we don't do that, we get .qm files two
560# times smaller, but QTranslator::findMessage() will start searching for
561# translations in all existing contexts in case if it cannot find it in the
562# original context (which is of course not acceptable, no matter if it's a
563# special Qt "feature" or just a bug).
564
565$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
566 $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
567 $$(QUIET)$$(VBOX_LRELEASE) -nocompress $(tsfile) -qm $$@
568
569endef
570
571## Generate rules for generating the Qt source for a target.
572# @param $target Target name.
573define def_qt_gen_src
574
575# moc srcs from hdrs with Q_OBJECT
576$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
577# moc includes from srcs with Q_OBJECT
578$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
579# moc includes from UI headers with Q_OBJECT
580$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
581# UI sources
582$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
583# NLS files
584$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
585$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
586# dirs
587$$(call DIRDEP,$(PATH_$(target))/ui/) \
588$$(call DIRDEP,$(PATH_$(target))/moc/) \
589$$(call DIRDEP,$(PATH_$(target))/nls/):
590 $$(call MSG_MKDIR,$$@)
591 $$(QUIET)$$(MKDIR) -p $$@
592
593endef
594
595# Generate Qt source rules.
596$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
597
598
599# Generate COM Wrappers
600.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
601
602$(WRAPPERSINCFILE): $(WRAPPERSFILE)
603
604$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
605 $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
606 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
607
608$(call DIRDEP,$(PATH_VirtualBox)/include/):
609 $(call MSG_MKDIR,$@)
610 $(QUIET)$(MKDIR) -p $@
611
612# this is actually necessary only for Win32 target with disabled dependencies
613define def_wrapper_deps
614$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
615endef
616
617$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
618
619# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
620
621$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
622 $(RM) -f $@
623 $(APPEND) -v $@ VirtualBox_QT_IMAGES
624
625$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
626 $(call MSG_TOOL,uic,VirtualBox,$<,$@)
627 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
628
629VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
630OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
631
632
633#
634# Hand made dependencies go here.
635# Basically, here are dependencies for generated UI source files that
636# include generated headers in turn.
637#
638
639$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
640 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
641
642# Make all generated UI sources dependent on all generated headers (since they
643# may include them). This is safer than indifidual dependencies above but
644# currently disabled, because will cause all UI sources to be rebuilt one a
645# single one changes.
646#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
647
648
649#
650# Custom targets
651#
652
653# Update all known NLS translation (.ts) files in the nls/ subdirectory.
654# NOTE: This target is intened to be run only by the GUI maintainer shortly
655# before a new product release. VirtualBox_xx_YY.ts is a template for new
656# languages and should never be actually translated or installed.
657updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
658 $(call MSG_L1,lupdate all languages (nls/*.ts))
659 $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
660
661
662#
663# Test targets
664#
665
666test:
667 @echo ====================
668 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
669 @echo --------------------
670 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
671 @echo ====================
672 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
673 @echo --------------------
674 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
675 @echo ====================
676
677test2:
678 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
679
680test3:
681 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
682
683testwrappers: $(WRAPPERSFILE)
684
Note: See TracBrowser for help on using the repository browser.

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