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