VirtualBox

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

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

1848: Add comment field
Issue resolved as designed

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