source: trunk/kBuild/units/qt4.kmk@ 2544

Last change on this file since 2544 was 2544, checked in by bird, 14 years ago

qt4.kmk,qt3.kmk: Probe for qt libs in the right places on multi-arch ubuntu.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 36.4 KB
Line 
1# $Id: qt4.kmk 2544 2011-09-13 19:00:25Z bird $
2## @file
3# Qt 4 unit.
4#
5
6#
7# Copyright (c) 2008-2010 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24#
25#
26# As a special exception you are granted permission to include this file, via
27# the kmk include directive, as you wish without this in itself causing the
28# resulting makefile, program or whatever to be covered by the GPL license.
29# This exception does not however invalidate any other reasons why the makefile,
30# program, whatever should not be covered the GPL.
31#
32#
33
34
35ifdef UNIT_qt4
36 $(error kBuild: The qt4 unit was included twice!)
37endif
38UNIT_qt4 = qt4
39
40
41ifndef UNIT_qt3
42 # Add our target properties (same as qt3).
43 PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
44 PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
45endif
46PROPS_SINGLE += RCCTOOL QT_INFIX
47PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
48
49
50## @todo use pkg-config?
51
52#
53# The QT4 SDK.
54#
55# This is implemented here rather than in sdks/QT4.kmk to enforce the global USES.
56# It also makes things easier to develop, with fewer files I mean.
57#
58## @todo the SDK might actually not be necessary as it turns out... For now it servers
59# a purpose if the host differs from the target, in theory at least.
60SDK_QT4 = Qt4
61
62# SDK Specific Properties
63# PATH_SDK_QT4 - The general Qt4 root directory.
64# PATH_SDK_QT4_INC - The include directory.
65# PATH_SDK_QT4_LIB.amd64 - The lib directory for AMD64.
66# PATH_SDK_QT4_LIB.x86 - The lib directory for X86.
67# PATH_SDK_QT4_LIB - The lib directory for KBUILD_TARGET.
68ifndef PATH_SDK_QT4
69 PATH_SDK_QT4 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
70 ifeq ($(PATH_SDK_QT4),)
71 # If target == host, try look for Qt in the various platform specific places.
72 ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
73 ifeq ($(KBUILD_TARGET),darwin)
74 PATH_SDK_QT4 := $(patsubst %/Frameworks/QtCore.framework/Versions/4,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/4)))
75 else ifeq ($(KBUILD_TARGET),win)
76 # No idea here yet...
77 else ifeq ($(KBUILD_TARGET),ose)
78 # No port...
79 else
80 # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT4_LIB* stuff if it doesn't work.
81 # Try find the general root of thing by looking for the qt3to4 program, if not found, then look for rcc.
82 PATH_SDK_QT4 := $(patsubst %/bin/qt3to4,%,$(firstword $(wildcard \
83 /usr/bin/qt3to4 \
84 /usr/local/bin/qt3to4 \
85 /usr/qt/4/bin/qt3to4 \
86 /usr/share/qt4/bin/qt3to4 \
87 )))
88 ifeq ($(PATH_SDK_QT4),)
89 PATH_SDK_QT4 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
90 /usr/bin/rcc \
91 /usr/local/bin/rcc \
92 /usr/qt/4/bin/rcc \
93 /usr/share/qt4/bin/rcc \
94 )))
95 endif
96 ifneq ($(PATH_SDK_QT4),)
97 export PATH_SDK_QT4
98
99 # Locate the include files.
100 ifeq ($(PATH_SDK_QT4_INC),)
101 PATH_SDK_QT4_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
102 $(PATH_SDK_QT4)/include/QtCore/qglobal.h \
103 $(PATH_SDK_QT4)/include/qt4/QtCore/qglobal.h \
104 /usr/include/qt4/QtCore/qtglobal.h \
105 /usr/local/include/qt4/QtCore/qtglobal.h \
106 )))
107 ifneq ($(PATH_SDK_QT4_INC),)
108 export PATH_SDK_QT4_INC
109 endif
110 endif
111
112 # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
113 ifeq ($(PATH_SDK_QT4_LIB.x86),)
114 PATH_SDK_QT4_LIB.x86 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
115 $(PATH_SDK_QT4)/lib32/libQtCore$(SUFF_DLL) \
116 $(PATH_SDK_QT4)/lib32/qt4/libQtCore$(SUFF_DLL) \
117 /usr/lib32/libQtCore$(SUFF_DLL) \
118 /usr/lib32/qt4/libQtCore$(SUFF_DLL) \
119 /usr/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
120 /usr/local/lib32/libQtCore$(SUFF_DLL) \
121 /usr/local/lib32/qt4/libQtCore$(SUFF_DLL) \
122 /usr/local/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
123 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
124 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
125 $(PATH_SDK_QT4)/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
126 )))
127 ifneq ($(PATH_SDK_QT4_LIB.x86),)
128 export PATH_SDK_QT4_LIB.x86
129 endif
130 endif
131 ifeq ($(PATH_SDK_QT4_LIB.amd64),)
132 PATH_SDK_QT4_LIB.amd64 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
133 $(PATH_SDK_QT4)/lib64/libQtCore$(SUFF_DLL) \
134 $(PATH_SDK_QT4)/lib64/qt4/libQtCore$(SUFF_DLL) \
135 $(PATH_SDK_QT4)/lib/amd64/libQtCore$(SUFF_DLL) \
136 /usr/lib64/libQtCore$(SUFF_DLL) \
137 /usr/lib64/qt4/libQtCore$(SUFF_DLL) \
138 /usr/lib/amd64/libQtCore$(SUFF_DLL) \
139 /usr/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
140 /usr/local/lib64/libQtCore$(SUFF_DLL) \
141 /usr/local/lib64/qt4/libQtCore$(SUFF_DLL) \
142 /usr/local/lib/amd64/libQtCore$(SUFF_DLL) \
143 /usr/local/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
144 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
145 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
146 $(PATH_SDK_QT4)/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
147 )))
148 ifneq ($(PATH_SDK_QT4_LIB.amd64),)
149 export PATH_SDK_QT4_LIB.amd64
150 endif
151 endif
152
153 # And finally, the library path for KBUILD_TARGET.
154 ifeq ($(PATH_SDK_QT4_LIB),)
155 PATH_SDK_QT4_LIB := $(PATH_SDK_QT4_LIB.$(KBUILD_TARGET_ARCH))
156 ifeq ($(PATH_SDK_QT4_LIB),)
157 PATH_SDK_QT4_LIB := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
158 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
159 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
160 /usr/lib/libQtCore$(SUFF_DLL) \
161 /usr/lib/qt4/libQtCore$(SUFF_DLL) \
162 /usr/local/lib/libQtCore$(SUFF_DLL) \
163 /usr/local/lib/qt4/libQtCore$(SUFF_DLL) \
164 )))
165 endif
166 ifneq ($(PATH_SDK_QT4_LIB),)
167 export PATH_SDK_QT4_LIB
168 endif
169 endif
170
171 endif
172 endif # Unices
173 endif
174 # Found it?
175 ifeq ($(PATH_SDK_QT4),)
176 $(warning kBuild: Couldn't find the Qt4 headers and libaries...)
177 PATH_SDK_QT4 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
178 endif
179 endif
180else
181 # Resolve any fancy stuff once and for all.
182 PATH_SDK_QT4 := $(PATH_SDK_QT4)
183endif
184
185# Libraries can be in either Frameworks or lib depending on how you
186# build it on the mac. The .dmg installs into Frameworks but builds into lib.
187ifeq ($(KBUILD_TARGET),darwin)
188 ifndef PATH_SDK_QT4_LIB
189 ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
190 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
191 else
192 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
193 endif
194 endif
195else
196 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
197 PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
198endif
199
200# The bits that kBuild picks up.
201# (nothing here)
202
203
204#
205# The QT4 tool.
206#
207# This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
208# It also makes things easier to develop, with fewer files I mean.
209#
210TOOL_QT4 = Qt4
211
212# Tool Specific Properties
213# PATH_TOOL_QT4 - Obsolete.
214# PATH_TOOL_QT4_BIN - The
215# TOOL_QT4_BIN_SUFF -
216if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
217 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
218endif
219ifndef PATH_TOOL_QT4_BIN
220 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v4*/bin)))
221 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
222 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v4*/bin)))
223 endif
224 ifeq ($(PATH_TOOL_QT4_BIN),)
225 ifdef TOOL_QT4_BIN_SUFF
226 TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
227 endif
228 # Try looking for moc-qt4 / moc-$(suffix) first.
229 ifneq ($(TOOL_QT4_BIN_SUFF),)
230 PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
231 /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
232 /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
233 /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
234 /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
235 /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
236 )))
237 else
238 PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
239 /usr/lib/qt4/bin/moc-qt4 \
240 /usr/qt/4/bin/moc-qt4 \
241 /usr/share/qt4/bin/moc-qt4 \
242 /usr/local/bin/moc-qt4 \
243 /usr/bin/moc-qt4 \
244 )))
245 ifneq ($(PATH_TOOL_QT4_BIN),)
246 TOOL_QT4_BIN_SUFF := -qt4
247 else
248 # If no luck, try looking for moc in the qt4 specific locations.
249 PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
250 /usr/lib/qt4/bin/moc \
251 /usr/qt/4/bin/moc \
252 /usr/share/qt4/bin/moc \
253 )))
254 endif
255 endif
256 # If still no go, try looking for qt3to4 and rcc.
257 ifeq ($(PATH_TOOL_QT4_BIN),)
258 PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
259 /usr/lib/qt4/bin/qt3to4 \
260 /usr/qt/4/bin/qt3to4 \
261 /usr/share/qt4/bin/qt3to4 \
262 /usr/local/bin/qt3to4 \
263 /usr/bin/qt3to4 \
264 )))
265 endif
266 ifeq ($(PATH_TOOL_QT4_BIN),)
267 PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
268 /usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
269 /usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
270 /usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
271 /usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
272 /usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
273 )))
274 endif
275 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
276 PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
277 /usr/lib/qt4/bin/rcc \
278 /usr/qt/4/bin/rcc \
279 /usr/share/qt4/bin/rcc \
280 /usr/local/bin/rcc \
281 /usr/bin/rcc \
282 )))
283 endif
284 ifneq ($(PATH_TOOL_QT4_BIN),)
285 export PATH_TOOL_QT4_BIN
286 endif
287 endif
288 # If not found, we'll enter the 'pathless' mode.
289else
290 # Resolve any fancy stuff once and for all.
291 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
292endif
293ifneq ($(PATH_TOOL_QT4_BIN),)
294 TOOL_QT4_MOC ?= $(PATH_TOOL_QT4_BIN)/moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
295 TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
296 ifndef TOOL_QT4_RCC
297 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
298 ifeq ($(wildcard $(TOOL_QT4_RCC)),)
299 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
300 endif
301 endif
302 TOOL_QT4_LRC ?= $(PATH_TOOL_QT4_BIN)/lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
303 TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
304else
305 # Pathless, relies on the environment.
306 TOOL_QT4_MOC ?= moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
307 TOOL_QT4_UIC ?= uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
308 TOOL_QT4_RCC ?= rcc$(HOST_SUFF_EXE)
309 TOOL_QT4_LRC ?= lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
310 TOOL_QT4_LUPDATE ?= lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
311endif
312
313# General Properties used by kBuild and/or units/qt.kmk
314TOOL_QT4_MOCFLAGS ?=
315TOOL_QT4_MOCINCS ?=
316TOOL_QT4_MOCDEFS ?=
317TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
318TOOL_QT4_MOCDEFS.solaris ?= __sun
319TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
320TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
321
322
323## MOC a C++ source file.
324# @param $(target) Normalized main target name.
325# @param $(source) Source filename (relative).
326# @param $(out) Object file name. This shall be (re)created by the compilation.
327# @param $(dep) Dependcy file. This may be (re)created by the compilation.
328# @param $(flags) Flags.
329# @param $(defs) Definitions.
330# @param $(incs) Includes.
331# @param $(outbase) Output basename (full). Use this for list files and such.
332#
333TOOL_QT4_MOC_CPP_DEPEND =
334TOOL_QT4_MOC_CPP_DEPORD =
335TOOL_QT4_MOC_CPP_OUTPUT =
336TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
337define TOOL_QT4_MOC_CPP_CMDS
338 $(QUIET)$(TOOL_QT4_MOC)\
339 $(flags)\
340 $(addprefix -I, $(incs))\
341 $(addprefix -D, $(defs))\
342 -o $(out)\
343 $(source)
344endef
345
346## MOC a C++ header file.
347# @param $(target) Normalized main target name.
348# @param $(source) Source filename (relative).
349# @param $(out) Object file name. This shall be (re)created by the compilation.
350# @param $(dep) Dependcy file. This may be (re)created by the compilation.
351# @param $(flags) Flags.
352# @param $(defs) Definitions.
353# @param $(incs) Includes.
354# @param $(outbase) Output basename (full). Use this for list files and such.
355#
356TOOL_QT4_MOC_HPP_DEPEND =
357TOOL_QT4_MOC_HPP_DEPORD =
358TOOL_QT4_MOC_HPP_OUTPUT =
359TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
360define TOOL_QT4_MOC_HPP_CMDS
361 $(QUIET)$(TOOL_QT4_MOC)\
362 $(flags)\
363 $(addprefix -I, $(incs))\
364 $(addprefix -D, $(defs))\
365 -o $(out)\
366 $(source)
367endef
368
369## Compile a Qt user interface file (.ui).
370# @param $(target) Normalized main target name.
371# @param $(source) Source filename (relative).
372# @param $(out) Object file name. This shall be (re)created by the compilation.
373# @param $(dep) Dependcy file. This may be (re)created by the compilation.
374# @param $(flags) Flags.
375# @param $(defs) Definitions.
376# @param $(incs) Includes.
377# @param $(outbase) Output basename (full). Use this for list files and such.
378#
379TOOL_QT4_UIC_UI_DEPEND =
380TOOL_QT4_UIC_UI_DEPORD =
381TOOL_QT4_UIC_UI_OUTPUT =
382TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
383define TOOL_QT4_UIC_UI_CMDS
384 $(QUIET)$(TOOL_QT4_UIC)\
385 $(flags)\
386 -o $(out)\
387 $(source)
388endef
389
390## Compile a Qt resource file (.qrc).
391# @param $(target) Normalized main target name.
392# @param $(source) Source filename (relative).
393# @param $(out) Object file name. This shall be (re)created by the compilation.
394# @param $(dep) Dependcy file. This may be (re)created by the compilation.
395# @param $(flags) Flags.
396# @param $(defs) Definitions.
397# @param $(incs) Includes.
398# @param $(outbase) Output basename (full). Use this for list files and such.
399#
400# @remarks The sed script generating the dependency file is a bit naive.
401TOOL_QT4_RCC_QRC_DEPEND =
402TOOL_QT4_RCC_QRC_DEPORD =
403TOOL_QT4_RCC_QRC_OUTPUT =
404TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
405define TOOL_QT4_RCC_QRC_CMDS
406 $(QUIET)$(TOOL_QT4_RCC)\
407 $(flags)\
408 -o $(out)\
409 $(source)
410 $(QUIET2)$(APPEND) $(dep) '\'
411 $(QUIET2)$(APPEND) $(dep) '$(out): \'
412 $(QUIET2)$(APPEND) $(dep) '$(source) \'
413 $(QUIET2)$(SED) \
414 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
415 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
416 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
417 -e 's|$$$$| \\|' \
418 --append $(dep) \
419 $(source)
420 $(QUIET2)$(APPEND) $(dep)
421 $(QUIET2)$(SED) \
422 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
423 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
424 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
425 -e 's|$$$$|:\n|' \
426 --append $(dep) \
427 $(source)
428 $(QUIET2)$(APPEND) $(dep)
429endef
430
431## Compile a Qt translation file (.ts).
432# @param $(target) Normalized main target name.
433# @param $(source) Source filename (relative).
434# @param $(out) Object file name. This shall be (re)created by the compilation.
435# @param $(dep) Dependcy file. This may be (re)created by the compilation.
436# @param $(flags) Flags.
437# @param $(defs) Definitions.
438# @param $(incs) Includes.
439# @param $(outbase) Output basename (full). Use this for list files and such.
440#
441TOOL_QT4_LRC_TS_DEPEND =
442TOOL_QT4_LRC_TS_DEPORD =
443TOOL_QT4_LRC_TS_OUTPUT =
444TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
445define TOOL_QT4_LRC_TS_CMDS
446 $(QUIET)$(TOOL_QT4_LRC)\
447 $(flags)\
448 $(source)\
449 -qm $(out)
450endef
451
452
453
454#
455#
456# Back to the Qt4 unit.
457#
458#
459
460
461## wrapper for the lrelease (LRC) command dependencies.
462ifndef NO_COMPILE_CMDS_DEPS
463 _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
464else
465 _UNIT_QT4_LRC_CMDS_DEP =
466endif
467
468##
469# def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
470#
471# This is necessary to resolve reference to local variables before doing
472# assignments and setting up commands. They would otherwise be resolved
473# later in a different context and the result would be completely wrong.
474#
475define def_unit_qt4_target_pre_handle_translation_dx
476
477$(out) + $(more_output) +| $(maybe_output): \
478 $(deps) \
479 $(value _UNIT_QT4_LRC_CMDS_DEP) \
480 | \
481 $(orderdeps)
482 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
483 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
484
485$(cmds)
486
487ifndef NO_COMPILE_CMDS_DEPS
488 %$$(QUIET2)$$(APPEND) '$(dep)'
489 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_'
490 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
491 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
492endif
493
494$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
495$(target)-inst-nls_SOURCES += $(out)
496
497endef # def_unit_qt4_target_pre_handle_translation_dx
498
499##
500# Handle a source file listed in QT_TRANSLATIONS.
501#
502# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
503# to be translated into .qm files that are loadble by Qt.
504#
505# @remarks Invoked via $(evalvalctx ).
506define def_unit_qt4_target_pre_handle_translation
507local type := LRC
508
509# fetch the properties.
510local tool := $(kb-src-tool dummy_var)
511local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
512local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
513local out := $(outbase).qm
514local dep := $(out).dep
515local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
516local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
517local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
518
519# default path + source dep.
520ifneq ($(defpath),)
521local source := $(abspathex $(source),$(defpath))
522local deps := $(abspathex $(deps),$(defpath)) $(source)
523local incs := $(abspathex $(incs),$(defpath))
524else
525local deps += $(source)
526endif
527
528# call the tool
529ifndef TOOL_$(tool)_LRC_TS_CMDS
530 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
531endif
532local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
533local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
534local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
535local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
536local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
537
538# generate the link rule and update some source and target variables.
539ifndef NO_COMPILE_CMDS_DEPS
540 $(eval includedep $(dep))
541endif
542$(eval $(def_unit_qt4_target_pre_handle_translation_dx))
543
544endef # def_unit_qt4_target_pre_handle_translation
545
546
547
548## wrapper for the UIC command dependencies.
549ifndef NO_COMPILE_CMDS_DEPS
550 _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
551else
552 _UNIT_QT4_RCC_CMDS_DEP =
553endif
554
555##
556# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
557#
558# This is necessary to resolve reference to local variables before doing
559# assignments and setting up commands. They would otherwise be resolved
560# later in a different context and the result would be completely wrong.
561#
562define def_unit_qt4_target_pre_handle_rcc_dx
563
564$(out) +| $(realout) $(more_output) $(maybe_output): \
565 $(deps) \
566 $(value _UNIT_QT4_RCC_CMDS_DEP) \
567 | \
568 $(orderdeps)
569 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
570 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
571
572$(cmds)
573
574 $(QUIET)$(CP) --changed -f $(out) $(realout)
575ifndef NO_COMPILE_CMDS_DEPS
576 %$$(QUIET2)$$(APPEND) '$(dep)'
577 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_'
578 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
579 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
580endif
581
582$(target)_INTERMEDIATES += $(realout)
583$(target)_GEN_SOURCES_ += $(realout)
584$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
585
586endef # def_unit_qt4_target_pre_handle_rcc_dx
587
588##
589# Source handler for .qrc sources (Qt resource files).
590#
591# @remarks $(evalvalctx me).
592define def_unit_qt4_src_handler_qrc
593local type := RCC
594
595# fetch the properties.
596local tool := $(kb-src-tool dummy_var)
597local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
598local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
599local out := $(outbase).tmp.gen.cpp
600local realout := $(outbase).gen.cpp
601local dep := $(realout).dep
602local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
603local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
604local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
605
606# default path + source dep.
607ifneq ($(defpath),)
608local source := $(abspathex $(source),$(defpath))
609local deps := $(abspathex $(deps),$(defpath)) $(source)
610local incs := $(abspathex $(incs),$(defpath))
611else
612local deps += $(source)
613endif
614
615# call the tool
616ifndef TOOL_$(tool)_RCC_QRC_CMDS
617 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
618endif
619local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
620local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
621local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
622local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
623local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
624
625# generate the link rule and update some source and target variables.
626ifndef NO_COMPILE_CMDS_DEPS
627 $(eval includedep $(dep))
628endif
629$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
630
631endef # def_unit_qt4_src_handler_qrc
632
633
634
635## wrapper for the UIC command dependencies.
636ifndef NO_COMPILE_CMDS_DEPS
637 _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
638else
639 _UNIT_QT4_UIC_CMDS_DEP =
640endif
641
642##
643# def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
644#
645# This is necessary to resolve reference to local variables before doing
646# assignments and setting up commands. They would otherwise be resolved
647# later in a different context and the result would be completely wrong.
648#
649define def_unit_qt4_target_pre_handle_ui_dx
650
651$(out) +| $(realout) $(more_output) $(maybe_output): \
652 $(deps) \
653 $(value _UNIT_QT4_UIC_CMDS_DEP) \
654 | \
655 $(orderdeps)
656 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
657 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
658
659$(cmds)
660
661 $(QUIET)$(CP) --changed -f $(out) $(realout)
662ifndef NO_COMPILE_CMDS_DEPS
663 %$$(QUIET2)$$(APPEND) '$(dep)'
664 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_'
665 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
666 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
667endif
668
669$(target)_INTERMEDIATES += $(realout)
670$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
671
672endef # def_unit_qt4_target_pre_handle_ui_dx
673
674##
675# Source handler for .ui sources.
676#
677# @remarks $(evalvalctx me).
678define def_unit_qt4_src_handler_ui
679local type := UIC
680
681# fetch the properties.
682local tool := $(kb-src-tool dummy_var)
683local qtuicdir := $($(target)_0_OUTDIR)/qtuic
684local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
685local out := $(outbase).tmp.gen.h
686local realout := $(outbase).gen.h
687local dep := $(realout).dep
688local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
689local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
690local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
691
692# default path + source dep.
693ifneq ($(defpath),)
694local source := $(abspathex $(source),$(defpath))
695local deps := $(abspathex $(deps),$(defpath)) $(source)
696local incs := $(abspathex $(incs),$(defpath))
697else
698local deps += $(source)
699endif
700
701# call the tool
702ifndef TOOL_$(tool)_UIC_UI_CMDS
703 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
704endif
705local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
706local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
707local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
708local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
709local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
710
711# generate the link rule and update some source and target variables.
712ifndef NO_COMPILE_CMDS_DEPS
713 $(eval includedep $(dep))
714endif
715$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
716
717endef # def_unit_qt4_src_handler_ui
718
719
720
721## wrapper for the MOC command dependencies.
722ifndef NO_COMPILE_CMDS_DEPS
723 _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
724else
725 _UNIT_QT4_MOC_HPP_CMDS_DEP =
726endif
727
728##
729# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
730#
731# This is necessary to resolve reference to local variables before doing
732# assignments and setting up commands. They would otherwise be resolved
733# later in a different context and the result would be completely wrong.
734#
735define def_unit_qt4_target_pre_handle_moc_hdr_dx
736
737$(out) +| $(realout) $(more_output) $(maybe_output): \
738 $(deps) \
739 $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
740 | \
741 $(orderdeps)
742 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
743 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
744
745$(cmds)
746
747 $(QUIET)$(CP) --changed -f $(out) $(realout)
748ifndef NO_COMPILE_CMDS_DEPS
749 %$$(QUIET2)$$(APPEND) '$(dep)'
750 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_'
751 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
752 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
753endif
754
755$(target)_INTERMEDIATES += $(realout)
756$(target)_GEN_SOURCES_ += $(realout)
757$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
758
759endef
760
761##
762# Handle a source file listed in QT_MOCHDRS.
763#
764# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
765# generate a .cpp file for each of them and add it to the generated
766# sources so that it's compiled and linked. (There is an alternative
767# way to do this where the .cpp file is included, this isn't currently
768# supported by this unit.)
769#
770# @remarks Invoked via $(evalvalctx ).
771define def_unit_qt4_target_pre_handle_moc_hdr
772local type := MOC
773
774# fetch the properties.
775local tool := $(kb-src-tool dummy_var)
776local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
777local out := $(outbase).tmp.cpp
778local realout := $(outbase).cpp
779local dep := $(realout).dep
780local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
781local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
782local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
783local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
784local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
785
786# default path + source dep.
787ifneq ($(defpath),)
788local source := $(abspathex $(source),$(defpath))
789local deps := $(abspathex $(deps),$(defpath)) $(source)
790local incs := $(abspathex $(incs),$(defpath))
791else
792local deps += $(source)
793endif
794
795# call the tool
796ifndef TOOL_$(tool)_MOC_HPP_CMDS
797 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
798endif
799local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
800local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
801local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
802local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
803local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
804
805# generate the link rule and update some source and target variables.
806ifndef NO_COMPILE_CMDS_DEPS
807 $(eval includedep $(dep))
808endif
809$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
810
811endef # def_unit_qt4_target_pre_handle_moc_hdr
812
813
814## wrapper for the MOC command dependencies.
815ifndef NO_COMPILE_CMDS_DEPS
816 _UNIT_QT4_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
817else
818 _UNIT_QT4_MOC_CPP_CMDS_DEP =
819endif
820
821##
822# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
823#
824# This is necessary to resolve reference to local variables before doing
825# assignments and setting up commands. They would otherwise be resolved
826# later in a different context and the result would be completely wrong.
827#
828define def_unit_qt4_target_pre_handle_moc_src_dx
829
830$(out) +| $(realout) $(more_output) $(maybe_output): \
831 $(deps) \
832 $(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
833 | \
834 $(orderdeps)
835 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
836 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
837
838$(cmds)
839
840 $(QUIET)$(CP) --changed -f $(out) $(realout)
841ifndef NO_COMPILE_CMDS_DEPS
842 %$$(QUIET2)$$(APPEND) '$(dep)'
843 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
844 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
845 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
846endif
847
848$(target)_INTERMEDIATES += $(realout)
849$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
850
851endef
852
853##
854# Handle a source file listed in QT_MOCSRCS.
855#
856# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
857# a .moc file that we're expected to generate here.
858#
859# @remarks Invoked via $(evalvalctx ).
860define def_unit_qt4_target_pre_handle_moc_src
861local type := MOC
862
863# fetch the properties.
864local tool := $(kb-src-tool dummy_var)
865local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
866local out := $(outbase).tmp.moc
867local realout := $(outbase).moc
868local dep := $(realout).dep
869local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
870local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
871local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
872local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
873local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
874
875# default path + source dep.
876ifneq ($(defpath),)
877local source := $(abspathex $(source),$(defpath))
878local deps := $(abspathex $(deps),$(defpath)) $(source)
879local incs := $(abspathex $(incs),$(defpath))
880else
881local deps += $(source)
882endif
883
884# call the tool
885ifndef TOOL_$(tool)_MOC_CPP_CMDS
886 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
887endif
888local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
889local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
890local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
891local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
892local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
893
894# generate the link rule and update some source and target variables.
895ifndef NO_COMPILE_CMDS_DEPS
896 $(eval includedep $(dep))
897endif
898$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
899
900endef # def_unit_qt4_target_pre_handle_moc_src
901
902
903##
904# Adds sources containing Q_OBJECT to QT_MOCSRCS.
905define def_unit_qt4_target_pre_cpp_source
906ifneq ($(file-size $(source)),-1)
907 ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
908 $(eval $(target)_QT_MOCSRCS += $(source))
909 endif
910endif
911endef # def_unit_qt4_target_pre_cpp_source
912
913##
914# Invoked early in the processing of a target that uses the Qt unit.
915#
916# It will append the qt source handlers to the target (.h, .ui, .ts,
917# .png, .bmp, .gif).
918#
919# It will then check all the C++ sources and check which needs
920# a .moc files and generate rules and dependencies fofor these
921#
922define def_unit_qt4_target_pre
923
924# Make QTTOOL the default for the specific Qt tools instead of TOOL.
925ifneq ($($(target)_QTTOOL),)
926 ifeq ($($(target)_MOCTOOL),)
927 $(target)_MOCTOOL := $($(target)_QTTOOL)
928 endif
929 ifeq ($($(target)_UICTOOL),)
930 $(target)_UICTOOL := $($(target)_QTTOOL)
931 endif
932 ifeq ($($(target)_RCCTOOL),)
933 $(target)_RCCTOOL := $($(target)_QTTOOL)
934 endif
935 ifeq ($($(target)_LRCTOOL),)
936 $(target)_LRCTOOL := $($(target)_QTTOOL)
937 endif
938endif
939
940# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
941local qt_modules := \
942 $($(target)_QT_MODULES.$(bld_trg)) \
943 $($(target)_QT_MODULES.$(bld_trg_arch)) \
944 $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
945 $($(target)_QT_MODULES.$(bld_trg_cpu)) \
946 $($(target)_QT_MODULES.$(bld_type)) \
947 $($(target)_QT_MODULES)
948local qt_prefix := $(firstword \
949 $($(target)_QT_PREFIX.$(bld_trg)) \
950 $($(target)_QT_PREFIX.$(bld_trg_arch)) \
951 $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
952 $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
953 $($(target)_QT_PREFIX.$(bld_type)) \
954 $($(target)_QT_PREFIX))
955local qt_infix := $(firstword \
956 $($(target)_QT_INFIX.$(bld_trg)) \
957 $($(target)_QT_INFIX.$(bld_trg_arch)) \
958 $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
959 $($(target)_QT_INFIX.$(bld_trg_cpu)) \
960 $($(target)_QT_INFIX.$(bld_type)) \
961 $($(target)_QT_INFIX))
962ifeq ($(bld_trg),darwin)
963 # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
964 $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
965 $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
966 $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
967 $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
968else
969 ifeq ($(bld_trg),win)
970 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
971 ifeq ($(tool_do),LINK_PROGRAM)
972 $(eval $(target)_LIBS += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
973 endif
974 else
975 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
976 endif
977 $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
978endif
979$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
980
981
982# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
983# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
984ifndef $(target)_QT_MOCSRCS
985 $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
986 $($(target)_SOURCES.$(bld_trg)) \
987 $($(target)_SOURCES.$(bld_trg_arch)) \
988 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
989 $($(target)_SOURCES.$(bld_trg_cpu)) \
990 $($(target)_SOURCES.$(bld_type)) \
991 $($(target)_SOURCES) \
992 ), $(evalval def_unit_qt4_target_pre_cpp_source))
993endif
994
995# Install source handlers for .ui files.
996$(target)_SRC_HANDLERS += \
997 .ui:def_unit_qt4_src_handler_ui \
998 .UI:def_unit_qt4_src_handler_ui \
999 .qrc:def_unit_qt4_src_handler_qrc \
1000 .qrc:def_unit_qt4_src_handler_qrc
1001
1002# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
1003local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
1004local qtuicdir := $($(target)_0_OUTDIR)/qtuic
1005local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
1006local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
1007$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
1008$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
1009
1010# Deal with QT_MOCSRCS.
1011$(foreach source, \
1012 $($(target)_QT_MOCSRCS.$(bld_trg)) \
1013 $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
1014 $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
1015 $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
1016 $($(target)_QT_MOCSRCS.$(bld_type)) \
1017 $($(target)_QT_MOCSRCS) \
1018 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
1019
1020# Deal with QT_MOCHDRS.
1021$(foreach source, \
1022 $($(target)_QT_MOCHDRS.$(bld_trg)) \
1023 $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
1024 $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
1025 $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
1026 $($(target)_QT_MOCHDRS.$(bld_type)) \
1027 $($(target)_QT_MOCHDRS) \
1028 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
1029
1030# Deal with QT_TRANSLATIONS.
1031# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
1032local translations := \
1033 $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
1034 $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
1035 $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
1036 $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
1037 $($(target)_QT_TRANSLATIONS.$(bld_type)) \
1038 $($(target)_QT_TRANSLATIONS)
1039ifneq ($(strip $(translations)),)
1040 local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
1041 $(eval $(expr))
1042 ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
1043 $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
1044 else
1045 $(target)-inst-nls_MODE := 0644
1046 endif
1047 ifdef $(target)_QT_TRANSLATIONS_INST
1048 $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
1049 endif
1050 $(target)-inst-nls_SOURCES :=
1051 $(foreach source, $(translations)\
1052 , $(evalvalctx def_unit_qt4_target_pre_handle_translation))
1053endif
1054
1055endef # def_unit_qt4_target_pre
1056
1057
1058#
1059# Rule for debugging.
1060#
1061unit-qt4-show-vars:
1062 @$(ECHO) 'The Qt4 SDK variables:'
1063 @$(ECHO) ' PATH_SDK_QT4 = "$(PATH_SDK_QT4)"'
1064 @$(ECHO) ' PATH_SDK_QT4_INC = "$(PATH_SDK_QT4_INC)"'
1065 @$(ECHO) ' PATH_SDK_QT4_LIB = "$(PATH_SDK_QT4_LIB)"'
1066 @$(ECHO) ' PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
1067 @$(ECHO) ' PATH_SDK_QT4_LIB.x86 = "$(PATH_SDK_QT4_LIB.x86)"'
1068 @$(ECHO) 'The Qt4 TOOL variables:'
1069 @$(ECHO) ' PATH_TOOL_QT4_BIN = "$(PATH_TOOL_QT4_BIN)"'
1070 @$(ECHO) ' TOOL_QT4_BIN_SUFF = "$(TOOL_QT4_BIN_SUFF)"'
1071 @$(ECHO) ' TOOL_QT4_MOC = "$(TOOL_QT4_MOC)"'
1072 @$(ECHO) ' TOOL_QT4_UIC = "$(TOOL_QT4_UIC)"'
1073 @$(ECHO) ' TOOL_QT4_RCC = "$(TOOL_QT4_RCC)"'
1074 @$(ECHO) ' TOOL_QT4_LRC = "$(TOOL_QT4_LRC)"'
1075 @$(ECHO) ' TOOL_QT4_LUPDATE = "$(TOOL_QT4_LUPDATE)"'
1076
Note: See TracBrowser for help on using the repository browser.