VirtualBox

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

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

Darwin app bundle.

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