VirtualBox

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

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

-Wno-extra is not available on gcc-3

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.3 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# Import QDesigner UI sources
29VirtualBox_QT_UISRCS := $(FORMS)
30# Import translation sources
31VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
32# Import images
33VirtualBox_QT_IMAGES := $(IMAGES)
34
35# reset things to avoid possible conflicts with kBuild
36TEMPLATE :=
37LANGUAGE :=
38FORMS :=
39TRANSLATIONS :=
40IMAGES :=
41
42DEPTH = ../../../..
43include $(PATH_KBUILD)/header.kmk
44
45PROGRAMS = VirtualBox
46
47INSTALLS = VirtualBox.nls
48INSTALLS.darwin = VirtualBox.app
49
50VirtualBox_TEMPLATE = VBOXQTGUIEXE
51VirtualBox_SDKS.win = WINPSDK DXSDK
52VirtualBox_SDKS.linux = LIBSDL
53
54# QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
55
56# Headers containing definitions of classes that use the Q_OBJECT macro
57VirtualBox_QT_MOCHDRS = \
58 include/QIWidgetValidator.h \
59 include/QIHotKeyEdit.h \
60 include/QIStatusBar.h \
61 include/QIStateIndicator.h \
62 include/QIMessageBox.h \
63 include/QIRichLabel.h \
64 include/VMGlobalSettings.h \
65 include/VBoxGlobal.h \
66 include/VBoxVMListBox.h \
67 include/VBoxMediaComboBox.h \
68 include/VBoxSelectorWnd.h \
69 include/VBoxConsoleWnd.h \
70 include/VBoxConsoleView.h \
71 include/VBoxProblemReporter.h
72
73# Sources containing local definitions of classes that use the Q_OBJECT macro
74VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
75ifneq ($(BUILD_TARGET),win)
76VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
77endif
78
79# UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
80VirtualBox_QT_MOCUIHDRS = \
81 ui/VBoxVMSettingsDlg.ui.h \
82 ui/VBoxSharedFoldersSettings.ui.h
83ifeq ($(BUILD_TARGET),win)
84VirtualBox_QT_MOCUIHDRS += ui/VBoxVMNetworkSettings.ui.h
85endif
86
87
88# All generated sources. Note: this list MUST be in sync with Qt source
89# generation rules defined somewhere below!
90VirtualBox_GENSRCS = \
91 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
92 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
93 $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
94
95# All generated headers. Note: this list MUST be in sync with Qt source
96# generation rules defined somewhere below!
97VirtualBox_GENHDRS = \
98 $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
99 $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
100 $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
101
102# All existing .ui.h files for known .ui sources
103VirtualBox_QT_UIHDRS = \
104 $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
105
106# All header files
107VirtualBox_HEADERS = \
108 $(wildcard include/*.h) \
109 $(VirtualBox_GENHDRS) \
110 $(VirtualBox_QT_UIHDRS)
111
112
113VirtualBox_SOURCES = \
114 $(VirtualBox_GENSRCS) \
115 src/main.cpp \
116 src/COMDefs.cpp \
117 src/QIWidgetValidator.cpp \
118 src/QIHotKeyEdit.cpp \
119 src/QIStateIndicator.cpp \
120 src/QIStatusBar.cpp \
121 src/QIMessageBox.cpp \
122 src/QIRichLabel.cpp \
123 src/VMGlobalSettings.cpp \
124 src/VBoxGlobal.cpp \
125 src/VBoxMediaComboBox.cpp \
126 src/VBoxProblemReporter.cpp \
127 src/VBoxSelectorWnd.cpp \
128 src/VBoxConsoleView.cpp \
129 src/VBoxConsoleWnd.cpp \
130 src/VBoxVMListBox.cpp \
131 src/VBoxFrameBuffer.cpp
132
133VirtualBox_SOURCES.win += \
134 src/win32/VirtualBox.rc
135
136VirtualBox_SOURCES.win += \
137 src/VBoxFBDDRAW.cpp
138
139ifdef XKEYBOARD_NEW
140VirtualBox_SOURCES.linux = \
141 src/linux/XKeyboardNew.cpp
142else
143VirtualBox_SOURCES.linux = \
144 src/linux/XKeyboard.cpp \
145 src/linux/keyboard.c
146endif
147
148VirtualBox_SOURCES.darwin = \
149 src/darwin/DarwinKeyboard.cpp \
150 src/darwin/DarwinCursor.cpp
151
152## @todo how to detect what tool is used?
153## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
154# more generic -Wno-extra
155ifneq ($(BUILD_TARGET),win)
156src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
157endif
158
159VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
160VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
161VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE
162VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
163VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
164#ifndef VBOX_OSE
165 VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
166#endif
167ifneq ($(BUILD_TYPE),release)
168 # non-release builds has some extra features.
169 VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER VBOX_WITH_DEBUGGER_GUI_MENU
170 VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
171 VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
172endif
173ifdef VBOX_WITH_ALSA
174 VirtualBox_DEFS += VBOX_WITH_ALSA
175endif
176ifdef VBOX_OSE
177 VirtualBox_DEFS += VBOX_OSE
178endif
179
180VirtualBox_INCS = \
181 ./include \
182 $(PATH_VirtualBox)/ui \
183 $(PATH_VirtualBox)/moc \
184 $(PATH_VirtualBox)/include \
185
186
187ifeq ($(BUILD_TYPE),release)
188 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
189else
190 VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
191 ifeq ($(USERNAME),dmik)
192 VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
193 else
194 VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
195 endif
196endif
197VirtualBox_LDFLAGS.darwin = -framework IOKit
198VirtualBox_LIBS.win = \
199 $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
200 $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
201 $(PATH_SDK_DXSDK_LIB)/dxguid.lib
202
203ifdef VBOX_WITH_DEBUGGER_GUI
204 ifeq ($(BUILD_TARGET),win)
205 VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
206 else
207 VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
208 endif
209endif
210
211WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
212WRAPPERSINCFILE = include/COMDefs.h
213WRAPPERSTEMPLATE = include/COMWrappers.xsl
214XIDLFILE = ../../Main/idl/VirtualBox.xidl
215
216
217# generated files we need to clean manually
218OTHER_CLEAN = \
219 $(VirtualBox_GENSRCS) \
220 $(VirtualBox_GENHDRS) \
221 $(WRAPPERSFILE)
222
223
224#
225# On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
226#
227VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
228VirtualBox.app_MODE = 644
229VirtualBox.app_SOURCES = \
230 src/darwin/PkgInfo \
231 $(PATH_TARGET)/Info.plist \
232 images/VirtualBox.icns=>Resources/virtualbox.icns
233
234$(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
235 $(call MSG_L1,Generating $@)
236 $(xQUIET)$(RM) -f $@
237 $(xQUIET)$(SED) \
238 -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
239 -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
240 -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
241 -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
242 $< > $@
243
244#
245# Translation installation
246#
247
248VirtualBox.nls_INST = $(INST_BIN)nls/
249VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
250VirtualBox.nls_MODE = 644
251
252
253
254# Commit the magic.
255# (note: before custom rules that make usage of generated variables!).
256include $(PATH_KBUILD)/footer.kmk
257
258
259
260#
261# Qt source file generation rules
262#
263
264## @todo move QT source generation macros to kBuild
265
266## Generate a rule to create a MOC source file from a header containing
267# classes that use the Q_OBJECT macro.
268# @param $mochdr header file with Q_OBJECT
269define def_qt_gen_src_moc
270
271$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
272
273$(target)_GENSRCS_REAL += $(mocsrc)
274
275$(mocsrc): $(mochdr)
276 $$(call MSG_L1,moc $(mochdr),=> $$@)
277 $$(QUIET)$$(MKDIR) -p $$(@D)
278 $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
279
280endef
281
282## Generate a rule to create a MOC include file from a source containing
283# local classes that use the Q_OBJECT macro. This include is then included
284# by that source, so it must be generated before the source gets compiled.
285# @param $mocsrc source file with Q_OBJECT
286define def_qt_gen_inc_moc
287
288$(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(SUFF_OBJ))
289$(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
290
291$(target)_GENHDRS_REAL += $(mocinc)
292
293$(mocobj): $(mocinc)
294
295.NOTPARALLEL: $(mocinc)
296$(mocinc): $(mocsrc)
297 $$(call MSG_L1,moc $(mocsrc),=> $$@)
298 $$(QUIET)$$(MKDIR) -p $$(@D)
299 $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
300
301endef
302
303## Generate a rule to create a MOC include file from a UI header (ui.h) containing
304# local classes that use the Q_OBJECT macro. This include is then included
305# by that header, so it must be generated before the UI source gets compiled.
306# @param $mocuihdr UI header file with Q_OBJECT
307define def_qt_gen_inc_mocuihdr
308
309$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
310$(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(SUFF_OBJ))
311$(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
312
313$(target)_GENHDRS_REAL += $(mocuiinc)
314
315.NOTPARALLEL: $(mocuiinc)
316$(uisrc): $(mocuiinc)
317$(mocuiinc): $(mocuihdr)
318 $$(call MSG_L1,moc $(mocuihdr),=> $$@)
319 $$(QUIET)$$(MKDIR) -p $$(@D)
320 $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
321
322endef
323
324## Generate a rule to create a header and source files from an UI
325# definition source (.ui).
326# @param $uifile UI definintion source file
327define def_qt_gen_src_ui
328
329$(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
330$(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
331$(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
332
333$(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
334$(target)_GENHDRS_REAL += $(uihdr)
335
336.NOTPARALLEL: $(uihdr)
337$(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
338 $$(call MSG_L1,uic $(uifile),=> $$@)
339 $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
340
341$(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
342 $$(call MSG_L1,uic $(uifile),=> $$@)
343 $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
344
345$(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
346 $$(call MSG_L1,moc $(uihdr),=> $$@)
347 $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
348
349endef
350
351## Generate a rule to create a .qm file from a NLS translation
352# source (.ts).
353# @param $tsfile Translation source file
354define def_qt_gen_nls
355
356$(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
357
358OTHER_CLEAN += $(qmfile)
359
360$(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
361 $$(call MSG_L1,lrelease $(tsfile),=> $$@)
362 $$(QUIET)$$(VBOX_LRELEASE) $(tsfile) -qm $$@
363
364endef
365
366## Generate rules for generating the Qt source for a target.
367# @param $target Target name.
368define def_qt_gen_src
369
370# moc srcs from hdrs with Q_OBJECT
371$(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
372# moc includes from srcs with Q_OBJECT
373$(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
374# moc includes from UI headers with Q_OBJECT
375$(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
376# UI sources
377$(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
378# NLS files
379$(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
380# dirs
381$$(call DIRDEP,$(PATH_$(target))/ui/) \
382$$(call DIRDEP,$(PATH_$(target))/moc/) \
383$$(call DIRDEP,$(PATH_$(target))/nls/):
384 $$(call MSG_L2,Creating directory $$@)
385 $$(QUIET)$$(MKDIR) -p $$@
386
387endef
388
389# Generate Qt source rules.
390$(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
391
392
393# Generate COM Wrappers
394.NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
395
396$(WRAPPERSINCFILE): $(WRAPPERSFILE)
397
398$(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
399 $(call MSG_L1,xsltproc $<,=> $@)
400 $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
401
402$(call DIRDEP,$(PATH_VirtualBox)/include/):
403 $(call MSG_L2,Creating directory $@)
404 $(QUIET)$(MKDIR) -p $@
405
406# this is actually necessary only for Win32 target with disabled dependencies
407define def_wrapper_deps
408$(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
409endef
410
411$(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
412
413# static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
414
415$(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
416 @echo " \
417 $(VirtualBox_QT_IMAGES) \
418 " > $@
419
420$(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
421 $(call MSG_L1,uic $<,=> $@)
422 $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
423
424VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
425OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
426
427
428#
429# Hand made dependencies go here.
430# Basically, here are dependencies for generated UI source files that
431# include generated headers in turn.
432#
433
434$(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
435 $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
436
437# Make all generated UI sources dependent on all generated headers (since they
438# may include them). This is safer than indifidual dependencies above but
439# currently disabled, because will cause all UI sources to be rebuilt one a
440# single one changes.
441#$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
442
443
444#
445# Custom targets
446#
447
448# Update all known NLS translation (.ts) files in the nls/ subdirectory.
449# NOTE: This target is intened to be run only by the GUI maintainer shortly
450# before a new product release. VirtualBox_xx_YY.ts is a template for new
451# languages and should never be actually translated or installed.
452updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
453 $(call MSG_L1,lupdate all languages (nls/*.ts))
454 $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
455
456
457#
458# Test targets
459#
460
461test:
462 @echo ====================
463 @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
464 @echo --------------------
465 @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
466 @echo ====================
467 @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
468 @echo --------------------
469 @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
470 @echo ====================
471
472test2:
473 @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
474
475test3:
476 @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
477
478testwrappers: $(WRAPPERSFILE)
479
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