VirtualBox

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

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

qt3 unit on the move (disabled).

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