0.1.5: Backported r2356, r2357, r2358, r2359 and r2360: Objective-C++ support.
[kbuild-mirror.git] / kBuild / units / qt4.kmk
blobf29a72b48267121ed35009916d0f9fa794993e9e
1 # $Id$
2 ## @file
3 # Qt 4 unit.
7 # Copyright (c) 2008-2009 knut st. osmundsen <bird-kBuild-spamix@anduin.net>
9 # This file is part of kBuild.
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.
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.
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
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.
35 ifdef UNIT_qt4
36 $(error kBuild: The qt4 unit was included twice!)
37 endif
38 UNIT_qt4 = qt4
41 ifndef 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
45 endif
46 PROPS_SINGLE += RCCTOOL QT_INFIX
47 PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
50 ## @todo use pkg-config?
53 # The QT4 SDK.
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.
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.
60 SDK_QT4 = Qt4
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.
68 ifndef 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
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 \
107 ifneq ($(PATH_SDK_QT4_INC),)
108 export PATH_SDK_QT4_INC
109 endif
110 endif
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/local/lib32/libQtCore$(SUFF_DLL) \
120 /usr/local/lib32/qt4/libQtCore$(SUFF_DLL) \
121 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
122 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
124 ifneq ($(PATH_SDK_QT4_LIB.x86),)
125 export PATH_SDK_QT4_LIB.x86
126 endif
127 endif
128 ifeq ($(PATH_SDK_QT4_LIB.amd64),)
129 PATH_SDK_QT4_LIB.amd64 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
130 $(PATH_SDK_QT4)/lib64/libQtCore$(SUFF_DLL) \
131 $(PATH_SDK_QT4)/lib64/qt4/libQtCore$(SUFF_DLL) \
132 $(PATH_SDK_QT4)/lib/amd64/libQtCore$(SUFF_DLL) \
133 /usr/lib64/libQtCore$(SUFF_DLL) \
134 /usr/lib64/qt4/libQtCore$(SUFF_DLL) \
135 /usr/lib/amd64/libQtCore$(SUFF_DLL) \
136 /usr/local/lib64/libQtCore$(SUFF_DLL) \
137 /usr/local/lib64/qt4/libQtCore$(SUFF_DLL) \
138 /usr/local/lib/amd64/libQtCore$(SUFF_DLL) \
139 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
140 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
142 ifneq ($(PATH_SDK_QT4_LIB.amd64),)
143 export PATH_SDK_QT4_LIB.amd64
144 endif
145 endif
147 # And finally, the library path for KBUILD_TARGET.
148 ifeq ($(PATH_SDK_QT4_LIB),)
149 PATH_SDK_QT4_LIB := $(PATH_SDK_QT4_LIB.$(KBUILD_TARGET_ARCH))
150 ifeq ($(PATH_SDK_QT4_LIB),)
151 PATH_SDK_QT4_LIB := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
152 $(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
153 $(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
154 /usr/lib/libQtCore$(SUFF_DLL) \
155 /usr/lib/qt4/libQtCore$(SUFF_DLL) \
156 /usr/local/lib/libQtCore$(SUFF_DLL) \
157 /usr/local/lib/qt4/libQtCore$(SUFF_DLL) \
159 endif
160 ifneq ($(PATH_SDK_QT4_LIB),)
161 export PATH_SDK_QT4_LIB
162 endif
163 endif
165 endif
166 endif # Unices
167 endif
168 # Found it?
169 ifeq ($(PATH_SDK_QT4),)
170 $(warning kBuild: Couldn't find the Qt4 headers and libaries...)
171 PATH_SDK_QT4 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
172 endif
173 endif
174 else
175 # Resolve any fancy stuff once and for all.
176 PATH_SDK_QT4 := $(PATH_SDK_QT4)
177 endif
179 # Libraries can be in either Frameworks or lib depending on how you
180 # build it on the mac. The .dmg installs into Frameworks but builds into lib.
181 ifeq ($(KBUILD_TARGET),darwin)
182 ifndef PATH_SDK_QT4_LIB
183 ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
184 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
185 else
186 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
187 endif
188 endif
189 else
190 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
191 PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
192 endif
194 # The bits that kBuild picks up.
195 # (nothing here)
199 # The QT4 tool.
201 # This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
202 # It also makes things easier to develop, with fewer files I mean.
204 TOOL_QT4 = Qt4
206 # Tool Specific Properties
207 # PATH_TOOL_QT4 - Obsolete.
208 # PATH_TOOL_QT4_BIN - The
209 # TOOL_QT4_BIN_SUFF -
210 if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
211 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
212 endif
213 ifndef PATH_TOOL_QT4_BIN
214 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v4*/bin)))
215 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
216 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v4*/bin)))
217 endif
218 ifeq ($(PATH_TOOL_QT4_BIN),)
219 ifdef TOOL_QT4_BIN_SUFF
220 TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
221 endif
222 # Try looking for moc-qt4 / moc-$(suffix) first.
223 ifneq ($(TOOL_QT4_BIN_SUFF),)
224 PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
225 /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
226 /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
227 /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
228 /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
229 /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
231 else
232 PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
233 /usr/lib/qt4/bin/moc-qt4 \
234 /usr/qt/4/bin/moc-qt4 \
235 /usr/share/qt4/bin/moc-qt4 \
236 /usr/local/bin/moc-qt4 \
237 /usr/bin/moc-qt4 \
239 ifneq ($(PATH_TOOL_QT4_BIN),)
240 TOOL_QT4_BIN_SUFF := -qt4
241 else
242 # If no luck, try looking for moc in the qt4 specific locations.
243 PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
244 /usr/lib/qt4/bin/moc \
245 /usr/qt/4/bin/moc \
246 /usr/share/qt4/bin/moc \
248 endif
249 endif
250 # If still no go, try looking for qt3to4 and rcc.
251 ifeq ($(PATH_TOOL_QT4_BIN),)
252 PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
253 /usr/lib/qt4/bin/qt3to4 \
254 /usr/qt/4/bin/qt3to4 \
255 /usr/share/qt4/bin/qt3to4 \
256 /usr/local/bin/qt3to4 \
257 /usr/bin/qt3to4 \
259 endif
260 ifeq ($(PATH_TOOL_QT4_BIN),)
261 PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
262 /usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
263 /usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
264 /usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
265 /usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
266 /usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
268 endif
269 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
270 PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
271 /usr/lib/qt4/bin/rcc \
272 /usr/qt/4/bin/rcc \
273 /usr/share/qt4/bin/rcc \
274 /usr/local/bin/rcc \
275 /usr/bin/rcc \
277 endif
278 ifneq ($(PATH_TOOL_QT4_BIN),)
279 export PATH_TOOL_QT4_BIN
280 endif
281 endif
282 # If not found, we'll enter the 'pathless' mode.
283 else
284 # Resolve any fancy stuff once and for all.
285 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
286 endif
287 ifneq ($(PATH_TOOL_QT4_BIN),)
288 TOOL_QT4_MOC ?= $(PATH_TOOL_QT4_BIN)/moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
289 TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
290 ifndef TOOL_QT4_RCC
291 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
292 ifeq ($(wildcard $(TOOL_QT4_RCC)),)
293 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
294 endif
295 endif
296 TOOL_QT4_LRC ?= $(PATH_TOOL_QT4_BIN)/lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
297 TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
298 else
299 # Pathless, relies on the environment.
300 TOOL_QT4_MOC ?= moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
301 TOOL_QT4_UIC ?= uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
302 TOOL_QT4_RCC ?= rcc$(HOST_SUFF_EXE)
303 TOOL_QT4_LRC ?= lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
304 TOOL_QT4_LUPDATE ?= lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
305 endif
307 # General Properties used by kBuild and/or units/qt.kmk
308 TOOL_QT4_MOCFLAGS ?=
309 TOOL_QT4_MOCINCS ?=
310 TOOL_QT4_MOCDEFS ?=
311 TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
312 TOOL_QT4_MOCDEFS.solaris ?= __sun
313 TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
314 TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
317 ## MOC a C++ source file.
318 # @param $(target) Normalized main target name.
319 # @param $(source) Source filename (relative).
320 # @param $(out) Object file name. This shall be (re)created by the compilation.
321 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
322 # @param $(flags) Flags.
323 # @param $(defs) Definitions.
324 # @param $(incs) Includes.
325 # @param $(outbase) Output basename (full). Use this for list files and such.
327 TOOL_QT4_MOC_CPP_DEPEND =
328 TOOL_QT4_MOC_CPP_DEPORD =
329 TOOL_QT4_MOC_CPP_OUTPUT =
330 TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
331 define TOOL_QT4_MOC_CPP_CMDS
332 $(QUIET)$(TOOL_QT4_MOC)\
333 $(flags)\
334 $(addprefix -I, $(incs))\
335 $(addprefix -D, $(defs))\
336 -o $(out)\
337 $(source)
338 endef
340 ## MOC a C++ header file.
341 # @param $(target) Normalized main target name.
342 # @param $(source) Source filename (relative).
343 # @param $(out) Object file name. This shall be (re)created by the compilation.
344 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
345 # @param $(flags) Flags.
346 # @param $(defs) Definitions.
347 # @param $(incs) Includes.
348 # @param $(outbase) Output basename (full). Use this for list files and such.
350 TOOL_QT4_MOC_HPP_DEPEND =
351 TOOL_QT4_MOC_HPP_DEPORD =
352 TOOL_QT4_MOC_HPP_OUTPUT =
353 TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
354 define TOOL_QT4_MOC_HPP_CMDS
355 $(QUIET)$(TOOL_QT4_MOC)\
356 $(flags)\
357 $(addprefix -I, $(incs))\
358 $(addprefix -D, $(defs))\
359 -o $(out)\
360 $(source)
361 endef
363 ## Compile a Qt user interface file (.ui).
364 # @param $(target) Normalized main target name.
365 # @param $(source) Source filename (relative).
366 # @param $(out) Object file name. This shall be (re)created by the compilation.
367 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
368 # @param $(flags) Flags.
369 # @param $(defs) Definitions.
370 # @param $(incs) Includes.
371 # @param $(outbase) Output basename (full). Use this for list files and such.
373 TOOL_QT4_UIC_UI_DEPEND =
374 TOOL_QT4_UIC_UI_DEPORD =
375 TOOL_QT4_UIC_UI_OUTPUT =
376 TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
377 define TOOL_QT4_UIC_UI_CMDS
378 $(QUIET)$(TOOL_QT4_UIC)\
379 $(flags)\
380 -o $(out)\
381 $(source)
382 endef
384 ## Compile a Qt resource file (.qrc).
385 # @param $(target) Normalized main target name.
386 # @param $(source) Source filename (relative).
387 # @param $(out) Object file name. This shall be (re)created by the compilation.
388 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
389 # @param $(flags) Flags.
390 # @param $(defs) Definitions.
391 # @param $(incs) Includes.
392 # @param $(outbase) Output basename (full). Use this for list files and such.
394 # @remarks The sed script generating the dependency file is a bit naive.
395 TOOL_QT4_RCC_QRC_DEPEND =
396 TOOL_QT4_RCC_QRC_DEPORD =
397 TOOL_QT4_RCC_QRC_OUTPUT =
398 TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
399 define TOOL_QT4_RCC_QRC_CMDS
400 $(QUIET)$(TOOL_QT4_RCC)\
401 $(flags)\
402 -o $(out)\
403 $(source)
404 $(APPEND) $(dep) '\'
405 $(APPEND) $(dep) '$(out): \'
406 $(APPEND) $(dep) '$(source) \'
407 $(SED) \
408 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
409 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
410 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
411 -e 's|$$$$| \\|' \
412 --append $(dep) \
413 $(source)
414 $(APPEND) $(dep)
415 $(SED) \
416 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
417 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
418 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
419 -e 's|$$$$|:\n|' \
420 --append $(dep) \
421 $(source)
422 $(APPEND) $(dep)
423 endef
425 ## Compile a Qt translation file (.ts).
426 # @param $(target) Normalized main target name.
427 # @param $(source) Source filename (relative).
428 # @param $(out) Object file name. This shall be (re)created by the compilation.
429 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
430 # @param $(flags) Flags.
431 # @param $(defs) Definitions.
432 # @param $(incs) Includes.
433 # @param $(outbase) Output basename (full). Use this for list files and such.
435 TOOL_QT4_LRC_TS_DEPEND =
436 TOOL_QT4_LRC_TS_DEPORD =
437 TOOL_QT4_LRC_TS_OUTPUT =
438 TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
439 define TOOL_QT4_LRC_TS_CMDS
440 $(QUIET)$(TOOL_QT4_LRC)\
441 $(flags)\
442 $(source)\
443 -qm $(out)
444 endef
450 # Back to the Qt4 unit.
455 ## wrapper for the lrelease (LRC) command dependencies.
456 ifndef NO_COMPILE_CMDS_DEPS
457 _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
458 else
459 _UNIT_QT4_LRC_CMDS_DEP =
460 endif
463 # def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
465 # This is necessary to resolve reference to local variables before doing
466 # assignments and setting up commands. They would otherwise be resolved
467 # later in a different context and the result would be completely wrong.
469 define def_unit_qt4_target_pre_handle_translation_dx
471 $(out) + $(more_output) +| $(maybe_output): \
472 $(deps) \
473 $(value _UNIT_QT4_LRC_CMDS_DEP) \
475 $(orderdeps)
476 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
477 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
479 $(cmds)
481 ifndef NO_COMPILE_CMDS_DEPS
482 %$$(QUIET2)$$(APPEND) '$(dep)'
483 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_'
484 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
485 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
486 endif
488 $(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
489 $(target)-inst-nls_SOURCES += $(out)
491 endef # def_unit_qt4_target_pre_handle_translation_dx
494 # Handle a source file listed in QT_TRANSLATIONS.
496 # The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
497 # to be translated into .qm files that are loadble by Qt.
499 # @remarks Invoked via $(evalvalctx ).
500 define def_unit_qt4_target_pre_handle_translation
501 local type := LRC
503 # fetch the properties.
504 local tool := $(kb-src-tool dummy_var)
505 local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
506 local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
507 local out := $(outbase).qm
508 local dep := $(out).dep
509 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
510 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
511 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
513 # default path + source dep.
514 ifneq ($(defpath),)
515 local source := $(abspathex $(source),$(defpath))
516 local deps := $(abspathex $(deps),$(defpath)) $(source)
517 local incs := $(abspathex $(incs),$(defpath))
518 else
519 local deps += $(source)
520 endif
522 # call the tool
523 ifndef TOOL_$(tool)_LRC_TS_CMDS
524 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
525 endif
526 local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
527 local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
528 local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
529 local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
530 local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
532 # generate the link rule and update some source and target variables.
533 ifndef NO_COMPILE_CMDS_DEPS
534 $(eval includedep $(dep))
535 endif
536 $(eval $(def_unit_qt4_target_pre_handle_translation_dx))
538 endef # def_unit_qt4_target_pre_handle_translation
542 ## wrapper for the UIC command dependencies.
543 ifndef NO_COMPILE_CMDS_DEPS
544 _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
545 else
546 _UNIT_QT4_RCC_CMDS_DEP =
547 endif
550 # def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
552 # This is necessary to resolve reference to local variables before doing
553 # assignments and setting up commands. They would otherwise be resolved
554 # later in a different context and the result would be completely wrong.
556 define def_unit_qt4_target_pre_handle_rcc_dx
558 $(out) +| $(realout) $(more_output) $(maybe_output): \
559 $(deps) \
560 $(value _UNIT_QT4_RCC_CMDS_DEP) \
562 $(orderdeps)
563 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
564 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
566 $(cmds)
568 $(QUIET)$(CP) --changed -f $(out) $(realout)
569 ifndef NO_COMPILE_CMDS_DEPS
570 %$$(QUIET2)$$(APPEND) '$(dep)'
571 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_'
572 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
573 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
574 endif
576 $(target)_INTERMEDIATES += $(realout)
577 $(target)_GEN_SOURCES_ += $(realout)
578 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
580 endef # def_unit_qt4_target_pre_handle_rcc_dx
583 # Source handler for .qrc sources (Qt resource files).
585 # @remarks $(evalvalctx me).
586 define def_unit_qt4_src_handler_qrc
587 local type := RCC
589 # fetch the properties.
590 local tool := $(kb-src-tool dummy_var)
591 local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
592 local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
593 local out := $(outbase).tmp.gen.cpp
594 local realout := $(outbase).gen.cpp
595 local dep := $(realout).dep
596 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
597 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
598 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
600 # default path + source dep.
601 ifneq ($(defpath),)
602 local source := $(abspathex $(source),$(defpath))
603 local deps := $(abspathex $(deps),$(defpath)) $(source)
604 local incs := $(abspathex $(incs),$(defpath))
605 else
606 local deps += $(source)
607 endif
609 # call the tool
610 ifndef TOOL_$(tool)_RCC_QRC_CMDS
611 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
612 endif
613 local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
614 local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
615 local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
616 local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
617 local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
619 # generate the link rule and update some source and target variables.
620 ifndef NO_COMPILE_CMDS_DEPS
621 $(eval includedep $(dep))
622 endif
623 $(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
625 endef # def_unit_qt4_src_handler_qrc
629 ## wrapper for the UIC command dependencies.
630 ifndef NO_COMPILE_CMDS_DEPS
631 _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
632 else
633 _UNIT_QT4_UIC_CMDS_DEP =
634 endif
637 # def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
639 # This is necessary to resolve reference to local variables before doing
640 # assignments and setting up commands. They would otherwise be resolved
641 # later in a different context and the result would be completely wrong.
643 define def_unit_qt4_target_pre_handle_ui_dx
645 $(out) +| $(realout) $(more_output) $(maybe_output): \
646 $(deps) \
647 $(value _UNIT_QT4_UIC_CMDS_DEP) \
649 $(orderdeps)
650 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
651 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
653 $(cmds)
655 $(QUIET)$(CP) --changed -f $(out) $(realout)
656 ifndef NO_COMPILE_CMDS_DEPS
657 %$$(QUIET2)$$(APPEND) '$(dep)'
658 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_'
659 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
660 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
661 endif
663 $(target)_INTERMEDIATES += $(realout)
664 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
666 endef # def_unit_qt4_target_pre_handle_ui_dx
669 # Source handler for .ui sources.
671 # @remarks $(evalvalctx me).
672 define def_unit_qt4_src_handler_ui
673 local type := UIC
675 # fetch the properties.
676 local tool := $(kb-src-tool dummy_var)
677 local qtuicdir := $($(target)_0_OUTDIR)/qtuic
678 local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
679 local out := $(outbase).tmp.gen.h
680 local realout := $(outbase).gen.h
681 local dep := $(realout).dep
682 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
683 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
684 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
686 # default path + source dep.
687 ifneq ($(defpath),)
688 local source := $(abspathex $(source),$(defpath))
689 local deps := $(abspathex $(deps),$(defpath)) $(source)
690 local incs := $(abspathex $(incs),$(defpath))
691 else
692 local deps += $(source)
693 endif
695 # call the tool
696 ifndef TOOL_$(tool)_UIC_UI_CMDS
697 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
698 endif
699 local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
700 local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
701 local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
702 local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
703 local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
705 # generate the link rule and update some source and target variables.
706 ifndef NO_COMPILE_CMDS_DEPS
707 $(eval includedep $(dep))
708 endif
709 $(eval $(def_unit_qt4_target_pre_handle_ui_dx))
711 endef # def_unit_qt4_src_handler_ui
715 ## wrapper for the MOC command dependencies.
716 ifndef NO_COMPILE_CMDS_DEPS
717 _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
718 else
719 _UNIT_QT4_MOC_HPP_CMDS_DEP =
720 endif
723 # def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
725 # This is necessary to resolve reference to local variables before doing
726 # assignments and setting up commands. They would otherwise be resolved
727 # later in a different context and the result would be completely wrong.
729 define def_unit_qt4_target_pre_handle_moc_hdr_dx
731 $(out) +| $(realout) $(more_output) $(maybe_output): \
732 $(deps) \
733 $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
735 $(orderdeps)
736 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
737 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
739 $(cmds)
741 $(QUIET)$(CP) --changed -f $(out) $(realout)
742 ifndef NO_COMPILE_CMDS_DEPS
743 %$$(QUIET2)$$(APPEND) '$(dep)'
744 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_'
745 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
746 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
747 endif
749 $(target)_INTERMEDIATES += $(realout)
750 $(target)_GEN_SOURCES_ += $(realout)
751 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
753 endef
756 # Handle a source file listed in QT_MOCHDRS.
758 # The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
759 # generate a .cpp file for each of them and add it to the generated
760 # sources so that it's compiled and linked. (There is an alternative
761 # way to do this where the .cpp file is included, this isn't currently
762 # supported by this unit.)
764 # @remarks Invoked via $(evalvalctx ).
765 define def_unit_qt4_target_pre_handle_moc_hdr
766 local type := MOC
768 # fetch the properties.
769 local tool := $(kb-src-tool dummy_var)
770 local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
771 local out := $(outbase).tmp.cpp
772 local realout := $(outbase).cpp
773 local dep := $(realout).dep
774 local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
775 local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
776 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
777 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
778 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
780 # default path + source dep.
781 ifneq ($(defpath),)
782 local source := $(abspathex $(source),$(defpath))
783 local deps := $(abspathex $(deps),$(defpath)) $(source)
784 local incs := $(abspathex $(incs),$(defpath))
785 else
786 local deps += $(source)
787 endif
789 # call the tool
790 ifndef TOOL_$(tool)_MOC_HPP_CMDS
791 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
792 endif
793 local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
794 local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
795 local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
796 local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
797 local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
799 # generate the link rule and update some source and target variables.
800 ifndef NO_COMPILE_CMDS_DEPS
801 $(eval includedep $(dep))
802 endif
803 $(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
805 endef # def_unit_qt4_target_pre_handle_moc_hdr
808 ## wrapper for the MOC command dependencies.
809 ifndef NO_COMPILE_CMDS_DEPS
810 _UNIT_QT4_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
811 else
812 _UNIT_QT4_MOC_CPP_CMDS_DEP =
813 endif
816 # def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
818 # This is necessary to resolve reference to local variables before doing
819 # assignments and setting up commands. They would otherwise be resolved
820 # later in a different context and the result would be completely wrong.
822 define def_unit_qt4_target_pre_handle_moc_src_dx
824 $(out) +| $(realout) $(more_output) $(maybe_output): \
825 $(deps) \
826 $(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
828 $(orderdeps)
829 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
830 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
832 $(cmds)
834 $(QUIET)$(CP) --changed -f $(out) $(realout)
835 ifndef NO_COMPILE_CMDS_DEPS
836 %$$(QUIET2)$$(APPEND) '$(dep)'
837 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
838 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
839 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
840 endif
842 $(target)_INTERMEDIATES += $(realout)
843 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
845 endef
848 # Handle a source file listed in QT_MOCSRCS.
850 # The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
851 # a .moc file that we're expected to generate here.
853 # @remarks Invoked via $(evalvalctx ).
854 define def_unit_qt4_target_pre_handle_moc_src
855 local type := MOC
857 # fetch the properties.
858 local tool := $(kb-src-tool dummy_var)
859 local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
860 local out := $(outbase).tmp.moc
861 local realout := $(outbase).moc
862 local dep := $(realout).dep
863 local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
864 local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
865 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
866 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
867 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
869 # default path + source dep.
870 ifneq ($(defpath),)
871 local source := $(abspathex $(source),$(defpath))
872 local deps := $(abspathex $(deps),$(defpath)) $(source)
873 local incs := $(abspathex $(incs),$(defpath))
874 else
875 local deps += $(source)
876 endif
878 # call the tool
879 ifndef TOOL_$(tool)_MOC_CPP_CMDS
880 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
881 endif
882 local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
883 local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
884 local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
885 local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
886 local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
888 # generate the link rule and update some source and target variables.
889 ifndef NO_COMPILE_CMDS_DEPS
890 $(eval includedep $(dep))
891 endif
892 $(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
894 endef # def_unit_qt4_target_pre_handle_moc_src
898 # Adds sources containing Q_OBJECT to QT_MOCSRCS.
899 define def_unit_qt4_target_pre_cpp_source
900 ifneq ($(file-size $(source)),-1)
901 ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
902 $(eval $(target)_QT_MOCSRCS += $(source))
903 endif
904 endif
905 endef # def_unit_qt4_target_pre_cpp_source
908 # Invoked early in the processing of a target that uses the Qt unit.
910 # It will append the qt source handlers to the target (.h, .ui, .ts,
911 # .png, .bmp, .gif).
913 # It will then check all the C++ sources and check which needs
914 # a .moc files and generate rules and dependencies fofor these
916 define def_unit_qt4_target_pre
918 # Make QTTOOL the default for the specific Qt tools instead of TOOL.
919 ifneq ($($(target)_QTTOOL),)
920 ifeq ($($(target)_MOCTOOL),)
921 $(target)_MOCTOOL := $($(target)_QTTOOL)
922 endif
923 ifeq ($($(target)_UICTOOL),)
924 $(target)_UICTOOL := $($(target)_QTTOOL)
925 endif
926 ifeq ($($(target)_RCCTOOL),)
927 $(target)_RCCTOOL := $($(target)_QTTOOL)
928 endif
929 ifeq ($($(target)_LRCTOOL),)
930 $(target)_LRCTOOL := $($(target)_QTTOOL)
931 endif
932 endif
934 # Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
935 local qt_modules := \
936 $($(target)_QT_MODULES.$(bld_trg)) \
937 $($(target)_QT_MODULES.$(bld_trg_arch)) \
938 $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
939 $($(target)_QT_MODULES.$(bld_trg_cpu)) \
940 $($(target)_QT_MODULES.$(bld_type)) \
941 $($(target)_QT_MODULES)
942 local qt_prefix := $(firstword \
943 $($(target)_QT_PREFIX.$(bld_trg)) \
944 $($(target)_QT_PREFIX.$(bld_trg_arch)) \
945 $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
946 $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
947 $($(target)_QT_PREFIX.$(bld_type)) \
948 $($(target)_QT_PREFIX))
949 local qt_infix := $(firstword \
950 $($(target)_QT_INFIX.$(bld_trg)) \
951 $($(target)_QT_INFIX.$(bld_trg_arch)) \
952 $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
953 $($(target)_QT_INFIX.$(bld_trg_cpu)) \
954 $($(target)_QT_INFIX.$(bld_type)) \
955 $($(target)_QT_INFIX))
956 ifeq ($(bld_trg),darwin)
957 # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
958 $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
959 $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
960 $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
961 $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
962 else
963 ifeq ($(bld_trg),win)
964 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
965 ifeq ($(tool_do),LINK_PROGRAM)
966 $(eval $(target)_LIBS += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
967 endif
968 else
969 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
970 endif
971 $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
972 endif
973 $(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
976 # Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
977 # Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
978 ifndef $(target)_QT_MOCSRCS
979 $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
980 $($(target)_SOURCES.$(bld_trg)) \
981 $($(target)_SOURCES.$(bld_trg_arch)) \
982 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
983 $($(target)_SOURCES.$(bld_trg_cpu)) \
984 $($(target)_SOURCES.$(bld_type)) \
985 $($(target)_SOURCES) \
986 ), $(evalval def_unit_qt4_target_pre_cpp_source))
987 endif
989 # Install source handlers for .ui files.
990 $(target)_SRC_HANDLERS += \
991 .ui:def_unit_qt4_src_handler_ui \
992 .UI:def_unit_qt4_src_handler_ui \
993 .qrc:def_unit_qt4_src_handler_qrc \
994 .qrc:def_unit_qt4_src_handler_qrc
996 # Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
997 local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
998 local qtuicdir := $($(target)_0_OUTDIR)/qtuic
999 local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
1000 local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
1001 $(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
1002 $(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
1004 # Deal with QT_MOCSRCS.
1005 $(foreach source, \
1006 $($(target)_QT_MOCSRCS.$(bld_trg)) \
1007 $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
1008 $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
1009 $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
1010 $($(target)_QT_MOCSRCS.$(bld_type)) \
1011 $($(target)_QT_MOCSRCS) \
1012 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
1014 # Deal with QT_MOCHDRS.
1015 $(foreach source, \
1016 $($(target)_QT_MOCHDRS.$(bld_trg)) \
1017 $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
1018 $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
1019 $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
1020 $($(target)_QT_MOCHDRS.$(bld_type)) \
1021 $($(target)_QT_MOCHDRS) \
1022 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
1024 # Deal with QT_TRANSLATIONS.
1025 # ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
1026 local translations := \
1027 $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
1028 $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
1029 $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
1030 $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
1031 $($(target)_QT_TRANSLATIONS.$(bld_type)) \
1032 $($(target)_QT_TRANSLATIONS)
1033 ifneq ($(strip $(translations)),)
1034 local expr := _ALL_INSTALLS += $(target)-inst-nls
1035 $(eval $(expr))
1036 ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
1037 $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
1038 else
1039 $(target)-inst-nls_MODE := 0644
1040 endif
1041 ifdef $(target)_QT_TRANSLATIONS_INST
1042 $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
1043 endif
1044 $(target)-inst-nls_SOURCES :=
1045 $(foreach source, $(translations)\
1046 , $(evalvalctx def_unit_qt4_target_pre_handle_translation))
1047 endif
1049 endef # def_unit_qt4_target_pre
1053 # Rule for debugging.
1055 unit-qt4-show-vars:
1056 @$(ECHO) 'The Qt4 SDK variables:'
1057 @$(ECHO) ' PATH_SDK_QT4 = "$(PATH_SDK_QT4)"'
1058 @$(ECHO) ' PATH_SDK_QT4_INC = "$(PATH_SDK_QT4_INC)"'
1059 @$(ECHO) ' PATH_SDK_QT4_LIB = "$(PATH_SDK_QT4_LIB)"'
1060 @$(ECHO) ' PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
1061 @$(ECHO) ' PATH_SDK_QT4_LIB.x86 = "$(PATH_SDK_QT4_LIB.x86)"'
1062 @$(ECHO) 'The Qt4 TOOL variables:'
1063 @$(ECHO) ' PATH_TOOL_QT4_BIN = "$(PATH_TOOL_QT4_BIN)"'
1064 @$(ECHO) ' TOOL_QT4_BIN_SUFF = "$(TOOL_QT4_BIN_SUFF)"'
1065 @$(ECHO) ' TOOL_QT4_MOC = "$(TOOL_QT4_MOC)"'
1066 @$(ECHO) ' TOOL_QT4_UIC = "$(TOOL_QT4_UIC)"'
1067 @$(ECHO) ' TOOL_QT4_RCC = "$(TOOL_QT4_RCC)"'
1068 @$(ECHO) ' TOOL_QT4_LRC = "$(TOOL_QT4_LRC)"'
1069 @$(ECHO) ' TOOL_QT4_LUPDATE = "$(TOOL_QT4_LUPDATE)"'