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