1 | # $Id: Makefile.kmk 4398 2007-08-28 09:44:44Z vboxsync $
|
---|
2 | ## @file
|
---|
3 | # Makefile for the VirtualBox Qt GUI.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | #
|
---|
9 | # This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | # available from http://www.virtualbox.org. This file is free software;
|
---|
11 | # you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | # General Public License as published by the Free Software Foundation,
|
---|
13 | # in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | # distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | # be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 |
|
---|
17 | # include qmake project file
|
---|
18 | include VBoxUI.pro
|
---|
19 |
|
---|
20 | # Import QDesigner UI sources
|
---|
21 | VirtualBox_QT_UISRCS := $(FORMS)
|
---|
22 | # Import translation sources
|
---|
23 | VirtualBox_QT_TRANSLATIONS := $(TRANSLATIONS)
|
---|
24 | # Import images
|
---|
25 | VirtualBox_QT_IMAGES := $(IMAGES)
|
---|
26 |
|
---|
27 | # reset things to avoid possible conflicts with kBuild
|
---|
28 | TEMPLATE :=
|
---|
29 | LANGUAGE :=
|
---|
30 | FORMS :=
|
---|
31 | TRANSLATIONS :=
|
---|
32 | IMAGES :=
|
---|
33 |
|
---|
34 | DEPTH = ../../../..
|
---|
35 | include $(PATH_KBUILD)/header.kmk
|
---|
36 |
|
---|
37 | PROGRAMS = VirtualBox
|
---|
38 | DLLS.linux = VBoxKeyboard
|
---|
39 |
|
---|
40 | INSTALLS = VirtualBox.nls
|
---|
41 |
|
---|
42 | VBoxKeyboard_TEMPLATE = VBOXR3
|
---|
43 | VBoxKeyboard_SOURCES = \
|
---|
44 | src/linux/keyboard.c
|
---|
45 |
|
---|
46 | VirtualBox_TEMPLATE = VBOXQTGUIEXE
|
---|
47 | VirtualBox_SDKS.win = WINPSDK DXSDK
|
---|
48 | VirtualBox_SDKS.linux = LIBSDL
|
---|
49 | VirtualBox_SDKS.os2 = LIBSDL
|
---|
50 |
|
---|
51 | ifeq ($(BUILD_TARGET),darwin)
|
---|
52 | # For the launch trick we need different inode numbers.
|
---|
53 | VirtualBox_INST = $(INST_BIN)VirtualBox $(INST_BIN)VirtualBoxVM
|
---|
54 | endif
|
---|
55 |
|
---|
56 | # Each nls/VirtualBox_xx_YY.ts file must have a qt_xx_YY.ts counterpart
|
---|
57 | VirtualBox_QT_TRANSLATIONS_QT := \
|
---|
58 | $(patsubst nls/VirtualBox_%.ts,nls/qt_%.ts,\
|
---|
59 | $(filter nls/VirtualBox_%.ts,$(VirtualBox_QT_TRANSLATIONS)))
|
---|
60 |
|
---|
61 | # QDesigner UI sources are imported from VBoxUI.pro as VirtualBox_QT_UISRC
|
---|
62 |
|
---|
63 | # Headers containing definitions of classes that use the Q_OBJECT macro
|
---|
64 | VirtualBox_QT_MOCHDRS = \
|
---|
65 | include/QIWidgetValidator.h \
|
---|
66 | include/QIHotKeyEdit.h \
|
---|
67 | include/QIStatusBar.h \
|
---|
68 | include/QIStateIndicator.h \
|
---|
69 | include/QIMessageBox.h \
|
---|
70 | include/QIRichLabel.h \
|
---|
71 | include/VBoxGlobalSettings.h \
|
---|
72 | include/VBoxUtils.h \
|
---|
73 | include/VBoxGlobal.h \
|
---|
74 | include/VBoxVMListBox.h \
|
---|
75 | include/VBoxMediaComboBox.h \
|
---|
76 | include/VBoxSelectorWnd.h \
|
---|
77 | include/VBoxConsoleWnd.h \
|
---|
78 | include/VBoxConsoleView.h \
|
---|
79 | include/VBoxProblemReporter.h \
|
---|
80 | include/VBoxDownloaderWgt.h
|
---|
81 |
|
---|
82 | # Sources containing local definitions of classes that use the Q_OBJECT macro
|
---|
83 | VirtualBox_QT_MOCSRCS = src/VBoxSelectorWnd.cpp
|
---|
84 | ifdef VBOX_WITH_XPCOM
|
---|
85 | VirtualBox_QT_MOCSRCS += src/COMDefs.cpp
|
---|
86 | endif
|
---|
87 |
|
---|
88 | # UI headers (ui.h) containing local definitions of classes that use the Q_OBJECT macro
|
---|
89 | VirtualBox_QT_MOCUIHDRS = \
|
---|
90 | ui/VBoxVMSettingsDlg.ui.h \
|
---|
91 | ui/VBoxVMLogViewer.ui.h \
|
---|
92 | ui/VBoxSharedFoldersSettings.ui.h
|
---|
93 |
|
---|
94 |
|
---|
95 | # All generated sources. Note: this list MUST be in sync with Qt source
|
---|
96 | # generation rules defined somewhere below!
|
---|
97 | VirtualBox_GENSRCS = \
|
---|
98 | $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCHDRS))), $(PATH_VirtualBox)/moc/moc_$(moc).cpp) \
|
---|
99 | $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).cpp $(PATH_VirtualBox)/moc/moc_$(ui).cpp) \
|
---|
100 | $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
|
---|
101 |
|
---|
102 | # All generated headers. Note: this list MUST be in sync with Qt source
|
---|
103 | # generation rules defined somewhere below!
|
---|
104 | VirtualBox_GENHDRS = \
|
---|
105 | $(foreach mocui,$(notdir $(basename $(VirtualBox_QT_MOCUIHDRS))), $(PATH_VirtualBox)/moc/$(mocui).moc) \
|
---|
106 | $(foreach moc,$(notdir $(basename $(VirtualBox_QT_MOCSRCS))), $(PATH_VirtualBox)/moc/$(moc).moc) \
|
---|
107 | $(foreach ui,$(notdir $(basename $(VirtualBox_QT_UISRCS))), $(PATH_VirtualBox)/ui/$(ui).h)
|
---|
108 |
|
---|
109 | # All existing .ui.h files for known .ui sources
|
---|
110 | VirtualBox_QT_UIHDRS = \
|
---|
111 | $(wildcard $(addsuffix .h,$(VirtualBox_QT_UISRCS)))
|
---|
112 |
|
---|
113 | # All header files
|
---|
114 | VirtualBox_HEADERS = \
|
---|
115 | $(wildcard include/*.h) \
|
---|
116 | $(VirtualBox_GENHDRS) \
|
---|
117 | $(VirtualBox_QT_UIHDRS)
|
---|
118 |
|
---|
119 |
|
---|
120 | VirtualBox_SOURCES = \
|
---|
121 | $(VirtualBox_GENSRCS) \
|
---|
122 | src/main.cpp \
|
---|
123 | src/COMDefs.cpp \
|
---|
124 | src/QIWidgetValidator.cpp \
|
---|
125 | src/QIHotKeyEdit.cpp \
|
---|
126 | src/QIStateIndicator.cpp \
|
---|
127 | src/QIStatusBar.cpp \
|
---|
128 | src/QIMessageBox.cpp \
|
---|
129 | src/QIRichLabel.cpp \
|
---|
130 | src/VBoxDefs.cpp \
|
---|
131 | src/VBoxGlobalSettings.cpp \
|
---|
132 | src/VBoxGlobal.cpp \
|
---|
133 | src/VBoxMediaComboBox.cpp \
|
---|
134 | src/VBoxProblemReporter.cpp \
|
---|
135 | src/VBoxSelectorWnd.cpp \
|
---|
136 | src/VBoxConsoleView.cpp \
|
---|
137 | src/VBoxConsoleWnd.cpp \
|
---|
138 | src/VBoxDownloaderWgt.cpp \
|
---|
139 | src/VBoxVMListBox.cpp \
|
---|
140 | src/VBoxFrameBuffer.cpp
|
---|
141 |
|
---|
142 | VirtualBox_SOURCES.win += \
|
---|
143 | src/win32/VirtualBox.rc
|
---|
144 |
|
---|
145 | VirtualBox_SOURCES.win += \
|
---|
146 | src/VBoxFBDDRAW.cpp
|
---|
147 |
|
---|
148 | VirtualBox_SOURCES.linux = \
|
---|
149 | src/linux/XKeyboard.cpp
|
---|
150 |
|
---|
151 | VirtualBox_SOURCES.darwin = \
|
---|
152 | src/darwin/DarwinKeyboard.cpp \
|
---|
153 | src/darwin/DarwinCursor.cpp \
|
---|
154 | src/darwin/VBoxAquaStyle.cpp \
|
---|
155 | src/darwin/VBoxUtils-darwin.cpp
|
---|
156 |
|
---|
157 | ## @todo how to detect what tool is used?
|
---|
158 | ## @todo GCC3 seems to lack -Wno-missing-base-class-initializer, so we use
|
---|
159 | # more generic -Wno-extra
|
---|
160 | ifdef VBOX_WITH_XPCOM
|
---|
161 | src/COMDefs.cpp_CXXFLAGS = $(VBOX_GCC_Wno-extra)
|
---|
162 | endif
|
---|
163 |
|
---|
164 | VirtualBox_DEFS = VBOX_GUI_SEPARATE_VM_PROCESS
|
---|
165 | VirtualBox_DEFS.debug = VBOX_GUI_DEBUG VBOX_CHECK_STATE # QT_FATAL_ASSERT
|
---|
166 | VirtualBox_DEFS.darwin = VBOX_GUI_USE_QIMAGE VBOX_WITHOUT_QHTTP
|
---|
167 | VirtualBox_DEFS.linux = VBOX_GUI_USE_SDL
|
---|
168 | VirtualBox_DEFS.win = VBOX_GUI_USE_QIMAGE UNICODE QT_DLL
|
---|
169 | VirtualBox_DEFS.win.amd64 = VBOX_WITHOUT_QHTTP
|
---|
170 | VirtualBox_DEFS.os2 = VBOX_GUI_USE_QIMAGE VBOX_GUI_USE_SDL QT_DLL
|
---|
171 | #ifndef VBOX_OSE
|
---|
172 | VirtualBox_DEFS.darwin += VBOX_WITH_HACKED_QT
|
---|
173 | #endif
|
---|
174 | ifneq ($(BUILD_TYPE),release)
|
---|
175 | # non-release builds has some extra features.
|
---|
176 | VirtualBox_DEFS += VBOX_GUI_USE_REFRESH_TIMER
|
---|
177 | VirtualBox_DEFS.win += VBOX_GUI_USE_DDRAW
|
---|
178 | VirtualBox_DEFS.linux += VBOX_GUI_USE_QIMAGE
|
---|
179 | endif
|
---|
180 | ifdef VBOX_WITH_ALSA
|
---|
181 | VirtualBox_DEFS += VBOX_WITH_ALSA
|
---|
182 | endif
|
---|
183 | ifdef VBOX_OSE
|
---|
184 | VirtualBox_DEFS += VBOX_OSE
|
---|
185 | endif
|
---|
186 | ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
187 | VirtualBox_DEFS += VBOX_WITH_DEBUGGER_GUI_MENU
|
---|
188 | endif
|
---|
189 |
|
---|
190 | VirtualBox_INCS = \
|
---|
191 | ./include \
|
---|
192 | $(PATH_VirtualBox)/ui \
|
---|
193 | $(PATH_VirtualBox)/moc \
|
---|
194 | $(PATH_VirtualBox)/include \
|
---|
195 |
|
---|
196 |
|
---|
197 | ifeq ($(BUILD_TYPE),release)
|
---|
198 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
|
---|
199 | else
|
---|
200 | VirtualBox_LDFLAGS.linux+= -rdynamic # for backtrace_symbols()
|
---|
201 | ifeq ($(USERNAME),dmik)
|
---|
202 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:windows
|
---|
203 | else
|
---|
204 | VirtualBox_LDFLAGS.win += /SUBSYSTEM:console
|
---|
205 | endif
|
---|
206 | endif
|
---|
207 | VirtualBox_LDFLAGS.darwin = -framework IOKit
|
---|
208 | VirtualBox_LIBS.win = \
|
---|
209 | $(PATH_SDK_WINPSDK_LIB)/Htmlhelp.Lib \
|
---|
210 | $(PATH_SDK_DXSDK_LIB)/ddraw.lib \
|
---|
211 | $(PATH_SDK_DXSDK_LIB)/dxguid.lib
|
---|
212 | VirtualBox_LIBS.linux = $(PATH_DLL)/VBoxKeyboard$(VBOX_SUFF_DLL)
|
---|
213 |
|
---|
214 |
|
---|
215 | ifdef VBOX_WITH_DEBUGGER_GUI
|
---|
216 | ifeq ($(BUILD_TARGET),win)
|
---|
217 | VirtualBox_LIBS += $(PATH_LIB)/VBoxDbg$(VBOX_SUFF_LIB)
|
---|
218 | else
|
---|
219 | VirtualBox_LIBS += $(PATH_DLL)/VBoxDbg$(VBOX_SUFF_DLL)
|
---|
220 | endif
|
---|
221 | endif
|
---|
222 |
|
---|
223 | WRAPPERSFILE = $(PATH_VirtualBox)/include/COMWrappers.h
|
---|
224 | WRAPPERSINCFILE = include/COMDefs.h
|
---|
225 | WRAPPERSTEMPLATE = include/COMWrappers.xsl
|
---|
226 | XIDLFILE = ../../Main/idl/VirtualBox.xidl
|
---|
227 |
|
---|
228 |
|
---|
229 | # generated files we need to clean manually
|
---|
230 | OTHER_CLEAN = \
|
---|
231 | $(VirtualBox_GENSRCS) \
|
---|
232 | $(VirtualBox_GENHDRS) \
|
---|
233 | $(WRAPPERSFILE)
|
---|
234 |
|
---|
235 |
|
---|
236 | #
|
---|
237 | # On Mac OS X (darwin) we need to install icon resources and compusory bundle contents.
|
---|
238 | #
|
---|
239 | INSTALLS.darwin += VirtualBox.app
|
---|
240 | VirtualBox.app_INST = $(INST_VIRTUALBOX)Contents/
|
---|
241 | VirtualBox.app_MODE = 644
|
---|
242 | VirtualBox.app_SOURCES = \
|
---|
243 | src/darwin/PkgInfo \
|
---|
244 | $(PATH_TARGET)/Info.plist \
|
---|
245 | images/VirtualBox.icns=>Resources/virtualbox.icns
|
---|
246 |
|
---|
247 | $(PATH_TARGET)/Info.plist: src/darwin/Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
248 | $(call MSG_GENERATE,VirtualBox.app,$<,$@)
|
---|
249 | $(QUIET)$(RM) -f $@
|
---|
250 | $(QUIET)$(SED) \
|
---|
251 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
252 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
253 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
254 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
255 | $< > $@
|
---|
256 |
|
---|
257 | INSTALLS.darwin += VirtualBoxVM.app
|
---|
258 | VirtualBoxVM.app_INST = $(VirtualBox.app_INST)Resources/VirtualBoxVM.app/Contents/
|
---|
259 | VirtualBoxVM.app_MODE = 644
|
---|
260 | VirtualBoxVM.app_SOURCES = \
|
---|
261 | src/darwin/VM-PkgInfo=>PkgInfo \
|
---|
262 | $(PATH_TARGET)/VM-Info.plist=>Info.plist \
|
---|
263 | images/VirtualBox.icns=>Resources/virtualbox.icns
|
---|
264 | VirtualBoxVM.app_SYMLINKS = \
|
---|
265 | MacOS=>../../../MacOS/
|
---|
266 |
|
---|
267 | $(PATH_TARGET)/VM-Info.plist: src/darwin/VM-Info.plist $(VBOX_VERSION_MK) | $(call DIRDEP,$(PATH_TARGET))
|
---|
268 | $(call MSG_GENERATE,VirtualBoxVM.app,$<,$@)
|
---|
269 | $(QUIET)$(RM) -f $@
|
---|
270 | $(QUIET)$(SED) \
|
---|
271 | -e 's/@VBOX_VERSION_STRING@/$(VBOX_VERSION_STRING)/g' \
|
---|
272 | -e 's/@VBOX_VERSION_MAJOR@/$(VBOX_VERSION_MAJOR)/g' \
|
---|
273 | -e 's/@VBOX_VERSION_MINOR@/$(VBOX_VERSION_MINOR)/g' \
|
---|
274 | -e 's/@VBOX_VERSION_BUILD@/$(VBOX_VERSION_BUILD)/g' \
|
---|
275 | $< > $@
|
---|
276 |
|
---|
277 | #
|
---|
278 | # Translation installation
|
---|
279 | #
|
---|
280 |
|
---|
281 | VirtualBox.nls_INST = $(INST_BIN)nls/
|
---|
282 | VirtualBox.nls_SOURCES = $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS)))
|
---|
283 | VirtualBox.nls_SOURCES += $(patsubst %.ts,$(PATH_VirtualBox)/nls/%.qm,$(notdir $(VirtualBox_QT_TRANSLATIONS_QT)))
|
---|
284 | VirtualBox.nls_MODE = 644
|
---|
285 |
|
---|
286 |
|
---|
287 | #
|
---|
288 | # Testcase for the darwin keyboard routines.
|
---|
289 | #
|
---|
290 | ifdef VBOX_WITH_TESTCASES
|
---|
291 | PROGRAMS.darwin += tstDarwinKeyboard
|
---|
292 | tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
|
---|
293 | tstDarwinKeyboard_INCS = include
|
---|
294 | tstDarwinKeyboard_SOURCES = \
|
---|
295 | src/darwin/tstDarwinKeyboard.cpp \
|
---|
296 | src/darwin/DarwinKeyboard.cpp
|
---|
297 | tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon
|
---|
298 | tstDarwinKeyboard_LIBS = \
|
---|
299 | $(LIB_RUNTIME)
|
---|
300 | endif
|
---|
301 |
|
---|
302 |
|
---|
303 |
|
---|
304 | # Commit the magic.
|
---|
305 | # (note: before custom rules that make usage of generated variables!).
|
---|
306 | include $(PATH_KBUILD)/footer.kmk
|
---|
307 |
|
---|
308 |
|
---|
309 |
|
---|
310 | #
|
---|
311 | # Qt source file generation rules
|
---|
312 | #
|
---|
313 |
|
---|
314 | ## @todo move QT source generation macros to kBuild
|
---|
315 |
|
---|
316 | ## Generate a rule to create a MOC source file from a header containing
|
---|
317 | # classes that use the Q_OBJECT macro.
|
---|
318 | # @param $mochdr header file with Q_OBJECT
|
---|
319 | define def_qt_gen_src_moc
|
---|
320 |
|
---|
321 | $(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(mochdr))).cpp)
|
---|
322 |
|
---|
323 | $(target)_GENSRCS_REAL += $(mocsrc)
|
---|
324 |
|
---|
325 | $(mocsrc): $(mochdr)
|
---|
326 | $$(call MSG_TOOL,moc,$(target),$(mochdr),$$@)
|
---|
327 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
328 | $$(QUIET)$$(VBOX_MOC) $(mochdr) -o $$@
|
---|
329 |
|
---|
330 | endef
|
---|
331 |
|
---|
332 | ## Generate a rule to create a MOC include file from a source containing
|
---|
333 | # local classes that use the Q_OBJECT macro. This include is then included
|
---|
334 | # by that source, so it must be generated before the source gets compiled.
|
---|
335 | # @param $mocsrc source file with Q_OBJECT
|
---|
336 | define def_qt_gen_inc_moc
|
---|
337 |
|
---|
338 | $(eval mocobj := $(PATH_$(target)_$(mocsrc))/$(notdir $(basename $(mocsrc)))$(VBOX_SUFF_OBJ))
|
---|
339 | $(eval mocinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocsrc))).moc)
|
---|
340 |
|
---|
341 | $(target)_GENHDRS_REAL += $(mocinc)
|
---|
342 |
|
---|
343 | $(mocobj): $(mocinc)
|
---|
344 |
|
---|
345 | .NOTPARALLEL: $(mocinc)
|
---|
346 | $(mocinc): $(mocsrc)
|
---|
347 | $$(call MSG_TOOL,moc,$(target),$(mocsrc),$$@)
|
---|
348 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
349 | $$(QUIET)$$(VBOX_MOC) -i $(mocsrc) -o $$@
|
---|
350 |
|
---|
351 | endef
|
---|
352 |
|
---|
353 | ## Generate a rule to create a MOC include file from a UI header (ui.h) containing
|
---|
354 | # local classes that use the Q_OBJECT macro. This include is then included
|
---|
355 | # by that header, so it must be generated before the UI source gets compiled.
|
---|
356 | # @param $mocuihdr UI header file with Q_OBJECT
|
---|
357 | define def_qt_gen_inc_mocuihdr
|
---|
358 |
|
---|
359 | $(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(basename $(mocuihdr)))).cpp)
|
---|
360 | $(eval uiobj := $(PATH_$(target)_$$(uisrc))/$(notdir $(basename $$(uisrc)))$(VBOX_SUFF_OBJ))
|
---|
361 | $(eval mocuiinc := $(PATH_$(target))/moc/$(notdir $(basename $(mocuihdr))).moc)
|
---|
362 |
|
---|
363 | $(target)_GENHDRS_REAL += $(mocuiinc)
|
---|
364 |
|
---|
365 | .NOTPARALLEL: $(mocuiinc)
|
---|
366 | $(uisrc): $(mocuiinc)
|
---|
367 | $(mocuiinc): $(mocuihdr)
|
---|
368 | $$(call MSG_TOOL,moc,$(target),$(mocuihdr),$$@)
|
---|
369 | $$(QUIET)$$(MKDIR) -p $$(@D)
|
---|
370 | $$(QUIET)$$(VBOX_MOC) -i $(mocuihdr) -o $$@
|
---|
371 |
|
---|
372 | endef
|
---|
373 |
|
---|
374 | ## Generate a rule to create a header and source files from an UI
|
---|
375 | # definition source (.ui).
|
---|
376 | # @param $uifile UI definintion source file
|
---|
377 | define def_qt_gen_src_ui
|
---|
378 |
|
---|
379 | $(eval uisrc := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).cpp)
|
---|
380 | $(eval uihdr := $(PATH_$(target))/ui/$(notdir $(basename $(uifile))).h)
|
---|
381 | $(eval mocsrc := $(PATH_$(target))/moc/moc_$(notdir $(basename $(uifile))).cpp)
|
---|
382 |
|
---|
383 | $(target)_GENSRCS_REAL += $(uisrc) $(mocsrc)
|
---|
384 | $(target)_GENHDRS_REAL += $(uihdr)
|
---|
385 |
|
---|
386 | .NOTPARALLEL: $(uihdr)
|
---|
387 | $(uihdr): $(uifile) | $$(call DIRDEP,$(dir $(uihdr)))
|
---|
388 | $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
|
---|
389 | $$(QUIET)$$(VBOX_UIC) $(uifile) -o $$@
|
---|
390 |
|
---|
391 | $(uisrc): $(uihdr) $(uifile) $(wildcard $(uifile).h) | $$(call DIRDEP,$(dir $(uisrc)))
|
---|
392 | $$(call MSG_TOOL,uic,$(target),$(uifile),$$@)
|
---|
393 | $$(QUIET)$$(VBOX_UIC) $(uifile) -i $(uihdr) -o $$@
|
---|
394 |
|
---|
395 | $(mocsrc): $(uihdr) | $$(call DIRDEP,$(dir $(mocsrc)))
|
---|
396 | $$(call MSG_TOOL,moc,$(target),$(uihdr),$$@)
|
---|
397 | $$(QUIET)$$(VBOX_MOC) $(uihdr) -o $$@
|
---|
398 |
|
---|
399 | endef
|
---|
400 |
|
---|
401 | ## Generate a rule to create a .qm file from a NLS translation
|
---|
402 | # source (.ts).
|
---|
403 | # @param $tsfile Translation source file
|
---|
404 | define def_qt_gen_nls
|
---|
405 |
|
---|
406 | $(eval qmfile := $(PATH_$(target))/nls/$(notdir $(basename $(tsfile))).qm)
|
---|
407 |
|
---|
408 | OTHER_CLEAN += $(qmfile)
|
---|
409 |
|
---|
410 | # Note that we use -nocompress in lrelease to avoid stripping comments and
|
---|
411 | # other information from .qm files. If we don't do that, we get .qm files two
|
---|
412 | # times smaller, but QTranslator::findMessage() will start searching for
|
---|
413 | # translations in all existing contexts in case if it cannot find it in the
|
---|
414 | # original context (which is of course not acceptable, no matter if it's a
|
---|
415 | # special Qt "feature" or just a bug).
|
---|
416 |
|
---|
417 | $(qmfile): $(tsfile) | $$(call DIRDEP,$(dir $(qmfile)))
|
---|
418 | $$(call MSG_TOOLS,lrelease,$(target),$(tsfile),$$@)
|
---|
419 | $$(QUIET)$$(VBOX_LRELEASE) -nocompress $(tsfile) -qm $$@
|
---|
420 |
|
---|
421 | endef
|
---|
422 |
|
---|
423 | ## Generate rules for generating the Qt source for a target.
|
---|
424 | # @param $target Target name.
|
---|
425 | define def_qt_gen_src
|
---|
426 |
|
---|
427 | # moc srcs from hdrs with Q_OBJECT
|
---|
428 | $(foreach mochdr,$($(target)_QT_MOCHDRS),$(eval $(def_qt_gen_src_moc)))
|
---|
429 | # moc includes from srcs with Q_OBJECT
|
---|
430 | $(foreach mocsrc,$($(target)_QT_MOCSRCS),$(eval $(def_qt_gen_inc_moc)))
|
---|
431 | # moc includes from UI headers with Q_OBJECT
|
---|
432 | $(foreach mocuihdr,$($(target)_QT_MOCUIHDRS),$(eval $(def_qt_gen_inc_mocuihdr)))
|
---|
433 | # UI sources
|
---|
434 | $(foreach uifile,$($(target)_QT_UISRCS),$(eval $(def_qt_gen_src_ui)))
|
---|
435 | # NLS files
|
---|
436 | $(foreach tsfile,$($(target)_QT_TRANSLATIONS),$(eval $(def_qt_gen_nls)))
|
---|
437 | $(foreach tsfile,$($(target)_QT_TRANSLATIONS_QT),$(eval $(def_qt_gen_nls)))
|
---|
438 | # dirs
|
---|
439 | $$(call DIRDEP,$(PATH_$(target))/ui/) \
|
---|
440 | $$(call DIRDEP,$(PATH_$(target))/moc/) \
|
---|
441 | $$(call DIRDEP,$(PATH_$(target))/nls/):
|
---|
442 | $$(call MSG_MKDIR,$$@)
|
---|
443 | $$(QUIET)$$(MKDIR) -p $$@
|
---|
444 |
|
---|
445 | endef
|
---|
446 |
|
---|
447 | # Generate Qt source rules.
|
---|
448 | $(foreach target,VirtualBox,$(eval $(def_qt_gen_src)))
|
---|
449 |
|
---|
450 |
|
---|
451 | # Generate COM Wrappers
|
---|
452 | .NOTPARALLEL: $(WRAPPERSFILE) $(WRAPPERSINCFILE)
|
---|
453 |
|
---|
454 | $(WRAPPERSINCFILE): $(WRAPPERSFILE)
|
---|
455 |
|
---|
456 | $(WRAPPERSFILE): $(XIDLFILE) $(WRAPPERSTEMPLATE) | $(call DIRDEP,$(PATH_VirtualBox)/include/)
|
---|
457 | $(call MSG_TOOL,xsltproc,VirtualBox,$<,$@)
|
---|
458 | $(QUIET)$(VBOX_XSLTPROC) -o $@ $(WRAPPERSTEMPLATE) $<
|
---|
459 |
|
---|
460 | $(call DIRDEP,$(PATH_VirtualBox)/include/):
|
---|
461 | $(call MSG_MKDIR,$@)
|
---|
462 | $(QUIET)$(MKDIR) -p $@
|
---|
463 |
|
---|
464 | # this is actually necessary only for Win32 target with disabled dependencies
|
---|
465 | define def_wrapper_deps
|
---|
466 | $(src): $(WRAPPERSFILE) $(WRAPPERSINCFILE)
|
---|
467 | endef
|
---|
468 |
|
---|
469 | $(foreach src,$(VirtualBox_SOURCES),$(eval $(def_wrapper_deps)))
|
---|
470 |
|
---|
471 | # static images imported from VBoxUI.pro as VirtualBox_QT_IMAGES
|
---|
472 |
|
---|
473 | $(PATH_VirtualBox)/ui/vbox_image_collection.txt: VBoxUI.pro $(VirtualBox_QT_IMAGES)
|
---|
474 | @echo " \
|
---|
475 | $(VirtualBox_QT_IMAGES) \
|
---|
476 | " > $@
|
---|
477 |
|
---|
478 | $(PATH_VirtualBox)/ui/vbox_image_collection.cpp: $(PATH_VirtualBox)/ui/vbox_image_collection.txt
|
---|
479 | $(call MSG_TOOL,uic,VirtualBox,$<,$@)
|
---|
480 | $(QUIET)$(VBOX_UIC) -o $@ -embed VBoxGUI -f $<
|
---|
481 |
|
---|
482 | VirtualBox_GENSRCS += $(PATH_VirtualBox)/ui/vbox_image_collection.cpp
|
---|
483 | OTHER_CLEAN += $(PATH_VirtualBox)/ui/vbox_image_collection.txt
|
---|
484 |
|
---|
485 |
|
---|
486 | #
|
---|
487 | # Hand made dependencies go here.
|
---|
488 | # Basically, here are dependencies for generated UI source files that
|
---|
489 | # include generated headers in turn.
|
---|
490 | #
|
---|
491 |
|
---|
492 | $(PATH_VirtualBox)/ui/VBoxDiskImageManagerDlg.cpp: \
|
---|
493 | $(PATH_VirtualBox)/ui/VBoxNewHDWzd.h
|
---|
494 |
|
---|
495 | # Make all generated UI sources dependent on all generated headers (since they
|
---|
496 | # may include them). This is safer than indifidual dependencies above but
|
---|
497 | # currently disabled, because will cause all UI sources to be rebuilt one a
|
---|
498 | # single one changes.
|
---|
499 | #$(patsubst %,$(PATH_VirtualBox)/ui/%.cpp,$(notdir $(basename $(VirtualBox_QT_UISRCS)))) : $(VirtualBox_GENHDRS)
|
---|
500 |
|
---|
501 |
|
---|
502 | #
|
---|
503 | # Custom targets
|
---|
504 | #
|
---|
505 |
|
---|
506 | # Update all known NLS translation (.ts) files in the nls/ subdirectory.
|
---|
507 | # NOTE: This target is intened to be run only by the GUI maintainer shortly
|
---|
508 | # before a new product release. VirtualBox_xx_YY.ts is a template for new
|
---|
509 | # languages and should never be actually translated or installed.
|
---|
510 | updatenls: $(VirtualBox_SOURCES) $(VirtualBox_HEADERS)
|
---|
511 | $(call MSG_L1,lupdate all languages (nls/*.ts))
|
---|
512 | $(QUIET)$(VBOX_LUPDATE) $^ -ts $(VirtualBox_QT_TRANSLATIONS) nls/VirtualBox_xx_YY.ts
|
---|
513 |
|
---|
514 |
|
---|
515 | #
|
---|
516 | # Test targets
|
---|
517 | #
|
---|
518 |
|
---|
519 | test:
|
---|
520 | @echo ====================
|
---|
521 | @echo $(VirtualBox_GENSRCS) | $(SED) -e "s/ /\n/g"
|
---|
522 | @echo --------------------
|
---|
523 | @echo $(VirtualBox_GENSRCS_REAL) | $(SED) -e "s/ /\n/g"
|
---|
524 | @echo ====================
|
---|
525 | @echo $(VirtualBox_GENHDRS) | $(SED) -e "s/ /\n/g"
|
---|
526 | @echo --------------------
|
---|
527 | @echo $(VirtualBox_GENHDRS_REAL) | $(SED) -e "s/ /\n/g"
|
---|
528 | @echo ====================
|
---|
529 |
|
---|
530 | test2:
|
---|
531 | @echo $(OTHER_CLEAN) | $(SED) -e "s/ /\n/g"
|
---|
532 |
|
---|
533 | test3:
|
---|
534 | @echo $(VirtualBox_HEADERS) | $(SED) -e "s/ /\n/g"
|
---|
535 |
|
---|
536 | testwrappers: $(WRAPPERSFILE)
|
---|
537 |
|
---|