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