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

Last change on this file since 2243 was 2243, checked in by bird, 17 years ago

*: Updated copyright to 2009 and normalized name & email.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 35.8 KB
Line 
1# $Id: qt4.kmk 2243 2009-01-10 02:24:02Z 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 $(PATH_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))
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 := $(PATH_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 $(PATH_DEVTOOLS_BLD)/qt/v4*/bin)))
215 ifeq ($(PATH_TOOL_QT4_BIN),)
216 ifdef TOOL_QT4_BIN_SUFF
217 TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
218 endif
219 # Try looking for moc-qt4 / moc-$(suffix) first.
220 ifneq ($(TOOL_QT4_BIN_SUFF),)
221 PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
222 /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
223 /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
224 /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
225 /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
226 /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
227 )))
228 else
229 PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
230 /usr/lib/qt4/bin/moc-qt4 \
231 /usr/qt/4/bin/moc-qt4 \
232 /usr/share/qt4/bin/moc-qt4 \
233 /usr/local/bin/moc-qt4 \
234 /usr/bin/moc-qt4 \
235 )))
236 ifneq ($(PATH_TOOL_QT4_BIN),)
237 TOOL_QT4_BIN_SUFF := -qt4
238 else
239 # If no luck, try looking for moc in the qt4 specific locations.
240 PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
241 /usr/lib/qt4/bin/moc \
242 /usr/qt/4/bin/moc \
243 /usr/share/qt4/bin/moc \
244 )))
245 endif
246 endif
247 # If still no go, try looking for qt3to4 and rcc.
248 ifeq ($(PATH_TOOL_QT4_BIN),)
249 PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
250 /usr/lib/qt4/bin/qt3to4 \
251 /usr/qt/4/bin/qt3to4 \
252 /usr/share/qt4/bin/qt3to4 \
253 /usr/local/bin/qt3to4 \
254 /usr/bin/qt3to4 \
255 )))
256 endif
257 ifeq ($(PATH_TOOL_QT4_BIN),)
258 PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
259 /usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
260 /usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
261 /usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
262 /usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
263 /usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
264 )))
265 endif
266 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
267 PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
268 /usr/lib/qt4/bin/rcc \
269 /usr/qt/4/bin/rcc \
270 /usr/share/qt4/bin/rcc \
271 /usr/local/bin/rcc \
272 /usr/bin/rcc \
273 )))
274 endif
275 ifneq ($(PATH_TOOL_QT4_BIN),)
276 export PATH_TOOL_QT4_BIN
277 endif
278 endif
279 # If not found, we'll enter the 'pathless' mode.
280else
281 # Resolve any fancy stuff once and for all.
282 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
283endif
284ifneq ($(PATH_TOOL_QT4_BIN),)
285 TOOL_QT4_MOC ?= $(PATH_TOOL_QT4_BIN)/moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
286 TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
287 ifndef TOOL_QT4_RCC
288 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
289 ifeq ($(wildcard $(TOOL_QT4_RCC)),)
290 TOOL_QT4_RCC := $(PATH_TOOL_QT4_BIN)/rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
291 endif
292 endif
293 TOOL_QT4_LRC ?= $(PATH_TOOL_QT4_BIN)/lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
294 TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
295else
296 # Pathless, relies on the environment.
297 TOOL_QT4_MOC ?= moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
298 TOOL_QT4_UIC ?= uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
299 TOOL_QT4_RCC ?= rcc$(HOST_SUFF_EXE)
300 TOOL_QT4_LRC ?= lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
301 TOOL_QT4_LUPDATE ?= lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
302endif
303
304# General Properties used by kBuild and/or units/qt.kmk
305TOOL_QT4_MOCFLAGS ?=
306TOOL_QT4_MOCINCS ?=
307TOOL_QT4_MOCDEFS ?=
308TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
309TOOL_QT4_MOCDEFS.solaris ?= __sun
310TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
311TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
312
313
314## MOC a C++ source file.
315# @param $(target) Normalized main target name.
316# @param $(source) Source filename (relative).
317# @param $(out) Object file name. This shall be (re)created by the compilation.
318# @param $(dep) Dependcy file. This may be (re)created by the compilation.
319# @param $(flags) Flags.
320# @param $(defs) Definitions.
321# @param $(incs) Includes.
322# @param $(outbase) Output basename (full). Use this for list files and such.
323#
324TOOL_QT4_MOC_CPP_DEPEND =
325TOOL_QT4_MOC_CPP_DEPORD =
326TOOL_QT4_MOC_CPP_OUTPUT =
327TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
328define TOOL_QT4_MOC_CPP_CMDS
329 $(QUIET)$(TOOL_QT4_MOC)\
330 $(flags)\
331 $(addprefix -I, $(incs))\
332 $(addprefix -D, $(defs))\
333 -o $(out)\
334 $(source)
335endef
336
337## MOC a C++ header file.
338# @param $(target) Normalized main target name.
339# @param $(source) Source filename (relative).
340# @param $(out) Object file name. This shall be (re)created by the compilation.
341# @param $(dep) Dependcy file. This may be (re)created by the compilation.
342# @param $(flags) Flags.
343# @param $(defs) Definitions.
344# @param $(incs) Includes.
345# @param $(outbase) Output basename (full). Use this for list files and such.
346#
347TOOL_QT4_MOC_HPP_DEPEND =
348TOOL_QT4_MOC_HPP_DEPORD =
349TOOL_QT4_MOC_HPP_OUTPUT =
350TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
351define TOOL_QT4_MOC_HPP_CMDS
352 $(QUIET)$(TOOL_QT4_MOC)\
353 $(flags)\
354 $(addprefix -I, $(incs))\
355 $(addprefix -D, $(defs))\
356 -o $(out)\
357 $(source)
358endef
359
360## Compile a Qt user interface file (.ui).
361# @param $(target) Normalized main target name.
362# @param $(source) Source filename (relative).
363# @param $(out) Object file name. This shall be (re)created by the compilation.
364# @param $(dep) Dependcy file. This may be (re)created by the compilation.
365# @param $(flags) Flags.
366# @param $(defs) Definitions.
367# @param $(incs) Includes.
368# @param $(outbase) Output basename (full). Use this for list files and such.
369#
370TOOL_QT4_UIC_UI_DEPEND =
371TOOL_QT4_UIC_UI_DEPORD =
372TOOL_QT4_UIC_UI_OUTPUT =
373TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
374define TOOL_QT4_UIC_UI_CMDS
375 $(QUIET)$(TOOL_QT4_UIC)\
376 $(flags)\
377 -o $(out)\
378 $(source)
379endef
380
381## Compile a Qt resource file (.qrc).
382# @param $(target) Normalized main target name.
383# @param $(source) Source filename (relative).
384# @param $(out) Object file name. This shall be (re)created by the compilation.
385# @param $(dep) Dependcy file. This may be (re)created by the compilation.
386# @param $(flags) Flags.
387# @param $(defs) Definitions.
388# @param $(incs) Includes.
389# @param $(outbase) Output basename (full). Use this for list files and such.
390#
391# @remarks The sed script generating the dependency file is a bit naive.
392TOOL_QT4_RCC_QRC_DEPEND =
393TOOL_QT4_RCC_QRC_DEPORD =
394TOOL_QT4_RCC_QRC_OUTPUT =
395TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
396define TOOL_QT4_RCC_QRC_CMDS
397 $(QUIET)$(TOOL_QT4_RCC)\
398 $(flags)\
399 -o $(out)\
400 $(source)
401 $(APPEND) $(dep) '\'
402 $(APPEND) $(dep) '$(out): \'
403 $(APPEND) $(dep) '$(source) \'
404 $(SED) \
405 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
406 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
407 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
408 -e 's|$$$$| \\|' \
409 --append $(dep) \
410 $(source)
411 $(APPEND) $(dep)
412 $(SED) \
413 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
414 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
415 -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
416 -e 's|$$$$|:\n|' \
417 --append $(dep) \
418 $(source)
419 $(APPEND) $(dep)
420endef
421
422## Compile a Qt translation file (.ts).
423# @param $(target) Normalized main target name.
424# @param $(source) Source filename (relative).
425# @param $(out) Object file name. This shall be (re)created by the compilation.
426# @param $(dep) Dependcy file. This may be (re)created by the compilation.
427# @param $(flags) Flags.
428# @param $(defs) Definitions.
429# @param $(incs) Includes.
430# @param $(outbase) Output basename (full). Use this for list files and such.
431#
432TOOL_QT4_LRC_TS_DEPEND =
433TOOL_QT4_LRC_TS_DEPORD =
434TOOL_QT4_LRC_TS_OUTPUT =
435TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
436define TOOL_QT4_LRC_TS_CMDS
437 $(QUIET)$(TOOL_QT4_LRC)\
438 $(flags)\
439 $(source)\
440 -qm $(out)
441endef
442
443
444
445#
446#
447# Back to the Qt4 unit.
448#
449#
450
451
452## wrapper for the lrelease (LRC) command dependencies.
453ifndef NO_COMPILE_CMDS_DEPS
454 _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
455else
456 _UNIT_QT4_LRC_CMDS_DEP =
457endif
458
459##
460# def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
461#
462# This is necessary to resolve reference to local variables before doing
463# assignments and setting up commands. They would otherwise be resolved
464# later in a different context and the result would be completely wrong.
465#
466define def_unit_qt4_target_pre_handle_translation_dx
467
468$(out) + $(more_output) +| $(maybe_output): \
469 $(deps) \
470 $(value _UNIT_QT4_LRC_CMDS_DEP) \
471 | \
472 $(orderdeps)
473 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
474 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
475
476$(cmds)
477
478ifndef NO_COMPILE_CMDS_DEPS
479 %$$(QUIET2)$$(APPEND) '$(dep)'
480 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_'
481 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
482 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
483endif
484
485$(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
486$(target)-inst-nls_SOURCES += $(out)
487
488endef # def_unit_qt4_target_pre_handle_translation_dx
489
490##
491# Handle a source file listed in QT_TRANSLATIONS.
492#
493# The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
494# to be translated into .qm files that are loadble by Qt.
495#
496# @remarks Invoked via $(evalvalctx ).
497define def_unit_qt4_target_pre_handle_translation
498local type := LRC
499
500# fetch the properties.
501local tool := $(kb-src-tool dummy_var)
502local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
503local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
504local out := $(outbase).qm
505local dep := $(out).dep
506local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
507local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
508local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
509
510# default path + source dep.
511ifneq ($(defpath),)
512local source := $(abspathex $(source),$(defpath))
513local deps := $(abspathex $(deps),$(defpath)) $(source)
514local incs := $(abspathex $(incs),$(defpath))
515else
516local deps += $(source)
517endif
518
519# call the tool
520ifndef TOOL_$(tool)_LRC_TS_CMDS
521 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
522endif
523local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
524local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
525local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
526local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
527local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
528
529# generate the link rule and update some source and target variables.
530ifndef NO_COMPILE_CMDS_DEPS
531 $(eval includedep $(dep))
532endif
533$(eval $(def_unit_qt4_target_pre_handle_translation_dx))
534
535endef # def_unit_qt4_target_pre_handle_translation
536
537
538
539## wrapper for the UIC command dependencies.
540ifndef NO_COMPILE_CMDS_DEPS
541 _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
542else
543 _UNIT_QT4_RCC_CMDS_DEP =
544endif
545
546##
547# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
548#
549# This is necessary to resolve reference to local variables before doing
550# assignments and setting up commands. They would otherwise be resolved
551# later in a different context and the result would be completely wrong.
552#
553define def_unit_qt4_target_pre_handle_rcc_dx
554
555$(out) +| $(realout) $(more_output) $(maybe_output): \
556 $(deps) \
557 $(value _UNIT_QT4_RCC_CMDS_DEP) \
558 | \
559 $(orderdeps)
560 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
561 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
562
563$(cmds)
564
565 $(QUIET)$(CP) --changed -f $(out) $(realout)
566ifndef NO_COMPILE_CMDS_DEPS
567 %$$(QUIET2)$$(APPEND) '$(dep)'
568 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_'
569 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
570 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
571endif
572
573$(target)_INTERMEDIATES += $(realout)
574$(target)_GEN_SOURCES_ += $(realout)
575$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
576
577endef # def_unit_qt4_target_pre_handle_rcc_dx
578
579##
580# Source handler for .qrc sources (Qt resource files).
581#
582# @remarks $(evalvalctx me).
583define def_unit_qt4_src_handler_qrc
584local type := RCC
585
586# fetch the properties.
587local tool := $(kb-src-tool dummy_var)
588local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
589local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
590local out := $(outbase).tmp.gen.cpp
591local realout := $(outbase).gen.cpp
592local dep := $(realout).dep
593local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
594local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
595local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
596
597# default path + source dep.
598ifneq ($(defpath),)
599local source := $(abspathex $(source),$(defpath))
600local deps := $(abspathex $(deps),$(defpath)) $(source)
601local incs := $(abspathex $(incs),$(defpath))
602else
603local deps += $(source)
604endif
605
606# call the tool
607ifndef TOOL_$(tool)_RCC_QRC_CMDS
608 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
609endif
610local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
611local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
612local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
613local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
614local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
615
616# generate the link rule and update some source and target variables.
617ifndef NO_COMPILE_CMDS_DEPS
618 $(eval includedep $(dep))
619endif
620$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
621
622endef # def_unit_qt4_src_handler_qrc
623
624
625
626## wrapper for the UIC command dependencies.
627ifndef NO_COMPILE_CMDS_DEPS
628 _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
629else
630 _UNIT_QT4_UIC_CMDS_DEP =
631endif
632
633##
634# def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
635#
636# This is necessary to resolve reference to local variables before doing
637# assignments and setting up commands. They would otherwise be resolved
638# later in a different context and the result would be completely wrong.
639#
640define def_unit_qt4_target_pre_handle_ui_dx
641
642$(out) +| $(realout) $(more_output) $(maybe_output): \
643 $(deps) \
644 $(value _UNIT_QT4_UIC_CMDS_DEP) \
645 | \
646 $(orderdeps)
647 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
648 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
649
650$(cmds)
651
652 $(QUIET)$(CP) --changed -f $(out) $(realout)
653ifndef NO_COMPILE_CMDS_DEPS
654 %$$(QUIET2)$$(APPEND) '$(dep)'
655 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_'
656 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
657 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
658endif
659
660$(target)_INTERMEDIATES += $(realout)
661$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
662
663endef # def_unit_qt4_target_pre_handle_ui_dx
664
665##
666# Source handler for .ui sources.
667#
668# @remarks $(evalvalctx me).
669define def_unit_qt4_src_handler_ui
670local type := UIC
671
672# fetch the properties.
673local tool := $(kb-src-tool dummy_var)
674local qtuicdir := $($(target)_0_OUTDIR)/qtuic
675local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
676local out := $(outbase).tmp.gen.h
677local realout := $(outbase).gen.h
678local dep := $(realout).dep
679local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
680local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
681local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
682
683# default path + source dep.
684ifneq ($(defpath),)
685local source := $(abspathex $(source),$(defpath))
686local deps := $(abspathex $(deps),$(defpath)) $(source)
687local incs := $(abspathex $(incs),$(defpath))
688else
689local deps += $(source)
690endif
691
692# call the tool
693ifndef TOOL_$(tool)_UIC_UI_CMDS
694 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
695endif
696local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
697local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
698local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
699local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
700local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
701
702# generate the link rule and update some source and target variables.
703ifndef NO_COMPILE_CMDS_DEPS
704 $(eval includedep $(dep))
705endif
706$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
707
708endef # def_unit_qt4_src_handler_ui
709
710
711
712## wrapper for the MOC command dependencies.
713ifndef NO_COMPILE_CMDS_DEPS
714 _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
715else
716 _UNIT_QT4_MOC_HPP_CMDS_DEP =
717endif
718
719##
720# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
721#
722# This is necessary to resolve reference to local variables before doing
723# assignments and setting up commands. They would otherwise be resolved
724# later in a different context and the result would be completely wrong.
725#
726define def_unit_qt4_target_pre_handle_moc_hdr_dx
727
728$(out) +| $(realout) $(more_output) $(maybe_output): \
729 $(deps) \
730 $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
731 | \
732 $(orderdeps)
733 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
734 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
735
736$(cmds)
737
738 $(QUIET)$(CP) --changed -f $(out) $(realout)
739ifndef NO_COMPILE_CMDS_DEPS
740 %$$(QUIET2)$$(APPEND) '$(dep)'
741 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_'
742 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
743 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
744endif
745
746$(target)_INTERMEDIATES += $(realout)
747$(target)_GEN_SOURCES_ += $(realout)
748$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
749
750endef
751
752##
753# Handle a source file listed in QT_MOCHDRS.
754#
755# The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
756# generate a .cpp file for each of them and add it to the generated
757# sources so that it's compiled and linked. (There is an alternative
758# way to do this where the .cpp file is included, this isn't currently
759# supported by this unit.)
760#
761# @remarks Invoked via $(evalvalctx ).
762define def_unit_qt4_target_pre_handle_moc_hdr
763local type := MOC
764
765# fetch the properties.
766local tool := $(kb-src-tool dummy_var)
767local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
768local out := $(outbase).tmp.cpp
769local realout := $(outbase).cpp
770local dep := $(realout).dep
771local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
772local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
773local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
774local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
775local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
776
777# default path + source dep.
778ifneq ($(defpath),)
779local source := $(abspathex $(source),$(defpath))
780local deps := $(abspathex $(deps),$(defpath)) $(source)
781local incs := $(abspathex $(incs),$(defpath))
782else
783local deps += $(source)
784endif
785
786# call the tool
787ifndef TOOL_$(tool)_MOC_HPP_CMDS
788 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
789endif
790local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
791local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
792local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
793local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
794local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
795
796# generate the link rule and update some source and target variables.
797ifndef NO_COMPILE_CMDS_DEPS
798 $(eval includedep $(dep))
799endif
800$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
801
802endef # def_unit_qt4_target_pre_handle_moc_hdr
803
804
805## wrapper for the MOC command dependencies.
806ifndef NO_COMPILE_CMDS_DEPS
807 _UNIT_QT4_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
808else
809 _UNIT_QT4_MOC_CPP_CMDS_DEP =
810endif
811
812##
813# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
814#
815# This is necessary to resolve reference to local variables before doing
816# assignments and setting up commands. They would otherwise be resolved
817# later in a different context and the result would be completely wrong.
818#
819define def_unit_qt4_target_pre_handle_moc_src_dx
820
821$(out) +| $(realout) $(more_output) $(maybe_output): \
822 $(deps) \
823 $(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
824 | \
825 $(orderdeps)
826 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
827 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
828
829$(cmds)
830
831 $(QUIET)$(CP) --changed -f $(out) $(realout)
832ifndef NO_COMPILE_CMDS_DEPS
833 %$$(QUIET2)$$(APPEND) '$(dep)'
834 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
835 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
836 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
837endif
838
839$(target)_INTERMEDIATES += $(realout)
840$(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
841
842endef
843
844##
845# Handle a source file listed in QT_MOCSRCS.
846#
847# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
848# a .moc file that we're expected to generate here.
849#
850# @remarks Invoked via $(evalvalctx ).
851define def_unit_qt4_target_pre_handle_moc_src
852local type := MOC
853
854# fetch the properties.
855local tool := $(kb-src-tool dummy_var)
856local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
857local out := $(outbase).tmp.moc
858local realout := $(outbase).moc
859local dep := $(realout).dep
860local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
861local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
862local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
863local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
864local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
865
866# default path + source dep.
867ifneq ($(defpath),)
868local source := $(abspathex $(source),$(defpath))
869local deps := $(abspathex $(deps),$(defpath)) $(source)
870local incs := $(abspathex $(incs),$(defpath))
871else
872local deps += $(source)
873endif
874
875# call the tool
876ifndef TOOL_$(tool)_MOC_CPP_CMDS
877 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
878endif
879local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
880local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
881local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
882local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
883local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
884
885# generate the link rule and update some source and target variables.
886ifndef NO_COMPILE_CMDS_DEPS
887 $(eval includedep $(dep))
888endif
889$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
890
891endef # def_unit_qt4_target_pre_handle_moc_src
892
893
894##
895# Adds sources containing Q_OBJECT to QT_MOCSRCS.
896define def_unit_qt4_target_pre_cpp_source
897ifneq ($(file-size $(source)),-1)
898 ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
899 $(eval $(target)_QT_MOCSRCS += $(source))
900 endif
901endif
902endef # def_unit_qt4_target_pre_cpp_source
903
904##
905# Invoked early in the processing of a target that uses the Qt unit.
906#
907# It will append the qt source handlers to the target (.h, .ui, .ts,
908# .png, .bmp, .gif).
909#
910# It will then check all the C++ sources and check which needs
911# a .moc files and generate rules and dependencies fofor these
912#
913define def_unit_qt4_target_pre
914
915# Make QTTOOL the default for the specific Qt tools instead of TOOL.
916ifneq ($($(target)_QTTOOL),)
917 ifeq ($($(target)_MOCTOOL),)
918 $(target)_MOCTOOL := $($(target)_QTTOOL)
919 endif
920 ifeq ($($(target)_UICTOOL),)
921 $(target)_UICTOOL := $($(target)_QTTOOL)
922 endif
923 ifeq ($($(target)_RCCTOOL),)
924 $(target)_RCCTOOL := $($(target)_QTTOOL)
925 endif
926 ifeq ($($(target)_LRCTOOL),)
927 $(target)_LRCTOOL := $($(target)_QTTOOL)
928 endif
929endif
930
931# Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
932local qt_modules := \
933 $($(target)_QT_MODULES.$(bld_trg)) \
934 $($(target)_QT_MODULES.$(bld_trg_arch)) \
935 $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
936 $($(target)_QT_MODULES.$(bld_trg_cpu)) \
937 $($(target)_QT_MODULES.$(bld_type)) \
938 $($(target)_QT_MODULES)
939local qt_prefix := $(firstword \
940 $($(target)_QT_PREFIX.$(bld_trg)) \
941 $($(target)_QT_PREFIX.$(bld_trg_arch)) \
942 $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
943 $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
944 $($(target)_QT_PREFIX.$(bld_type)) \
945 $($(target)_QT_PREFIX))
946local qt_infix := $(firstword \
947 $($(target)_QT_INFIX.$(bld_trg)) \
948 $($(target)_QT_INFIX.$(bld_trg_arch)) \
949 $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
950 $($(target)_QT_INFIX.$(bld_trg_cpu)) \
951 $($(target)_QT_INFIX.$(bld_type)) \
952 $($(target)_QT_INFIX))
953ifeq ($(bld_trg),darwin)
954 # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
955 $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
956 $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
957 $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
958else
959 ifeq ($(bld_trg),win)
960 ifndef qt_infix
961 local qt_infix := 4
962 endif
963 $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_LIB)) )
964 ifeq ($(tool_do),LINK_PROGRAM)
965 $(eval $(target)_LIBS += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(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.