VirtualBox

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

Last change on this file since 7183 was 7177, checked in by vboxsync, 17 years ago

Mac OS X: Added a skeleton of the iChat Theater implementation.

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