VirtualBox

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

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

PATH_KBUILD -> KBUILD_PATH.

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