VirtualBox

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

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

Use VBOX_VERSION_STRING when possible.

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