VirtualBox

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

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

export to OSE again

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