VirtualBox

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

Last change on this file since 2261 was 2240, checked in by vboxsync, 18 years ago

1934: Never decrease size in the layout:

Fixing minimum height of the VM & Global Settings Dialog whatsThisLabel so, that its height will never shrinks.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.8 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/VMGlobalSettings.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/VMGlobalSettings.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
158## @todo how to detect what tool is used?
159## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
160# more generic -Wno-extra
161ifneq ($(BUILD_TARGET),win)
162src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
163endif
164
165VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
166VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
167VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE
168VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
169VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
170#ifndef VBOX_OSE
171 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
172#endif
173ifneq ($(BUILD_TYPE),release)
174 # non-release builds has some extra features.
175 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER VBOX_WITH_DEBUGGER_GUI_MENU
176 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
177 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
178endif
179ifdef VBOX_WITH_ALSA
180 VirtualBox_DEFS += VBOX_WITH_ALSA
181endif
182ifdef VBOX_OSE
183 VirtualBox_DEFS += VBOX_OSE
184endif
185
186VirtualBox_INCS = \
187 ./include \
188 $(PATH_VirtualBox)/ui \
189 $(PATH_VirtualBox)/moc \
190 $(PATH_VirtualBox)/include \
191
192
193ifeq ($(BUILD_TYPE),release)
194 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
195else
196 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
197 ifeq ($(USERNAME),dmik)
198 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
199 else
200 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
201 endif
202endif
203VirtualBox_LDFLAGS.darwin = -framework IOKit
204VirtualBox_LIBS.win = \
205 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
206 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
207 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
208
209ifdef VBOX_WITH_DEBUGGER_GUI
210 ifeq ($(BUILD_TARGET),win)
211 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
212 else
213 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
214 endif
215endif
216
217WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
218WRAPPERSINCFILE = include/COMDefs.h
219WRAPPERSTEMPLATE = include/COMWrappers.xsl
220XIDLFILE = ../../Main/idl/VirtualBox.xidl
221
222
223# generated files we need to clean manually
224OTHER_CLEAN = \
225 $(VirtualBox_GENSRCS) \
226 $(VirtualBox_GENHDRS) \
227 $(WRAPPERSFILE)
228
229
230#
231# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
232#
233VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
234VirtualBox.app_MODE = 644
235VirtualBox.app_SOURCES = \
236 src/darwin/PkgInfo \
237 $(PATH_TARGET)/Info.plist \
238 images/VirtualBox.icns=>Resources/virtualbox.icns
239
240$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
241 $(call MSG_L1,Generating $@)
242 $(xQUIET)$(RM) -f $@
243 $(xQUIET)$(SED) \
244 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
245 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
246 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
247 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
248 $< > $@
249
250#
251# Translation installation
252#
253
254VirtualBox.nls_INST = $(INST_BIN)nls/
255VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
256VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
257VirtualBox.nls_MODE = 644
258
259
260
261# Commit the magic.
262# (note: before custom rules that make usage of generated variables!).
263include $(PATH_KBUILD)/footer.kmk
264
265
266
267#
268# Qt source file generation rules
269#
270
271## @todo move QT source generation macros to kBuild
272
273## Generate a rule to create a MOC source file from a header containing
274# classes that use the Q_OBJECT macro.
275# @param $mochdr header file with Q_OBJECT
276define def_qt_gen_src_moc
277
278$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
279
280$(target)_GENSRCS_REAL += $(mocsrc)
281
282$(mocsrc): $(mochdr)
283 $$(call MSG_L1,moc $(mochdr),=> $$@)
284 $$(QUIET)$$(MKDIR) -p $$(@D)
285 $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
286
287endef
288
289## Generate a rule to create a MOC include file from a source containing
290# local classes that use the Q_OBJECT macro. This include is then included
291# by that source, so it must be generated before the source gets compiled.
292# @param $mocsrc source file with Q_OBJECT
293define def_qt_gen_inc_moc
294
295$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(SUFF_OBJ))
296$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
297
298$(target)_GENHDRS_REAL += $(mocinc)
299
300$(mocobj): $(mocinc)
301
302.NOTPARALLEL: $(mocinc)
303$(mocinc): $(mocsrc)
304 $$(call MSG_L1,moc $(mocsrc),=> $$@)
305 $$(QUIET)$$(MKDIR) -p $$(@D)
306 $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
307
308endef
309
310## Generate a rule to create a MOC include file from a UI header (ui.h) containing
311# local classes that use the Q_OBJECT macro. This include is then included
312# by that header, so it must be generated before the UI source gets compiled.
313# @param $mocuihdr UI header file with Q_OBJECT
314define def_qt_gen_inc_mocuihdr
315
316$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
317$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(SUFF_OBJ))
318$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
319
320$(target)_GENHDRS_REAL += $(mocuiinc)
321
322.NOTPARALLEL: $(mocuiinc)
323$(uisrc): $(mocuiinc)
324$(mocuiinc): $(mocuihdr)
325 $$(call MSG_L1,moc $(mocuihdr),=> $$@)
326 $$(QUIET)$$(MKDIR) -p $$(@D)
327 $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
328
329endef
330
331## Generate a rule to create a header and source files from an UI
332# definition source (.ui).
333# @param $uifile UI definintion source file
334define def_qt_gen_src_ui
335
336$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
337$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
338$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
339
340$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
341$(target)_GENHDRS_REAL += $(uihdr)
342
343.NOTPARALLEL: $(uihdr)
344$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
345 $$(call MSG_L1,uic $(uifile),=> $$@)
346 $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
347
348$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
349 $$(call MSG_L1,uic $(uifile),=> $$@)
350 $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
351
352$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
353 $$(call MSG_L1,moc $(uihdr),=> $$@)
354 $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
355
356endef
357
358## Generate a rule to create a .qm file from a NLS translation
359# source (.ts).
360# @param $tsfile Translation source file
361define def_qt_gen_nls
362
363$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
364
365OTHER_CLEAN += $(qmfile)
366
367$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
368 $$(call MSG_L1,lrelease $(tsfile),=> $$@)
369 $$(QUIET)$$(VBOX_LRELEASE) $(tsfile) -qm $$@
370
371endef
372
373## Generate rules for generating the Qt source for a target.
374# @param $target Target name.
375define def_qt_gen_src
376
377# moc srcs from hdrs with Q_OBJECT
378$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
379# moc includes from srcs with Q_OBJECT
380$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
381# moc includes from UI headers with Q_OBJECT
382$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
383# UI sources
384$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
385# NLS files
386$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
387$(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
388# dirs
389$$(call DIRDEP,$(PATH_$(target))/ui/) \
390$$(call DIRDEP,$(PATH_$(target))/moc/) \
391$$(call DIRDEP,$(PATH_$(target))/nls/):
392 $$(call MSG_L2,Creating directory $$@)
393 $$(QUIET)$$(MKDIR) -p $$@
394
395endef
396
397# Generate Qt source rules.
398$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
399
400
401# Generate COM Wrappers
402.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
403
404$(WRAPPERSINCFILE): $(WRAPPERSFILE)
405
406$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
407 $(call MSG_L1,xsltproc $<,=> $@)
408 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
409
410$(call DIRDEP,$(PATH_VirtualBox)/include/):
411 $(call MSG_L2,Creating directory $@)
412 $(QUIET)$(MKDIR) -p $@
413
414# this is actually necessary only for Win32 target with disabled dependencies
415define def_wrapper_deps
416$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
417endef
418
419$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
420
421# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
422
423$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
424 @echo " \
425 $(VirtualBox_QT_IMAGES) \
426 " > $@
427
428$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
429 $(call MSG_L1,uic $<,=> $@)
430 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
431
432VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
433OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
434
435
436#
437# Hand made dependencies go here.
438# Basically, here are dependencies for generated UI source files that
439# include generated headers in turn.
440#
441
442$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
443 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
444
445# Make all generated UI sources dependent on all generated headers (since they
446# may include them). This is safer than indifidual dependencies above but
447# currently disabled, because will cause all UI sources to be rebuilt one a
448# single one changes.
449#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
450
451
452#
453# Custom targets
454#
455
456# Update all known NLS translation (.ts) files in the nls/ subdirectory.
457# NOTE: This target is intened to be run only by the GUI maintainer shortly
458# before a new product release. VirtualBox_xx_YY.ts is a template for new
459# languages and should never be actually translated or installed.
460updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
461 $(call MSG_L1,lupdate all languages (nls/*.ts))
462 $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
463
464
465#
466# Test targets
467#
468
469test:
470 @echo ====================
471 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
472 @echo --------------------
473 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
474 @echo ====================
475 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
476 @echo --------------------
477 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
478 @echo ====================
479
480test2:
481 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
482
483test3:
484 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
485
486testwrappers: $(WRAPPERSFILE)
487
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