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 | ifeq ($(BUILD_TARGET),linux)
|
---|
22 | XKEYBOARD_NEW := 1
|
---|
23 | endif
|
---|
24 |
|
---|
25 | # include qmake project file
|
---|
26 | include VBoxUI.pro
|
---|
27 |
|
---|
28 | # QDesigner UI sources
|
---|
29 | VirtualBox_QT_UISRCS := $(FORMS)
|
---|
30 |
|
---|
31 | # reset things to avoid possible conflicts with kBuild
|
---|
32 | TEMPLATE :=
|
---|
33 | LANGUAGE :=
|
---|
34 | FORMS :=
|
---|
35 |
|
---|
36 |
|
---|
37 | DEPTH = ../../../..
|
---|
38 | include $(PATH_KBUILD)/header.kmk
|
---|
39 |
|
---|
40 | PROGRAMS = VirtualBox
|
---|
41 |
|
---|
42 | INSTALLS.darwin = VirtualBox.app
|
---|
43 |
|
---|
44 |
|
---|
45 | VirtualBox_TEMPLATE = VBOXQTGUIEXE
|
---|
46 | VirtualBox_SDKS.win = WINPSDK DXSDK
|
---|
47 | VirtualBox_SDKS.linux = LIBSDL
|
---|
48 | VirtualBox_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
|
---|
59 | VirtualBox_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
|
---|
75 | ifneq ($(BUILD_TARGET),win)
|
---|
76 | VirtualBox_QT_MOCSRCS = src/COMDefs.cpp
|
---|
77 | endif
|
---|
78 |
|
---|
79 | # UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
|
---|
80 | VirtualBox_QT_MOCUIHDRS = \
|
---|
81 | ui/VBoxVMSettingsDlg.ui.h \
|
---|
82 | ui/VBoxSharedFoldersSettings.ui.h
|
---|
83 |
|
---|
84 | VirtualBox_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 |
|
---|
89 | VirtualBox_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 |
|
---|
95 | VirtualBox_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 |
|
---|
115 | VirtualBox_SOURCES.win += \
|
---|
116 | src/win32/VirtualBox.rc
|
---|
117 |
|
---|
118 | VirtualBox_SOURCES.win += \
|
---|
119 | src/VBoxFBDDRAW.cpp
|
---|
120 |
|
---|
121 | ifdef XKEYBOARD_NEW
|
---|
122 | VirtualBox_SOURCES.linux = \
|
---|
123 | src/linux/XKeyboardNew.cpp
|
---|
124 | else
|
---|
125 | VirtualBox_SOURCES.linux = \
|
---|
126 | src/linux/XKeyboard.cpp \
|
---|
127 | src/linux/keyboard.c
|
---|
128 | endif
|
---|
129 |
|
---|
130 | VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
|
---|
131 | VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
|
---|
132 | VirtualBox_DEFS.win = UNICODE QT_DLL
|
---|
133 | ifeq ($(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
|
---|
137 | else
|
---|
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
|
---|
151 | endif
|
---|
152 | ifdef VBOX_WITH_ALSA
|
---|
153 | VirtualBox_DEFS += VBOX_WITH_ALSA
|
---|
154 | endif
|
---|
155 | ifdef VBOX_OSE
|
---|
156 | VirtualBox_DEFS += VBOX_OSE
|
---|
157 | endif
|
---|
158 |
|
---|
159 | VirtualBox_INCS = \
|
---|
160 | ./include \
|
---|
161 | $(PATH_VirtualBox)/ui \
|
---|
162 | $(PATH_VirtualBox)/moc \
|
---|
163 | $(PATH_VirtualBox)/include \
|
---|
164 |
|
---|
165 |
|
---|
166 | ifeq ($(BUILD_TYPE),release)
|
---|
167 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
|
---|
168 | else
|
---|
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
|
---|
175 | endif
|
---|
176 | VirtualBox_LIBS.win = \
|
---|
177 | $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
|
---|
178 | $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
|
---|
179 | $(PATH_SDK_DXSDK_LIB)/dxguid.lib
|
---|
180 |
|
---|
181 | ifdef 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
|
---|
187 | endif
|
---|
188 |
|
---|
189 | WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
|
---|
190 | WRAPPERSINCFILE = include/COMDefs.h
|
---|
191 | WRAPPERSTEMPLATE = include/COMWrappers.xsl
|
---|
192 | XIDLFILE = ../../Main/idl/VirtualBox.xidl
|
---|
193 |
|
---|
194 |
|
---|
195 | # generated files we need to clean manually
|
---|
196 | OTHER_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 | #
|
---|
206 | VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
|
---|
207 | VirtualBox.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 |
|
---|
222 | include $(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
|
---|
232 | define 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 |
|
---|
239 | endef
|
---|
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
|
---|
245 | define 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 |
|
---|
257 | endef
|
---|
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
|
---|
263 | define 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 |
|
---|
275 | endef
|
---|
276 |
|
---|
277 | define 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 |
|
---|
295 | endef
|
---|
296 |
|
---|
297 | ## Generate rules for generating the Qt source for a target.
|
---|
298 | # @param $target Target name.
|
---|
299 | define 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 |
|
---|
313 | endef
|
---|
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
|
---|
333 | define def_wrapper_deps
|
---|
334 | $(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
|
---|
335 | endef
|
---|
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 |
|
---|
355 | VirtualBox_TRANSLATIONS = \
|
---|
356 | nls/VirtualBox_de.ts
|
---|
357 |
|
---|
358 | updatenls:
|
---|
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 |
|
---|
370 | test:
|
---|
371 | echo $(VirtualBox_GENSRCS) | sed -e "s/ /\n/g"
|
---|
372 |
|
---|
373 | testwrappers: $(WRAPPERSFILE)
|
---|
374 |
|
---|