VirtualBox

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

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

Fixed keyboard handling in Linux. Set XKEYBOARD_NEW=1 in LocalConfig.kmk to activate it

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette