VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/Makefile@ 2387

Last change on this file since 2387 was 2366, checked in by vboxsync, 18 years ago

use kBuild-provided msg macros

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.2 KB
Line 
1#
2# Makefile for the VirtualBox Qt GUI.
3#
4
5#
6# Copyright (C) 2006 InnoTek Systemberatung GmbH
7#
8# This file is part of VirtualBox Open Source Edition (OSE), as
9# available from http://www.virtualbox.org. This file is free software;
10# you can redistribute it and/or modify it under the terms of the GNU
11# General Public License as published by the Free Software Foundation,
12# in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13# distribution. VirtualBox OSE is distributed in the hope that it will
14# be useful, but WITHOUT ANY WARRANTY of any kind.
15#
16# If you received this file as part of a commercial VirtualBox
17# distribution, then only the terms of your commercial VirtualBox
18# license agreement apply instead of the previous paragraph.
19#
20
21ifeq ($(BUILD_TARGET),linux)
22XKEYBOARD_NEW := 1
23endif
24
25# include qmake project file
26include VBoxUI.pro
27
28# Import QDesigner UI sources
29VirtualBox_QT_UISRCS := $(FORMS)
30# Import translation sources
31VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
32# Import images
33VirtualBox_QT_IMAGES := $(IMAGES)
34
35# reset things to avoid possible conflicts with kBuild
36TEMPLATE :=
37LANGUAGE :=
38FORMS :=
39TRANSLATIONS :=
40IMAGES :=
41
42DEPTH = ../../../..
43include $(PATH_KBUILD)/header.kmk
44
45PROGRAMS = VirtualBox
46
47INSTALLS = VirtualBox.nls
48INSTALLS.darwin = VirtualBox.app
49
50VirtualBox_TEMPLATE = VBOXQTGUIEXE
51VirtualBox_SDKS.win = WINPSDK DXSDK
52VirtualBox_SDKS.linux = LIBSDL
53
54# Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
55VirtualBox_QT_TRANSLATIONS_QT := \
56 $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
57 $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
58
59# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
60
61# Headers containing definitions of classes that use the Q_OBJECT macro
62VirtualBox_QT_MOCHDRS = \
63 include/QIWidgetValidator.h \
64 include/QIHotKeyEdit.h \
65 include/QIStatusBar.h \
66 include/QIStateIndicator.h \
67 include/QIMessageBox.h \
68 include/QIRichLabel.h \
69 include/VBoxGlobalSettings.h \
70 include/VBoxUtils.h \
71 include/VBoxGlobal.h \
72 include/VBoxVMListBox.h \
73 include/VBoxMediaComboBox.h \
74 include/VBoxSelectorWnd.h \
75 include/VBoxConsoleWnd.h \
76 include/VBoxConsoleView.h \
77 include/VBoxProblemReporter.h
78
79# Sources containing local definitions of classes that use the Q_OBJECT macro
80VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
81ifneq ($(BUILD_TARGET),win)
82VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
83endif
84
85# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
86VirtualBox_QT_MOCUIHDRS = \
87 ui/VBoxVMSettingsDlg.ui.h \
88 ui/VBoxSharedFoldersSettings.ui.h
89ifeq ($(BUILD_TARGET),win)
90VirtualBox_QT_MOCUIHDRS += ui/VBoxVMNetworkSettings.ui.h
91endif
92
93
94# All generated sources. Note: this list MUST be in sync with Qt source
95# generation rules defined somewhere below!
96VirtualBox_GENSRCS = \
97 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
98 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
99 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
100
101# All generated headers. Note: this list MUST be in sync with Qt source
102# generation rules defined somewhere below!
103VirtualBox_GENHDRS = \
104 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
105 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
106 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
107
108# All existing .ui.h files for known .ui sources
109VirtualBox_QT_UIHDRS = \
110 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
111
112# All header files
113VirtualBox_HEADERS = \
114 $(wildcard include/*.h) \
115 $(VirtualBox_GENHDRS) \
116 $(VirtualBox_QT_UIHDRS)
117
118
119VirtualBox_SOURCES = \
120 $(VirtualBox_GENSRCS) \
121 src/main.cpp \
122 src/COMDefs.cpp \
123 src/QIWidgetValidator.cpp \
124 src/QIHotKeyEdit.cpp \
125 src/QIStateIndicator.cpp \
126 src/QIStatusBar.cpp \
127 src/QIMessageBox.cpp \
128 src/QIRichLabel.cpp \
129 src/VBoxGlobalSettings.cpp \
130 src/VBoxGlobal.cpp \
131 src/VBoxMediaComboBox.cpp \
132 src/VBoxProblemReporter.cpp \
133 src/VBoxSelectorWnd.cpp \
134 src/VBoxConsoleView.cpp \
135 src/VBoxConsoleWnd.cpp \
136 src/VBoxVMListBox.cpp \
137 src/VBoxFrameBuffer.cpp
138
139VirtualBox_SOURCES.win += \
140 src/win32/VirtualBox.rc
141
142VirtualBox_SOURCES.win += \
143 src/VBoxFBDDRAW.cpp
144
145ifdef XKEYBOARD_NEW
146VirtualBox_SOURCES.linux = \
147 src/linux/XKeyboardNew.cpp
148else
149VirtualBox_SOURCES.linux = \
150 src/linux/XKeyboard.cpp \
151 src/linux/keyboard.c
152endif
153
154VirtualBox_SOURCES.darwin = \
155 src/darwin/DarwinKeyboard.cpp \
156 src/darwin/DarwinCursor.cpp \
157 src/darwin/VBoxAquaStyle.cpp
158
159## @todo how to detect what tool is used?
160## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
161# more generic -Wno-extra
162ifneq ($(BUILD_TARGET),win)
163src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
164endif
165
166VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
167VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
168VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE
169VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
170VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
171#ifndef VBOX_OSE
172 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
173#endif
174ifneq ($(BUILD_TYPE),release)
175 # non-release builds has some extra features.
176 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER VBOX_WITH_DEBUGGER_GUI_MENU
177 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
178 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
179endif
180ifdef VBOX_WITH_ALSA
181 VirtualBox_DEFS += VBOX_WITH_ALSA
182endif
183ifdef VBOX_OSE
184 VirtualBox_DEFS += VBOX_OSE
185endif
186
187VirtualBox_INCS = \
188 ./include \
189 $(PATH_VirtualBox)/ui \
190 $(PATH_VirtualBox)/moc \
191 $(PATH_VirtualBox)/include \
192
193
194ifeq ($(BUILD_TYPE),release)
195 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
196else
197 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
198 ifeq ($(USERNAME),dmik)
199 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
200 else
201 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
202 endif
203endif
204VirtualBox_LDFLAGS.darwin = -framework IOKit
205VirtualBox_LIBS.win = \
206 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
207 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
208 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
209
210ifdef VBOX_WITH_DEBUGGER_GUI
211 ifeq ($(BUILD_TARGET),win)
212 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
213 else
214 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
215 endif
216endif
217
218WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
219WRAPPERSINCFILE = include/COMDefs.h
220WRAPPERSTEMPLATE = include/COMWrappers.xsl
221XIDLFILE = ../../Main/idl/VirtualBox.xidl
222
223
224# generated files we need to clean manually
225OTHER_CLEAN = \
226 $(VirtualBox_GENSRCS) \
227 $(VirtualBox_GENHDRS) \
228 $(WRAPPERSFILE)
229
230
231#
232# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
233#
234VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
235VirtualBox.app_MODE = 644
236VirtualBox.app_SOURCES = \
237 src/darwin/PkgInfo \
238 $(PATH_TARGET)/Info.plist \
239 images/VirtualBox.icns=>Resources/virtualbox.icns
240
241$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
242 $(call MSG_L1,Generating $@)
243 $(xQUIET)$(RM) -f $@
244 $(xQUIET)$(SED) \
245 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
246 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
247 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
248 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
249 $< > $@
250
251#
252# Translation installation
253#
254
255VirtualBox.nls_INST = $(INST_BIN)nls/
256VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
257VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
258VirtualBox.nls_MODE = 644
259
260
261#
262# Testcase for the darwin keyboard routines.
263#
264ifdef VBOX_WITH_TESTCASES
265PROGRAMS.darwin += tstDarwinKeyboard
266tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
267tstDarwinKeyboard_INCS = include
268tstDarwinKeyboard_SOURCES = \
269 src/darwin/tstDarwinKeyboard.cpp \
270 src/darwin/DarwinKeyboard.cpp
271tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
272tstDarwinKeyboard_LIBS = \
273 $(LIB_RUNTIME)
274endif
275
276
277
278# Commit the magic.
279# (note: before custom rules that make usage of generated variables!).
280include $(PATH_KBUILD)/footer.kmk
281
282
283
284#
285# Qt source file generation rules
286#
287
288## @todo move QT source generation macros to kBuild
289
290## Generate a rule to create a MOC source file from a header containing
291# classes that use the Q_OBJECT macro.
292# @param $mochdr header file with Q_OBJECT
293define def_qt_gen_src_moc
294
295$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
296
297$(target)_GENSRCS_REAL += $(mocsrc)
298
299$(mocsrc): $(mochdr)
300 $$(call MSG_L1,moc $(mochdr),=> $$@)
301 $$(QUIET)$$(MKDIR) -p $$(@D)
302 $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
303
304endef
305
306## Generate a rule to create a MOC include file from a source containing
307# local classes that use the Q_OBJECT macro. This include is then included
308# by that source, so it must be generated before the source gets compiled.
309# @param $mocsrc source file with Q_OBJECT
310define def_qt_gen_inc_moc
311
312$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(SUFF_OBJ))
313$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
314
315$(target)_GENHDRS_REAL += $(mocinc)
316
317$(mocobj): $(mocinc)
318
319.NOTPARALLEL: $(mocinc)
320$(mocinc): $(mocsrc)
321 $$(call MSG_L1,moc $(mocsrc),=> $$@)
322 $$(QUIET)$$(MKDIR) -p $$(@D)
323 $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
324
325endef
326
327## Generate a rule to create a MOC include file from a UI header (ui.h) containing
328# local classes that use the Q_OBJECT macro. This include is then included
329# by that header, so it must be generated before the UI source gets compiled.
330# @param $mocuihdr UI header file with Q_OBJECT
331define def_qt_gen_inc_mocuihdr
332
333$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
334$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(SUFF_OBJ))
335$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
336
337$(target)_GENHDRS_REAL += $(mocuiinc)
338
339.NOTPARALLEL: $(mocuiinc)
340$(uisrc): $(mocuiinc)
341$(mocuiinc): $(mocuihdr)
342 $$(call MSG_L1,moc $(mocuihdr),=> $$@)
343 $$(QUIET)$$(MKDIR) -p $$(@D)
344 $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
345
346endef
347
348## Generate a rule to create a header and source files from an UI
349# definition source (.ui).
350# @param $uifile UI definintion source file
351define def_qt_gen_src_ui
352
353$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
354$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
355$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
356
357$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
358$(target)_GENHDRS_REAL += $(uihdr)
359
360.NOTPARALLEL: $(uihdr)
361$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
362 $$(call MSG_L1,uic $(uifile),=> $$@)
363 $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
364
365$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
366 $$(call MSG_L1,uic $(uifile),=> $$@)
367 $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
368
369$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
370 $$(call MSG_L1,moc $(uihdr),=> $$@)
371 $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
372
373endef
374
375## Generate a rule to create a .qm file from a NLS translation
376# source (.ts).
377# @param $tsfile Translation source file
378define def_qt_gen_nls
379
380$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
381
382OTHER_CLEAN += $(qmfile)
383
384$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
385 $$(call MSG_L1,lrelease $(tsfile),=> $$@)
386 $$(QUIET)$$(VBOX_LRELEASE) $(tsfile) -qm $$@
387
388endef
389
390## Generate rules for generating the Qt source for a target.
391# @param $target Target name.
392define def_qt_gen_src
393
394# moc srcs from hdrs with Q_OBJECT
395$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
396# moc includes from srcs with Q_OBJECT
397$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
398# moc includes from UI headers with Q_OBJECT
399$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
400# UI sources
401$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
402# NLS files
403$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
404$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
405# dirs
406$$(call DIRDEP,$(PATH_$(target))/ui/) \
407$$(call DIRDEP,$(PATH_$(target))/moc/) \
408$$(call DIRDEP,$(PATH_$(target))/nls/):
409 $$(call MSG_MKDIR,$$@)
410 $$(QUIET)$$(MKDIR) -p $$@
411
412endef
413
414# Generate Qt source rules.
415$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
416
417
418# Generate COM Wrappers
419.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
420
421$(WRAPPERSINCFILE): $(WRAPPERSFILE)
422
423$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
424 $(call MSG_L1,xsltproc $<,=> $@)
425 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
426
427$(call DIRDEP,$(PATH_VirtualBox)/include/):
428 $(call MSG_MKDIR,$@)
429 $(QUIET)$(MKDIR) -p $@
430
431# this is actually necessary only for Win32 target with disabled dependencies
432define def_wrapper_deps
433$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
434endef
435
436$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
437
438# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
439
440$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
441 @echo " \
442 $(VirtualBox_QT_IMAGES) \
443 " > $@
444
445$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
446 $(call MSG_L1,uic $<,=> $@)
447 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
448
449VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
450OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
451
452
453#
454# Hand made dependencies go here.
455# Basically, here are dependencies for generated UI source files that
456# include generated headers in turn.
457#
458
459$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
460 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
461
462# Make all generated UI sources dependent on all generated headers (since they
463# may include them). This is safer than indifidual dependencies above but
464# currently disabled, because will cause all UI sources to be rebuilt one a
465# single one changes.
466#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
467
468
469#
470# Custom targets
471#
472
473# Update all known NLS translation (.ts) files in the nls/ subdirectory.
474# NOTE: This target is intened to be run only by the GUI maintainer shortly
475# before a new product release. VirtualBox_xx_YY.ts is a template for new
476# languages and should never be actually translated or installed.
477updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
478 $(call MSG_L1,lupdate all languages (nls/*.ts))
479 $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
480
481
482#
483# Test targets
484#
485
486test:
487 @echo ====================
488 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
489 @echo --------------------
490 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
491 @echo ====================
492 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
493 @echo --------------------
494 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
495 @echo ====================
496
497test2:
498 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
499
500test3:
501 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
502
503testwrappers: $(WRAPPERSFILE)
504
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