VirtualBox

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

Last change on this file since 7871 was 7844, checked in by vboxsync, 17 years ago

Made the rpath $ORIGIN feature available to everyone (was solaris specific) so developers can drop that annoying LD_LIBRARY_PATH stuff. (Make sure your ld.so groks $ORIGIN and add VBOX_WITH_ORIGIN=1 to LocalConfig.kmk.) Hope solaris still works...

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