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

Last change on this file since 2973 was 2973, checked in by bird, 9 years ago

qt4.kmk: Look in one more place.

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