VirtualBox

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

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

FE/Qt: Rebranding: Differ between OSE and non-OSE application icons and about art.

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