VirtualBox

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

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

Activated new Linux GUI keyboard code by default

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.1 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# QDesigner UI sources
29VirtualBox_QT_UISRCS := $(FORMS)
30
31# reset things to avoid possible conflicts with kBuild
32TEMPLATE :=
33LANGUAGE :=
34FORMS :=
35
36
37DEPTH = ../../../..
38include $(PATH_KBUILD)/header.kmk
39
40PROGRAMS = VirtualBox
41
42INSTALLS.darwin = VirtualBox.app
43
44
45VirtualBox_TEMPLATE = VBOXQTGUIEXE
46VirtualBox_SDKS.win = WINPSDK DXSDK
47VirtualBox_SDKS.linux = LIBSDL
48VirtualBox_SDKS.darwin = LIBSDL
49
50
51# bird:
52# this is a sketch which later can be moved into kBuild core stuff perhaps.
53# I might not have got the logic in what causes what to be generated right
54# feel free to help.
55
56# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
57
58# Headers containing definitions of classes that use the Q_OBJECT macro
59VirtualBox_QT_MOCHDRS = \
60 include/QIWidgetValidator.h \
61 include/QIHotKeyEdit.h \
62 include/QIStatusBar.h \
63 include/QIStateIndicator.h \
64 include/QIMessageBox.h \
65 include/QIRichLabel.h \
66 include/VMGlobalSettings.h \
67 include/VBoxGlobal.h \
68 include/VBoxMediaComboBox.h \
69 include/VBoxSelectorWnd.h \
70 include/VBoxConsoleWnd.h \
71 include/VBoxConsoleView.h \
72 include/VBoxProblemReporter.h
73
74# Sources containing local definitions of classes that use the Q_OBJECT macro
75ifneq ($(BUILD_TARGET),win)
76VirtualBox_QT_MOCSRCS = src/COMDefs.cpp
77endif
78
79# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
80VirtualBox_QT_MOCUIHDRS = \
81 ui/VBoxVMSettingsDlg.ui.h \
82 ui/VBoxSharedFoldersSettings.ui.h
83
84VirtualBox_GENSRCS = \
85 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
86 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
87 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
88
89VirtualBox_GENHDRS = \
90 $(foreach mocui,$(basename $(VirtualBox_QT_MOCUIHDRS)), $(PATH_VirtualBox)/moc/$(mocui).moc) \
91 $(foreach moc,$(basename $(VirtualBox_QT_MOCSRCS)), $(PATH_VirtualBox)/moc/$(moc).moc) \
92 $(foreach ui,$(basename $(VirtualBox_QT_UISRCS)), $(PATH_VirtualBox)/$(ui).h)
93
94
95VirtualBox_SOURCES = \
96 $(VirtualBox_GENSRCS) \
97 src/main.cpp \
98 src/COMDefs.cpp \
99 src/QIWidgetValidator.cpp \
100 src/QIHotKeyEdit.cpp \
101 src/QIStateIndicator.cpp \
102 src/QIStatusBar.cpp \
103 src/QIMessageBox.cpp \
104 src/QIRichLabel.cpp \
105 src/VMGlobalSettings.cpp \
106 src/VBoxGlobal.cpp \
107 src/VBoxMediaComboBox.cpp \
108 src/VBoxProblemReporter.cpp \
109 src/VBoxSelectorWnd.cpp \
110 src/VBoxConsoleView.cpp \
111 src/VBoxConsoleWnd.cpp \
112 src/VBoxVMListBox.cpp \
113 src/VBoxFrameBuffer.cpp
114
115VirtualBox_SOURCES.win += \
116 src/win32/VirtualBox.rc
117
118VirtualBox_SOURCES.win += \
119 src/VBoxFBDDRAW.cpp
120
121ifdef XKEYBOARD_NEW
122VirtualBox_SOURCES.linux = \
123 src/linux/XKeyboardNew.cpp
124else
125VirtualBox_SOURCES.linux = \
126 src/linux/XKeyboard.cpp \
127 src/linux/keyboard.c
128endif
129
130VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
131VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
132VirtualBox_DEFS.win = UNICODE QT_DLL
133ifeq ($(BUILD_TYPE),release)
134 VirtualBox_DEFS.win += VBOX_GUI_USE_QIMAGE
135 VirtualBox_DEFS.linux += VBOX_GUI_USE_SDL
136 VirtualBox_DEFS.darwin += VBOX_GUI_USE_SDL
137else
138 VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
139 VirtualBox_DEFS.win += \
140 VBOX_GUI_USE_REFRESH_TIMER \
141 VBOX_GUI_USE_QIMAGE \
142 VBOX_GUI_USE_DDRAW
143 VirtualBox_DEFS.linux += \
144 VBOX_GUI_USE_REFRESH_TIMER \
145 VBOX_GUI_USE_QIMAGE \
146 VBOX_GUI_USE_SDL
147 VirtualBox_DEFS.darwin += \
148 VBOX_GUI_USE_REFRESH_TIMER \
149 VBOX_GUI_USE_QIMAGE \
150 VBOX_GUI_USE_SDL
151endif
152ifdef VBOX_WITH_ALSA
153 VirtualBox_DEFS += VBOX_WITH_ALSA
154endif
155ifdef VBOX_OSE
156 VirtualBox_DEFS += VBOX_OSE
157endif
158
159VirtualBox_INCS = \
160 ./include \
161 $(PATH_VirtualBox)/ui \
162 $(PATH_VirtualBox)/moc \
163 $(PATH_VirtualBox)/include \
164
165
166ifeq ($(BUILD_TYPE),release)
167 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
168else
169 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
170 ifeq ($(USERNAME),dmik)
171 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
172 else
173 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
174 endif
175endif
176VirtualBox_LIBS.win = \
177 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
178 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
179 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
180
181ifdef VBOX_WITH_DEBUGGER_GUI
182 ifeq ($(BUILD_TARGET),win)
183 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
184 else
185 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
186 endif
187endif
188
189WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
190WRAPPERSINCFILE = include/COMDefs.h
191WRAPPERSTEMPLATE = include/COMWrappers.xsl
192XIDLFILE = ../../Main/idl/VirtualBox.xidl
193
194
195# generated files we need to clean manually
196OTHER_CLEAN = \
197 $(VirtualBox_GENSRCS) \
198 $(VirtualBox_GENHDRS) \
199 $(PATH_VirtualBox)/ui/vbox_image_collection.txt \
200 $(WRAPPERSFILE)
201
202
203#
204# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
205#
206VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
207VirtualBox.app_SOURCES = \
208 src/darwin/PkgInfo \
209 $(PATH_TARGET)/Info.plist \
210 images/ico64x01.icns=>Resources/VirtualBox.icns
211
212$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
213 $(call MSG_L1,Generating $@)
214 $(xQUIET)$(RM) -f $@
215 $(xQUIET)$(SED) \
216 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
217 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
218 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
219 $< > $@
220
221
222include $(PATH_KBUILD)/footer.kmk
223
224
225#
226# Source file generation rules
227#
228
229## Generate a rule to create a MOC source file from a header containing
230# classes that use the Q_OBJECT macro.
231# @param $mochdr the header file with Q_OBJECT
232define def_qt_gen_src_moc
233$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
234$$(mocsrc): $(mochdr)
235 $$(call MSG_L1,moc $(mochdr),=> $$@)
236 $$(QUIET)$(MKDIR) -p $$(@D)
237 $$(QUIET)$(VBOX_MOC) $(mochdr) -o $(mocsrc)
238
239endef
240
241## Generate a rule to create a MOC include file from a source containing
242# local classes that use the Q_OBJECT macro. This include is then included
243# by that source, so it must be generated before the source gets compiled.
244# @param $mocsrc the source file with Q_OBJECT
245define def_qt_gen_inc_moc
246$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(SUFF_OBJ))
247$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
248
249$$(mocobj): $(mocinc)
250
251.NOTPARALLEL: $$(mocinc)
252$$(mocinc): $(mocsrc)
253 $$(call MSG_L1,moc $(mocsrc),=> $$@)
254 $$(QUIET)$(MKDIR) -p $$(@D)
255 $$(QUIET)$(VBOX_MOC) -i $(mocsrc) -o $(mocinc)
256
257endef
258
259## Generate a rule to create a MOC include file from a UI header (ui.h) containing
260# local classes that use the Q_OBJECT macro. This include is then included
261# by that header, so it must be generated before the UI source gets compiled.
262# @param $mocuihdr the UI header file with Q_OBJECT
263define def_qt_gen_inc_mocuihdr
264$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
265$(eval uiobj := $(PATH_$(target)_$(uisrc))/$(notdir $(basename $(uisrc)))$(SUFF_OBJ))
266$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
267
268.NOTPARALLEL: $$(mocuiinc)
269$$(uisrc): $(mocuiinc)
270$$(mocuiinc): $(mocuihdr)
271 $$(call MSG_L1,moc $(mocuihdr),=> $$@)
272 $$(QUIET)$(MKDIR) -p $$(@D)
273 $$(QUIET)$(VBOX_MOC) -i $(mocuihdr) -o $(mocuiinc)
274
275endef
276
277define def_qt_gen_src_ui
278$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
279$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
280$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
281
282.NOTPARALLEL: $$(uihdr)
283$$(uihdr): $(uifile) | $(call DIRDEP,$(dir $(uihdr)))
284 $$(call MSG_L1,uic $(uifile),=> $$@)
285 $$(QUIET)$(VBOX_UIC) $(uifile) -o $(uihdr)
286
287$$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $(call DIRDEP,$(dir $(uisrc)))
288 $$(call MSG_L1,uic $(uifile),=> $$@)
289 $$(QUIET)$(VBOX_UIC) $(uifile) -i $(uihdr) -o $(uisrc)
290
291$$(mocsrc): $(uihdr) | $(call DIRDEP,$(dir $(mocsrc)))
292 $$(call MSG_L1,moc $(uihdr),=> $$@)
293 $$(QUIET)$(VBOX_MOC) $(uihdr) -o $(mocsrc)
294
295endef
296
297## Generate rules for generating the Qt source for a target.
298# @param $target Target name.
299define def_qt_gen_src
300# moc srcs from hdrs with Q_OBJECT
301$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
302# moc includes from srcs with Q_OBJECT
303$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
304# moc includes from UI headers with Q_OBJECT
305$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
306# ui
307$(foreach uifile,$($(target)_QT_UISRCS) ,$(eval $(def_qt_gen_src_ui)))
308# dirs
309$(call DIRDEP,$(PATH_$(target))/ui/) $(call DIRDEP,$(PATH_$(target))/moc/):
310 $$(call MSG_L2,Creating directory $$@)
311 $$(QUIET)$(MKDIR) -p $$@
312
313endef
314
315# Generate Qt sources.
316$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
317
318
319# Generate COM Wrappers
320.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
321
322$(WRAPPERSINCFILE): $(WRAPPERSFILE)
323
324$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
325 $(call MSG_L1,xsltproc $<,=> $@)
326 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
327
328$(call DIRDEP,$(PATH_VirtualBox)/include/):
329 $(call MSG_L2,Creating directory $@)
330 $(QUIET)$(MKDIR) -p $@
331
332# this is actually necessary only for Win32 target with disabled dependencies
333define def_wrapper_deps
334$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
335endef
336
337$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
338
339# static images are imported from VBoxUI.pro as IMAGES
340
341$(PATH_VirtualBox)/ui/vbox_image_collection.txt: Makefile VBoxUI.pro $(IMAGES)
342 @echo " \
343 $(IMAGES) \
344 " > $@
345
346$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
347 $(call MSG_L1,uic $<,=> $@)
348 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
349
350
351#
352# Translation stuff
353#
354
355VirtualBox_TRANSLATIONS = \
356 nls/VirtualBox_de.ts
357
358updatenls:
359 $(VBOX_LUPDATE) $(VirtualBox_SOURCES) $(VirtualBox_QT_MOCHDRS) $(VirtualBox_GENHDRS) -ts $(VirtualBox_TRANSLATIONS)
360
361
362#
363# Hand made dependencies go here
364#
365$(PATH_VirtualBox)/gen/ui/VBoxNewVMWzd$(SUFF_OBJ): $(PATH_VirtualBox)/ui/VBoxNewVMWzd.h $(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.h
366$(PATH_VirtualBox)/gen/ui/VBoxDiskImageManagerDlg$(SUFF_OBJ): ui/VBoxDiskImageManagerDlg.ui $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
367$(PATH_VirtualBox)/gen/ui/VBoxCloseVMDlg$(SUFF_OBJ): $(PATH_VirtualBox)/ui/VBoxCloseVMDlg.h
368
369
370test:
371 echo $(VirtualBox_GENSRCS) | sed -e "s/ /\n/g"
372
373testwrappers: $(WRAPPERSFILE)
374
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