VirtualBox

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

Last change on this file since 1705 was 1688, checked in by vboxsync, 18 years ago

FE/Qt: Added NLS support (compile and install defined NLS files; load the correct NLS file on startup based on the user locale setting; started Russian translation).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.5 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
50
51VirtualBox_TEMPLATE = VBOXQTGUIEXE
52VirtualBox_SDKS.win = WINPSDK DXSDK
53VirtualBox_SDKS.linux = LIBSDL
54
55
56# bird:
57# this is a sketch which later can be moved into kBuild core stuff perhaps.
58# I might not have got the logic in what causes what to be generated right
59# feel free to help.
60
61# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
62
63# Headers containing definitions of classes that use the Q_OBJECT macro
64VirtualBox_QT_MOCHDRS = \
65 include/QIWidgetValidator.h \
66 include/QIHotKeyEdit.h \
67 include/QIStatusBar.h \
68 include/QIStateIndicator.h \
69 include/QIMessageBox.h \
70 include/QIRichLabel.h \
71 include/VMGlobalSettings.h \
72 include/VBoxGlobal.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# All generated sources. Note: this list MUST be in sync with Qt source
94# generation rules defined somewhere below!
95VirtualBox_GENSRCS = \
96 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
97 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
98 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
99
100# All generated headers. Note: this list MUST be in sync with Qt source
101# generation rules defined somewhere below!
102VirtualBox_GENHDRS = \
103 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
104 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
105 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
106
107
108VirtualBox_SOURCES = \
109 $(VirtualBox_GENSRCS) \
110 src/main.cpp \
111 src/COMDefs.cpp \
112 src/QIWidgetValidator.cpp \
113 src/QIHotKeyEdit.cpp \
114 src/QIStateIndicator.cpp \
115 src/QIStatusBar.cpp \
116 src/QIMessageBox.cpp \
117 src/QIRichLabel.cpp \
118 src/VMGlobalSettings.cpp \
119 src/VBoxGlobal.cpp \
120 src/VBoxMediaComboBox.cpp \
121 src/VBoxProblemReporter.cpp \
122 src/VBoxSelectorWnd.cpp \
123 src/VBoxConsoleView.cpp \
124 src/VBoxConsoleWnd.cpp \
125 src/VBoxVMListBox.cpp \
126 src/VBoxFrameBuffer.cpp
127
128VirtualBox_SOURCES.win += \
129 src/win32/VirtualBox.rc
130
131VirtualBox_SOURCES.win += \
132 src/VBoxFBDDRAW.cpp
133
134ifdef XKEYBOARD_NEW
135VirtualBox_SOURCES.linux = \
136 src/linux/XKeyboardNew.cpp
137else
138VirtualBox_SOURCES.linux = \
139 src/linux/XKeyboard.cpp \
140 src/linux/keyboard.c
141endif
142
143VirtualBox_SOURCES.darwin = \
144 src/darwin/DarwinKeyboard.cpp \
145 src/darwin/DarwinCursor.cpp
146
147VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
148VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
149VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE
150VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
151VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
152#ifndef VBOX_OSE
153 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
154#endif
155ifneq ($(BUILD_TYPE),release)
156 # non-release builds has some extra features.
157 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER VBOX_WITH_DEBUGGER_GUI_MENU
158 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
159 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
160endif
161ifdef VBOX_WITH_ALSA
162 VirtualBox_DEFS += VBOX_WITH_ALSA
163endif
164ifdef VBOX_OSE
165 VirtualBox_DEFS += VBOX_OSE
166endif
167
168VirtualBox_INCS = \
169 ./include \
170 $(PATH_VirtualBox)/ui \
171 $(PATH_VirtualBox)/moc \
172 $(PATH_VirtualBox)/include \
173
174
175ifeq ($(BUILD_TYPE),release)
176 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
177else
178 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
179 ifeq ($(USERNAME),dmik)
180 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
181 else
182 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
183 endif
184endif
185VirtualBox_LDFLAGS.darwin = -framework IOKit
186VirtualBox_LIBS.win = \
187 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
188 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
189 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
190
191ifdef VBOX_WITH_DEBUGGER_GUI
192 ifeq ($(BUILD_TARGET),win)
193 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
194 else
195 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
196 endif
197endif
198
199WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
200WRAPPERSINCFILE = include/COMDefs.h
201WRAPPERSTEMPLATE = include/COMWrappers.xsl
202XIDLFILE = ../../Main/idl/VirtualBox.xidl
203
204
205# generated files we need to clean manually
206OTHER_CLEAN = \
207 $(VirtualBox_GENSRCS) \
208 $(VirtualBox_GENHDRS) \
209 $(WRAPPERSFILE)
210
211
212#
213# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
214#
215VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
216VirtualBox.app_MODE = 644
217VirtualBox.app_SOURCES = \
218 src/darwin/PkgInfo \
219 $(PATH_TARGET)/Info.plist \
220 images/VirtualBox.icns=>Resources/virtualbox.icns
221
222$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
223 $(call MSG_L1,Generating $@)
224 $(xQUIET)$(RM) -f $@
225 $(xQUIET)$(SED) \
226 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
227 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
228 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
229 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
230 $< > $@
231
232#
233# Translation installation
234#
235
236VirtualBox.nls_INST = $(INST_BIN)nls/
237VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
238VirtualBox.nls_MODE = 644
239
240
241
242# Commit the magic.
243# (note: before custom rules that make usage of generated variables!).
244include $(PATH_KBUILD)/footer.kmk
245
246
247
248#
249# Qt source file generation rules
250#
251
252## Generate a rule to create a MOC source file from a header containing
253# classes that use the Q_OBJECT macro.
254# @param $mochdr header file with Q_OBJECT
255define def_qt_gen_src_moc
256
257$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
258
259$(target)_GENSRCS_REAL += $(mocsrc)
260
261$(mocsrc): $(mochdr)
262 $$(call MSG_L1,moc $(mochdr),=> $$@)
263 $$(QUIET)$(MKDIR) -p $$(@D)
264 $$(QUIET)$(VBOX_MOC) $(mochdr) -o $$@
265
266endef
267
268## Generate a rule to create a MOC include file from a source containing
269# local classes that use the Q_OBJECT macro. This include is then included
270# by that source, so it must be generated before the source gets compiled.
271# @param $mocsrc source file with Q_OBJECT
272define def_qt_gen_inc_moc
273
274$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(SUFF_OBJ))
275$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
276
277$(target)_GENHDRS_REAL += $(mocinc)
278
279$(mocobj): $$(mocinc)
280
281.NOTPARALLEL: $$(mocinc)
282$(mocinc): $(mocsrc)
283 $$(call MSG_L1,moc $(mocsrc),=> $$@)
284 $$(QUIET)$(MKDIR) -p $$(@D)
285 $$(QUIET)$(VBOX_MOC) -i $(mocsrc) -o $$@
286
287endef
288
289## Generate a rule to create a MOC include file from a UI header (ui.h) containing
290# local classes that use the Q_OBJECT macro. This include is then included
291# by that header, so it must be generated before the UI source gets compiled.
292# @param $mocuihdr UI header file with Q_OBJECT
293define def_qt_gen_inc_mocuihdr
294
295$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
296$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(SUFF_OBJ))
297$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
298
299$(target)_GENHDRS_REAL += $(mocuiinc)
300
301.NOTPARALLEL: $$(mocuiinc)
302$(uisrc): $$(mocuiinc)
303$(mocuiinc): $(mocuihdr)
304 $$(call MSG_L1,moc $(mocuihdr),=> $$@)
305 $$(QUIET)$(MKDIR) -p $$(@D)
306 $$(QUIET)$(VBOX_MOC) -i $(mocuihdr) -o $$@
307
308endef
309
310## Generate a rule to create a header and source files from an UI
311# definition source (.ui).
312# @param $uifile UI definintion source file
313define def_qt_gen_src_ui
314
315$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
316$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
317$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
318
319$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
320$(target)_GENHDRS_REAL += $(uihdr)
321
322.NOTPARALLEL: $$(uihdr)
323$(uihdr): $(uifile) | $$(call DIRDEP,$$(dir $$(uihdr)))
324 $$(call MSG_L1,uic $(uifile),=> $$@)
325 $$(QUIET)$(VBOX_UIC) $(uifile) -o $$@
326
327$(uisrc): $$(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$$(dir $$(uisrc)))
328 $$(call MSG_L1,uic $(uifile),=> $$@)
329 $$(QUIET)$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
330
331$(mocsrc): $$(uihdr) | $$(call DIRDEP,$$(dir $$(mocsrc)))
332 $$(call MSG_L1,moc $(uihdr),=> $$@)
333 $$(QUIET)$(VBOX_MOC) $(uihdr) -o $$@
334
335endef
336
337## Generate a rule to create a .qm file from a NLS translation
338# source (.ts).
339# @param $tsfile Translation source file
340define def_qt_gen_nls
341
342$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
343
344OTHER_CLEAN += $(qmfile)
345
346$(qmfile): $(tsfile) | $$(call DIRDEP,$$(dir $$(qmfile)))
347 $$(call MSG_L1,lrelease $(tsfile),=> $$@)
348 $$(QUIET)$(VBOX_LRELEASE) $(tsfile) -qm $$@
349
350endef
351
352## Generate rules for generating the Qt source for a target.
353# @param $target Target name.
354define def_qt_gen_src
355
356# moc srcs from hdrs with Q_OBJECT
357$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
358# moc includes from srcs with Q_OBJECT
359$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
360# moc includes from UI headers with Q_OBJECT
361$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
362# UI sources
363$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
364# NLS files
365$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
366# dirs
367$$(call DIRDEP,$(PATH_$(target))/ui/) \
368$$(call DIRDEP,$(PATH_$(target))/moc/) \
369$$(call DIRDEP,$(PATH_$(target))/nls/):
370 $$(call MSG_L2,Creating directory $$@)
371 $$(QUIET)$(MKDIR) -p $$@
372
373endef
374
375# Generate Qt source rules.
376$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
377
378
379# Generate COM Wrappers
380.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
381
382$(WRAPPERSINCFILE): $(WRAPPERSFILE)
383
384$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
385 $(call MSG_L1,xsltproc $<,=> $@)
386 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
387
388$(call DIRDEP,$(PATH_VirtualBox)/include/):
389 $(call MSG_L2,Creating directory $@)
390 $(QUIET)$(MKDIR) -p $@
391
392# this is actually necessary only for Win32 target with disabled dependencies
393define def_wrapper_deps
394$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
395endef
396
397$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
398
399# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
400
401$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
402 @echo " \
403 $(VirtualBox_QT_IMAGES) \
404 " > $@
405
406$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
407 $(call MSG_L1,uic $<,=> $@)
408 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
409
410VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
411OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
412
413
414#
415# Hand made dependencies go here.
416# Basically, here are dependencies for generated UI source files that
417# include generated headers in turn.
418#
419
420$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
421 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
422
423# Make all generated UI sources dependent on all generated headers (since they
424# may include them). This is safer than indifidual dependencies above but
425# currently disabled, because will cause all UI sources to be rebuilt one a
426# single one changes.
427#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
428
429
430#
431# Custom targets
432#
433
434# Update all known NLS translation (.ts) files in the nls/ subdirectory
435updatenls: $(VirtualBox_SOURCES) $(VirtualBox_QT_MOCHDRS) $(VirtualBox_GENHDRS)
436 $(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS)
437
438
439#
440# Test targets
441#
442
443test:
444 @echo ---------------
445 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
446 @echo ---------------
447 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
448 @echo ---------------
449
450test2:
451 @echo ---------------
452 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
453 @echo ---------------
454
455testwrappers: $(WRAPPERSFILE)
456
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