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

Last change on this file since 2320 was 2319, checked in by bird, 16 years ago

qt4.kmk: Fixed PATH_SDK_QT4_LIB detection.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.9 KB
Line 
1# $Id: qt4.kmk 2319 2009-04-10 14:33:45Z bird $
2## @file
3# Qt 4 unit.
4#
5
6#
7# Copyright (c) 2008-2009 knut st. osmundsen <bird-kBuild-spamix@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/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) \
123 )))
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) \
141 )))
142 ifneq ($(PATH_SDK_QT4_LIB.amd64),)
143 export PATH_SDK_QT4_LIB.amd64
144 endif
145 endif
146
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) \
158 )))
159 endif
160 ifneq ($(PATH_SDK_QT4_LIB),)
161 export PATH_SDK_QT4_LIB
162 endif
163 endif
164
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
174else
175 # Resolve any fancy stuff once and for all.
176 PATH_SDK_QT4 := $(PATH_SDK_QT4)
177endif
178
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.
181ifeq ($(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
189else
190 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
191 PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
192endif
193
194# The bits that kBuild picks up.
195# (nothing here)
196
197
198#
199# The QT4 tool.
200#
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.
203#
204TOOL_QT4 = Qt4
205
206# Tool Specific Properties
207# PATH_TOOL_QT4 - Obsolete.
208# PATH_TOOL_QT4_BIN - The
209# TOOL_QT4_BIN_SUFF -
210if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
211 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
212endif
213ifndef 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) \
230 )))
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 \
238 )))
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 \
247 )))
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 \
258 )))
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) \
267 )))
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 \
276 )))
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.
283else
284 # Resolve any fancy stuff once and for all.
285 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
286endif
287ifneq ($(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)
298else
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)
305endif
306
307# General Properties used by kBuild and/or units/qt.kmk
308TOOL_QT4_MOCFLAGS ?=
309TOOL_QT4_MOCINCS ?=
310TOOL_QT4_MOCDEFS ?=
311TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
312TOOL_QT4_MOCDEFS.solaris ?= __sun
313TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
314TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
315
316
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.
326#
327TOOL_QT4_MOC_CPP_DEPEND =
328TOOL_QT4_MOC_CPP_DEPORD =
329TOOL_QT4_MOC_CPP_OUTPUT =
330TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
331define 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)
338endef
339
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.
349#
350TOOL_QT4_MOC_HPP_DEPEND =
351TOOL_QT4_MOC_HPP_DEPORD =
352TOOL_QT4_MOC_HPP_OUTPUT =
353TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
354define 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)
361endef
362
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.
372#
373TOOL_QT4_UIC_UI_DEPEND =
374TOOL_QT4_UIC_UI_DEPORD =
375TOOL_QT4_UIC_UI_OUTPUT =
376TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
377define TOOL_QT4_UIC_UI_CMDS
378 $(QUIET)$(TOOL_QT4_UIC)\
379 $(flags)\
380 -o $(out)\
381 $(source)
382endef
383
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.
393#
394# @remarks The sed script generating the dependency file is a bit naive.
395TOOL_QT4_RCC_QRC_DEPEND =
396TOOL_QT4_RCC_QRC_DEPORD =
397TOOL_QT4_RCC_QRC_OUTPUT =
398TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
399define 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)
423endef
424
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.
434#
435TOOL_QT4_LRC_TS_DEPEND =
436TOOL_QT4_LRC_TS_DEPORD =
437TOOL_QT4_LRC_TS_OUTPUT =
438TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
439define TOOL_QT4_LRC_TS_CMDS
440 $(QUIET)$(TOOL_QT4_LRC)\
441 $(flags)\
442 $(source)\
443 -qm $(out)
444endef
445
446
447
448#
449#
450# Back to the Qt4 unit.
451#
452#
453
454
455## wrapper for the lrelease (LRC) command dependencies.
456ifndef NO_COMPILE_CMDS_DEPS
457 _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
458else
459 _UNIT_QT4_LRC_CMDS_DEP =
460endif
461
462##
463# def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
464#
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.
468#
469define def_unit_qt4_target_pre_handle_translation_dx
470
471$(out) + $(more_output) +| $(maybe_output): \
472 $(deps) \
473 $(value _UNIT_QT4_LRC_CMDS_DEP) \
474 | \
475 $(orderdeps)
476 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
477 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
478
479$(cmds)
480
481ifndef 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'
486endif
487
488$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
489$(target)-inst-nls_SOURCES += $(out)
490
491endef # def_unit_qt4_target_pre_handle_translation_dx
492
493##
494# Handle a source file listed in QT_TRANSLATIONS.
495#
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.
498#
499# @remarks Invoked via $(evalvalctx ).
500define def_unit_qt4_target_pre_handle_translation
501local type := LRC
502
503# fetch the properties.
504local tool := $(kb-src-tool dummy_var)
505local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
506local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
507local out := $(outbase).qm
508local dep := $(out).dep
509local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
510local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
511local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
512
513# default path + source dep.
514ifneq ($(defpath),)
515local source := $(abspathex $(source),$(defpath))
516local deps := $(abspathex $(deps),$(defpath)) $(source)
517local incs := $(abspathex $(incs),$(defpath))
518else
519local deps += $(source)
520endif
521
522# call the tool
523ifndef TOOL_$(tool)_LRC_TS_CMDS
524 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
525endif
526local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
527local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
528local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
529local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
530local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
531
532# generate the link rule and update some source and target variables.
533ifndef NO_COMPILE_CMDS_DEPS
534 $(eval includedep $(dep))
535endif
536$(eval $(def_unit_qt4_target_pre_handle_translation_dx))
537
538endef # def_unit_qt4_target_pre_handle_translation
539
540
541
542## wrapper for the UIC command dependencies.
543ifndef NO_COMPILE_CMDS_DEPS
544 _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
545else
546 _UNIT_QT4_RCC_CMDS_DEP =
547endif
548
549##
550# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
551#
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.
555#
556define def_unit_qt4_target_pre_handle_rcc_dx
557
558$(out) +| $(realout) $(more_output) $(maybe_output): \
559 $(deps) \
560 $(value _UNIT_QT4_RCC_CMDS_DEP) \
561 | \
562 $(orderdeps)
563 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
564 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
565
566$(cmds)
567
568 $(QUIET)$(CP) --changed -f $(out) $(realout)
569ifndef 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'
574endif
575
576$(target)_INTERMEDIATES += $(realout)
577$(target)_GEN_SOURCES_ += $(realout)
578$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
579
580endef # def_unit_qt4_target_pre_handle_rcc_dx
581
582##
583# Source handler for .qrc sources (Qt resource files).
584#
585# @remarks $(evalvalctx me).
586define def_unit_qt4_src_handler_qrc
587local type := RCC
588
589# fetch the properties.
590local tool := $(kb-src-tool dummy_var)
591local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
592local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
593local out := $(outbase).tmp.gen.cpp
594local realout := $(outbase).gen.cpp
595local dep := $(realout).dep
596local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
597local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
598local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
599
600# default path + source dep.
601ifneq ($(defpath),)
602local source := $(abspathex $(source),$(defpath))
603local deps := $(abspathex $(deps),$(defpath)) $(source)
604local incs := $(abspathex $(incs),$(defpath))
605else
606local deps += $(source)
607endif
608
609# call the tool
610ifndef TOOL_$(tool)_RCC_QRC_CMDS
611 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
612endif
613local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
614local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
615local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
616local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
617local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
618
619# generate the link rule and update some source and target variables.
620ifndef NO_COMPILE_CMDS_DEPS
621 $(eval includedep $(dep))
622endif
623$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
624
625endef # def_unit_qt4_src_handler_qrc
626
627
628
629## wrapper for the UIC command dependencies.
630ifndef NO_COMPILE_CMDS_DEPS
631 _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
632else
633 _UNIT_QT4_UIC_CMDS_DEP =
634endif
635
636##
637# def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
638#
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.
642#
643define def_unit_qt4_target_pre_handle_ui_dx
644
645$(out) +| $(realout) $(more_output) $(maybe_output): \
646 $(deps) \
647 $(value _UNIT_QT4_UIC_CMDS_DEP) \
648 | \
649 $(orderdeps)
650 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
651 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
652
653$(cmds)
654
655 $(QUIET)$(CP) --changed -f $(out) $(realout)
656ifndef 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'
661endif
662
663$(target)_INTERMEDIATES += $(realout)
664$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
665
666endef # def_unit_qt4_target_pre_handle_ui_dx
667
668##
669# Source handler for .ui sources.
670#
671# @remarks $(evalvalctx me).
672define def_unit_qt4_src_handler_ui
673local type := UIC
674
675# fetch the properties.
676local tool := $(kb-src-tool dummy_var)
677local qtuicdir := $($(target)_0_OUTDIR)/qtuic
678local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
679local out := $(outbase).tmp.gen.h
680local realout := $(outbase).gen.h
681local dep := $(realout).dep
682local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
683local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
684local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
685
686# default path + source dep.
687ifneq ($(defpath),)
688local source := $(abspathex $(source),$(defpath))
689local deps := $(abspathex $(deps),$(defpath)) $(source)
690local incs := $(abspathex $(incs),$(defpath))
691else
692local deps += $(source)
693endif
694
695# call the tool
696ifndef TOOL_$(tool)_UIC_UI_CMDS
697 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
698endif
699local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
700local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
701local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
702local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
703local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
704
705# generate the link rule and update some source and target variables.
706ifndef NO_COMPILE_CMDS_DEPS
707 $(eval includedep $(dep))
708endif
709$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
710
711endef # def_unit_qt4_src_handler_ui
712
713
714
715## wrapper for the MOC command dependencies.
716ifndef 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)
718else
719 _UNIT_QT4_MOC_HPP_CMDS_DEP =
720endif
721
722##
723# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
724#
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.
728#
729define def_unit_qt4_target_pre_handle_moc_hdr_dx
730
731$(out) +| $(realout) $(more_output) $(maybe_output): \
732 $(deps) \
733 $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
734 | \
735 $(orderdeps)
736 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
737 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
738
739$(cmds)
740
741 $(QUIET)$(CP) --changed -f $(out) $(realout)
742ifndef 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'
747endif
748
749$(target)_INTERMEDIATES += $(realout)
750$(target)_GEN_SOURCES_ += $(realout)
751$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
752
753endef
754
755##
756# Handle a source file listed in QT_MOCHDRS.
757#
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.)
763#
764# @remarks Invoked via $(evalvalctx ).
765define def_unit_qt4_target_pre_handle_moc_hdr
766local type := MOC
767
768# fetch the properties.
769local tool := $(kb-src-tool dummy_var)
770local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
771local out := $(outbase).tmp.cpp
772local realout := $(outbase).cpp
773local dep := $(realout).dep
774local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
775local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
776local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
777local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
778local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
779
780# default path + source dep.
781ifneq ($(defpath),)
782local source := $(abspathex $(source),$(defpath))
783local deps := $(abspathex $(deps),$(defpath)) $(source)
784local incs := $(abspathex $(incs),$(defpath))
785else
786local deps += $(source)
787endif
788
789# call the tool
790ifndef TOOL_$(tool)_MOC_HPP_CMDS
791 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
792endif
793local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
794local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
795local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
796local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
797local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
798
799# generate the link rule and update some source and target variables.
800ifndef NO_COMPILE_CMDS_DEPS
801 $(eval includedep $(dep))
802endif
803$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
804
805endef # def_unit_qt4_target_pre_handle_moc_hdr
806
807
808## wrapper for the MOC command dependencies.
809ifndef 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)
811else
812 _UNIT_QT4_MOC_CPP_CMDS_DEP =
813endif
814
815##
816# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
817#
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.
821#
822define def_unit_qt4_target_pre_handle_moc_src_dx
823
824$(out) +| $(realout) $(more_output) $(maybe_output): \
825 $(deps) \
826 $(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
827 | \
828 $(orderdeps)
829 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
830 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
831
832$(cmds)
833
834 $(QUIET)$(CP) --changed -f $(out) $(realout)
835ifndef 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'
840endif
841
842$(target)_INTERMEDIATES += $(realout)
843$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
844
845endef
846
847##
848# Handle a source file listed in QT_MOCSRCS.
849#
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.
852#
853# @remarks Invoked via $(evalvalctx ).
854define def_unit_qt4_target_pre_handle_moc_src
855local type := MOC
856
857# fetch the properties.
858local tool := $(kb-src-tool dummy_var)
859local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
860local out := $(outbase).tmp.moc
861local realout := $(outbase).moc
862local dep := $(realout).dep
863local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
864local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
865local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
866local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
867local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
868
869# default path + source dep.
870ifneq ($(defpath),)
871local source := $(abspathex $(source),$(defpath))
872local deps := $(abspathex $(deps),$(defpath)) $(source)
873local incs := $(abspathex $(incs),$(defpath))
874else
875local deps += $(source)
876endif
877
878# call the tool
879ifndef TOOL_$(tool)_MOC_CPP_CMDS
880 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
881endif
882local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
883local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
884local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
885local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
886local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
887
888# generate the link rule and update some source and target variables.
889ifndef NO_COMPILE_CMDS_DEPS
890 $(eval includedep $(dep))
891endif
892$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
893
894endef # def_unit_qt4_target_pre_handle_moc_src
895
896
897##
898# Adds sources containing Q_OBJECT to QT_MOCSRCS.
899define def_unit_qt4_target_pre_cpp_source
900ifneq ($(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
904endif
905endef # def_unit_qt4_target_pre_cpp_source
906
907##
908# Invoked early in the processing of a target that uses the Qt unit.
909#
910# It will append the qt source handlers to the target (.h, .ui, .ts,
911# .png, .bmp, .gif).
912#
913# It will then check all the C++ sources and check which needs
914# a .moc files and generate rules and dependencies fofor these
915#
916define def_unit_qt4_target_pre
917
918# Make QTTOOL the default for the specific Qt tools instead of TOOL.
919ifneq ($($(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
932endif
933
934# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
935local 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)
942local 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))
949local 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))
956ifeq ($(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)_LDFLAGS += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
960 $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
961else
962 ifeq ($(bld_trg),win)
963 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
964 ifeq ($(tool_do),LINK_PROGRAM)
965 $(eval $(target)_LIBS += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
966 endif
967 else
968 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
969 endif
970 $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
971endif
972$(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
973
974
975# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
976# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
977ifndef $(target)_QT_MOCSRCS
978 $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
979 $($(target)_SOURCES.$(bld_trg)) \
980 $($(target)_SOURCES.$(bld_trg_arch)) \
981 $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
982 $($(target)_SOURCES.$(bld_trg_cpu)) \
983 $($(target)_SOURCES.$(bld_type)) \
984 $($(target)_SOURCES) \
985 ), $(evalval def_unit_qt4_target_pre_cpp_source))
986endif
987
988# Install source handlers for .ui files.
989$(target)_SRC_HANDLERS += \
990 .ui:def_unit_qt4_src_handler_ui \
991 .UI:def_unit_qt4_src_handler_ui \
992 .qrc:def_unit_qt4_src_handler_qrc \
993 .qrc:def_unit_qt4_src_handler_qrc
994
995# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
996local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
997local qtuicdir := $($(target)_0_OUTDIR)/qtuic
998local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
999local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
1000$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
1001$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
1002
1003# Deal with QT_MOCSRCS.
1004$(foreach source, \
1005 $($(target)_QT_MOCSRCS.$(bld_trg)) \
1006 $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
1007 $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
1008 $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
1009 $($(target)_QT_MOCSRCS.$(bld_type)) \
1010 $($(target)_QT_MOCSRCS) \
1011 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
1012
1013# Deal with QT_MOCHDRS.
1014$(foreach source, \
1015 $($(target)_QT_MOCHDRS.$(bld_trg)) \
1016 $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
1017 $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
1018 $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
1019 $($(target)_QT_MOCHDRS.$(bld_type)) \
1020 $($(target)_QT_MOCHDRS) \
1021 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
1022
1023# Deal with QT_TRANSLATIONS.
1024# ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
1025local translations := \
1026 $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
1027 $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
1028 $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
1029 $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
1030 $($(target)_QT_TRANSLATIONS.$(bld_type)) \
1031 $($(target)_QT_TRANSLATIONS)
1032ifneq ($(strip $(translations)),)
1033 local expr := _ALL_INSTALLS += $(target)-inst-nls
1034 $(eval $(expr))
1035 ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
1036 $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
1037 else
1038 $(target)-inst-nls_MODE := 0644
1039 endif
1040 ifdef $(target)_QT_TRANSLATIONS_INST
1041 $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
1042 endif
1043 $(target)-inst-nls_SOURCES :=
1044 $(foreach source, $(translations)\
1045 , $(evalvalctx def_unit_qt4_target_pre_handle_translation))
1046endif
1047
1048endef # def_unit_qt4_target_pre
1049
1050
1051#
1052# Rule for debugging.
1053#
1054unit-qt4-show-vars:
1055 @$(ECHO) 'The Qt4 SDK variables:'
1056 @$(ECHO) ' PATH_SDK_QT4 = "$(PATH_SDK_QT4)"'
1057 @$(ECHO) ' PATH_SDK_QT4_INC = "$(PATH_SDK_QT4_INC)"'
1058 @$(ECHO) ' PATH_SDK_QT4_LIB = "$(PATH_SDK_QT4_LIB)"'
1059 @$(ECHO) ' PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
1060 @$(ECHO) ' PATH_SDK_QT4_LIB.x86 = "$(PATH_SDK_QT4_LIB.x86)"'
1061 @$(ECHO) 'The Qt4 TOOL variables:'
1062 @$(ECHO) ' PATH_TOOL_QT4_BIN = "$(PATH_TOOL_QT4_BIN)"'
1063 @$(ECHO) ' TOOL_QT4_BIN_SUFF = "$(TOOL_QT4_BIN_SUFF)"'
1064 @$(ECHO) ' TOOL_QT4_MOC = "$(TOOL_QT4_MOC)"'
1065 @$(ECHO) ' TOOL_QT4_UIC = "$(TOOL_QT4_UIC)"'
1066 @$(ECHO) ' TOOL_QT4_RCC = "$(TOOL_QT4_RCC)"'
1067 @$(ECHO) ' TOOL_QT4_LRC = "$(TOOL_QT4_LRC)"'
1068 @$(ECHO) ' TOOL_QT4_LUPDATE = "$(TOOL_QT4_LUPDATE)"'
1069
Note: See TracBrowser for help on using the repository browser.