VirtualBox

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

Last change on this file since 10507 was 10433, checked in by vboxsync, 16 years ago

small fix

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