7 # Copyright (c) 2008-2017 knut st. osmundsen <bird-kBuild-spam-xviiv@anduin.net>
9 # This file is part of kBuild.
11 # kBuild is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # kBuild is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with kBuild; if not, write to the Free Software
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
26 # As a special exception you are granted permission to include this file, via
27 # the kmk include directive, as you wish without this in itself causing the
28 # resulting makefile, program or whatever to be covered by the GPL license.
29 # This exception does not however invalidate any other reasons why the makefile,
30 # program, whatever should not be covered the GPL.
36 $(error kBuild
: The qt4 unit was included twice
!)
41 if
!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
46 PROPS_SINGLE
+= RCCTOOL QT_INFIX
47 PROPS_ACCUMULATE_R
+= RCCFLAGS QT_MODULES
50 ## @todo use pkg-config?
55 # This is implemented here rather than in sdks/QT4.kmk to enforce the global USES.
56 # It also makes things easier to develop, with fewer files I mean.
58 ## @todo the SDK might actually not be necessary as it turns out... For now it servers
59 # a purpose if the host differs from the target, in theory at least.
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.
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
)
77 else ifeq ($(KBUILD_TARGET
),ose
)
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 \
84 /usr
/local
/bin
/qt3to4-qt4 \
85 /usr
/qt
/4/bin
/qt3to4-qt4 \
86 /usr
/share
/qt4
/bin
/qt3to4-qt4 \
88 ifeq ($(PATH_SDK_QT4
),)
89 PATH_SDK_QT4
:= $(patsubst %/bin
/qt3to4
,%,$(firstword $(wildcard \
91 /usr
/local
/bin
/qt3to4 \
92 /usr
/qt
/4/bin
/qt3to4 \
93 /usr
/share
/qt4
/bin
/qt3to4 \
96 ifeq ($(PATH_SDK_QT4
),)
97 PATH_SDK_QT4
:= $(patsubst %/bin
/rcc-qt4
,%,$(firstword $(wildcard \
99 /usr
/local
/bin
/rcc-qt4 \
100 /usr
/qt
/4/bin
/rcc-qt4 \
101 /usr
/share
/qt4
/bin
/rcc-qt4 \
104 ifeq ($(PATH_SDK_QT4
),)
105 PATH_SDK_QT4
:= $(patsubst %/bin
/rcc
,%,$(firstword $(wildcard \
106 /usr
/lib
/*/qt4
/bin
/rcc \
110 /usr
/share
/qt4
/bin
/rcc \
113 ifneq ($(PATH_SDK_QT4
),)
116 # Locate the include files.
117 ifeq ($(PATH_SDK_QT4_INC
),)
118 PATH_SDK_QT4_INC
:= $(patsubst %/QtCore
/qglobal.h
,%,$(firstword $(wildcard \
119 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET_DOT_ARCH
)),/usr
/include/$(type
)/qt4
/QtCore
/qglobal.h
) \
120 $(PATH_SDK_QT4
)/include/QtCore
/qglobal.h \
121 $(PATH_SDK_QT4
)/include/qt4
/QtCore
/qglobal.h \
122 /usr
/include/qt4
/QtCore
/qtglobal.h \
123 /usr
/local
/include/qt4
/QtCore
/qtglobal.h \
125 ifneq ($(PATH_SDK_QT4_INC
),)
126 export PATH_SDK_QT4_INC
130 # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
131 ifeq ($(PATH_SDK_QT4_LIB.x86
),)
132 PATH_SDK_QT4_LIB.x86
:= $(patsubst %/libQtCore
$(SUFF_DLL
),%,$(firstword $(wildcard \
133 $(PATH_SDK_QT4
)/lib32
/libQtCore
$(SUFF_DLL
) \
134 $(PATH_SDK_QT4
)/lib32
/qt4
/libQtCore
$(SUFF_DLL
) \
135 /usr
/lib32
/libQtCore
$(SUFF_DLL
) \
136 /usr
/lib32
/qt4
/libQtCore
$(SUFF_DLL
) \
137 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET
).x86
),/usr
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
138 /usr
/local
/lib32
/libQtCore
$(SUFF_DLL
) \
139 /usr
/local
/lib32
/qt4
/libQtCore
$(SUFF_DLL
) \
140 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET
).x86
),/usr
/local
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
141 $(PATH_SDK_QT4
)/lib
/libQtCore
$(SUFF_DLL
) \
142 $(PATH_SDK_QT4
)/lib
/qt4
/libQtCore
$(SUFF_DLL
) \
143 $(PATH_SDK_QT4
)/lib
/i386-linux-gnu
/libQtCore
$(SUFF_DLL
) \
145 ifneq ($(PATH_SDK_QT4_LIB.x86
),)
146 export PATH_SDK_QT4_LIB.x86
149 ifeq ($(PATH_SDK_QT4_LIB.amd64
),)
150 PATH_SDK_QT4_LIB.amd64
:= $(patsubst %/libQtCore
$(SUFF_DLL
),%,$(firstword $(wildcard \
151 $(PATH_SDK_QT4
)/lib64
/libQtCore
$(SUFF_DLL
) \
152 $(PATH_SDK_QT4
)/lib64
/qt4
/libQtCore
$(SUFF_DLL
) \
153 $(PATH_SDK_QT4
)/lib
/amd64
/libQtCore
$(SUFF_DLL
) \
154 /usr
/lib64
/libQtCore
$(SUFF_DLL
) \
155 /usr
/lib64
/qt4
/libQtCore
$(SUFF_DLL
) \
156 /usr
/lib
/amd64
/libQtCore
$(SUFF_DLL
) \
157 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET
).amd64
),/usr
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
158 /usr
/local
/lib64
/libQtCore
$(SUFF_DLL
) \
159 /usr
/local
/lib64
/qt4
/libQtCore
$(SUFF_DLL
) \
160 /usr
/local
/lib
/amd64
/libQtCore
$(SUFF_DLL
) \
161 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET
).amd64
),/usr
/local
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
162 $(PATH_SDK_QT4
)/lib
/libQtCore
$(SUFF_DLL
) \
163 $(PATH_SDK_QT4
)/lib
/qt4
/libQtCore
$(SUFF_DLL
) \
164 $(PATH_SDK_QT4
)/lib
/x86_64-linux-gnu
/libQtCore
$(SUFF_DLL
) \
166 ifneq ($(PATH_SDK_QT4_LIB.amd64
),)
167 export PATH_SDK_QT4_LIB.amd64
171 # And finally, the library path for KBUILD_TARGET.
172 ifeq ($(PATH_SDK_QT4_LIB
),)
173 PATH_SDK_QT4_LIB
:= $(PATH_SDK_QT4_LIB.
$(KBUILD_TARGET_ARCH
))
174 ifeq ($(PATH_SDK_QT4_LIB
),)
175 PATH_SDK_QT4_LIB
:= $(patsubst %/libQtCore
$(SUFF_DLL
),%,$(firstword $(wildcard \
176 $(PATH_SDK_QT4
)/lib
/libQtCore
$(SUFF_DLL
) \
177 $(PATH_SDK_QT4
)/lib
/qt4
/libQtCore
$(SUFF_DLL
) \
178 /usr
/lib
/libQtCore
$(SUFF_DLL
) \
179 /usr
/lib
/qt4
/libQtCore
$(SUFF_DLL
) \
180 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET_DOT_ARCH
)),/usr
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
181 /usr
/local
/lib
/libQtCore
$(SUFF_DLL
) \
182 /usr
/local
/lib
/qt4
/libQtCore
$(SUFF_DLL
) \
183 $(foreach type
,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.
$(KBUILD_TARGET_DOT_ARCH
)),/usr
/local
/lib
/$(type
)/libQtCore
$(SUFF_DLL
)) \
186 ifneq ($(PATH_SDK_QT4_LIB
),)
187 export PATH_SDK_QT4_LIB
195 ifeq ($(PATH_SDK_QT4
),)
196 $(warning kBuild
: Couldn
't find the Qt4 headers and libaries...)
197 PATH_SDK_QT4 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
201 # Resolve any fancy stuff once and for all.
202 PATH_SDK_QT4 := $(PATH_SDK_QT4)
205 # Libraries can be in either Frameworks or lib depending on how you
206 # build it on the mac. The .dmg installs into Frameworks but builds into lib.
207 ifeq ($(KBUILD_TARGET),darwin)
208 ifndef PATH_SDK_QT4_LIB
209 ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
210 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
212 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
216 PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
217 PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
220 # The bits that kBuild picks up.
227 # This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
228 # It also makes things easier to develop, with fewer files I mean.
232 # Tool Specific Properties
233 # PATH_TOOL_QT4 - Obsolete.
234 # PATH_TOOL_QT4_BIN - The
235 # TOOL_QT4_BIN_SUFF -
236 if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
237 PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
239 ifndef PATH_TOOL_QT4_BIN
240 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v4*/bin)))
241 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
242 PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v4*/bin)))
244 ifeq ($(PATH_TOOL_QT4_BIN),)
245 ifdef TOOL_QT4_BIN_SUFF
246 TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
248 # Try looking for moc-$(suffix) first, if specified.
249 ifneq ($(TOOL_QT4_BIN_SUFF),)
250 PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
251 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc$(TOOL_QT4_BIN_SUFF)) \
252 /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
253 /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
254 /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
255 /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
256 /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
259 # No suffix given, so before we check out -qt4 look at qt4 specific locations to avoid choosers and symlinks.
260 PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
261 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc) \
262 $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt4/bin/moc,) \
263 /usr/lib/qt4/bin/moc \
264 /usr/local/lib/qt4/bin/moc \
266 /usr/local/qt/4/bin/moc \
267 /usr/share/qt4/bin/moc \
268 /usr/local/share/qt4/bin/moc \
270 ifeq ($(PATH_TOOL_QT4_BIN),)
271 PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
272 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/moc-qt4) \
273 /usr/lib/qt4/bin/moc-qt4 \
274 /usr/qt/4/bin/moc-qt4 \
275 /usr/share/qt4/bin/moc-qt4 \
276 /usr/local/bin/moc-qt4 \
279 ifneq ($(PATH_TOOL_QT4_BIN),)
280 TOOL_QT4_BIN_SUFF := -qt4
284 # If still no go, try looking for qt3to4 and rcc.
285 ifeq ($(PATH_TOOL_QT4_BIN),)
286 PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
287 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/qt3to4) \
288 /usr/lib/qt4/bin/qt3to4 \
289 /usr/qt/4/bin/qt3to4 \
290 /usr/share/qt4/bin/qt3to4 \
291 /usr/local/bin/qt3to4 \
295 ifeq ($(PATH_TOOL_QT4_BIN),)
296 PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
297 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF)) \
298 /usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
299 /usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
300 /usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
301 /usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
302 /usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
305 if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
306 PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
307 $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt4/bin/rcc) \
308 /usr/lib/qt4/bin/rcc \
310 /usr/share/qt4/bin/rcc \
315 ifneq ($(PATH_TOOL_QT4_BIN),)
316 export PATH_TOOL_QT4_BIN
319 # If not found, we'll enter the
'pathless' mode.
321 # Resolve any fancy stuff once and for all.
322 PATH_TOOL_QT4_BIN
:= $(PATH_TOOL_QT4_BIN
)
324 ifneq ($(PATH_TOOL_QT4_BIN
),)
325 TOOL_QT4_MOC ?
= $(PATH_TOOL_QT4_BIN
)/moc
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
326 TOOL_QT4_UIC ?
= $(PATH_TOOL_QT4_BIN
)/uic
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
328 TOOL_QT4_RCC
:= $(PATH_TOOL_QT4_BIN
)/rcc
$(HOST_SUFF_EXE
)
329 ifeq ($(wildcard $(TOOL_QT4_RCC
)),)
330 TOOL_QT4_RCC
:= $(PATH_TOOL_QT4_BIN
)/rcc
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
333 TOOL_QT4_LRC ?
= $(PATH_TOOL_QT4_BIN
)/lrelease
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
334 TOOL_QT4_LUPDATE ?
= $(PATH_TOOL_QT4_BIN
)/lupdate
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
336 # Pathless, relies on the environment.
337 TOOL_QT4_MOC ?
= moc
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
338 TOOL_QT4_UIC ?
= uic
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
339 TOOL_QT4_RCC ?
= rcc
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
340 TOOL_QT4_LRC ?
= lrelease
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
341 TOOL_QT4_LUPDATE ?
= lupdate
$(TOOL_QT4_BIN_SUFF
)$(HOST_SUFF_EXE
)
344 # General Properties used by kBuild and/or units/qt.kmk
348 TOOL_QT4_MOCDEFS.darwin ?
= __APPLE__ __GNUC__
349 TOOL_QT4_MOCDEFS.solaris ?
= __sun
350 TOOL_QT4_MOCDEFS.win.amd64 ?
= WIN64
351 TOOL_QT4_MOCDEFS.win.x86 ?
= WIN32
354 ## MOC a C++ source file.
355 # @param $(target) Normalized main target name.
356 # @param $(source) Source filename (relative).
357 # @param $(out) Object file name. This shall be (re)created by the compilation.
358 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
359 # @param $(flags) Flags.
360 # @param $(defs) Definitions.
361 # @param $(incs) Includes.
362 # @param $(outbase) Output basename (full). Use this for list files and such.
364 TOOL_QT4_MOC_CPP_DEPEND
=
365 TOOL_QT4_MOC_CPP_DEPORD
=
366 TOOL_QT4_MOC_CPP_OUTPUT
=
367 TOOL_QT4_MOC_CPP_OUTPUT_MAYBE
=
368 define TOOL_QT4_MOC_CPP_CMDS
369 $(QUIET
)$(TOOL_QT4_MOC
)\
371 $(addprefix -I
, $(incs
))\
372 $(addprefix -D
, $(defs
))\
377 ## MOC a C++ header file.
378 # @param $(target) Normalized main target name.
379 # @param $(source) Source filename (relative).
380 # @param $(out) Object file name. This shall be (re)created by the compilation.
381 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
382 # @param $(flags) Flags.
383 # @param $(defs) Definitions.
384 # @param $(incs) Includes.
385 # @param $(outbase) Output basename (full). Use this for list files and such.
387 TOOL_QT4_MOC_HPP_DEPEND
=
388 TOOL_QT4_MOC_HPP_DEPORD
=
389 TOOL_QT4_MOC_HPP_OUTPUT
=
390 TOOL_QT4_MOC_HPP_OUTPUT_MAYBE
=
391 define TOOL_QT4_MOC_HPP_CMDS
392 $(QUIET
)$(TOOL_QT4_MOC
)\
394 $(addprefix -I
, $(incs
))\
395 $(addprefix -D
, $(defs
))\
400 ## Compile a Qt user interface file (.ui).
401 # @param $(target) Normalized main target name.
402 # @param $(source) Source filename (relative).
403 # @param $(out) Object file name. This shall be (re)created by the compilation.
404 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
405 # @param $(flags) Flags.
406 # @param $(defs) Definitions.
407 # @param $(incs) Includes.
408 # @param $(outbase) Output basename (full). Use this for list files and such.
410 TOOL_QT4_UIC_UI_DEPEND
=
411 TOOL_QT4_UIC_UI_DEPORD
=
412 TOOL_QT4_UIC_UI_OUTPUT
=
413 TOOL_QT4_UIC_UI_OUTPUT_MAYBE
=
414 define TOOL_QT4_UIC_UI_CMDS
415 $(QUIET
)$(TOOL_QT4_UIC
)\
421 ## Compile a Qt resource file (.qrc).
422 # @param $(target) Normalized main target name.
423 # @param $(source) Source filename (relative).
424 # @param $(out) Object file name. This shall be (re)created by the compilation.
425 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
426 # @param $(flags) Flags.
427 # @param $(defs) Definitions.
428 # @param $(incs) Includes.
429 # @param $(outbase) Output basename (full). Use this for list files and such.
431 # @remarks The sed script generating the dependency file is a bit naive.
432 TOOL_QT4_RCC_QRC_DEPEND
=
433 TOOL_QT4_RCC_QRC_DEPORD
=
434 TOOL_QT4_RCC_QRC_OUTPUT
=
435 TOOL_QT4_RCC_QRC_OUTPUT_MAYBE
=
436 define TOOL_QT4_RCC_QRC_CMDS
437 $(QUIET
)$(TOOL_QT4_RCC
)\
441 $(QUIET2
)$(APPEND
) $(dep
) '\'
442 $(QUIET2)$(APPEND) $(dep) '$(out
): \'
443 $(QUIET2
)$(APPEND
) $(dep
) '$(source) \'
445 -e '/^
[[:blank
:]]*<file
[[:blank
:]][^
>]*>/!d
' \
446 -e 's
/^.
*<file
[[:blank
:]][^
>]*>\
([^
<]*\
)<\
/file
>.
*$$$$/\
1/' \
447 -e 's|^
[^
/][^
:]|
$(abspathex
$(dir $(source
)),$(defpath
))/&|
' \
451 $(QUIET2)$(APPEND) $(dep)
453 -e '/^
[[:blank
:]]*<file
[[:blank
:]][^
>]*>/!d
' \
454 -e 's
/^.
*<file
[[:blank
:]][^
>]*>\
([^
<]*\
)<\
/file
>.
*$$$$/\
1/' \
455 -e 's|^
[^
/][^
:]|
$(abspathex
$(dir $(source
)),$(defpath
))/&|
' \
459 $(QUIET2)$(APPEND) $(dep)
462 ## Compile a Qt translation file (.ts).
463 # @param $(target) Normalized main target name.
464 # @param $(source) Source filename (relative).
465 # @param $(out) Object file name. This shall be (re)created by the compilation.
466 # @param $(dep) Dependcy file. This may be (re)created by the compilation.
467 # @param $(flags) Flags.
468 # @param $(defs) Definitions.
469 # @param $(incs) Includes.
470 # @param $(outbase) Output basename (full). Use this for list files and such.
472 TOOL_QT4_LRC_TS_DEPEND =
473 TOOL_QT4_LRC_TS_DEPORD =
474 TOOL_QT4_LRC_TS_OUTPUT =
475 TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
476 define TOOL_QT4_LRC_TS_CMDS
477 $(QUIET)$(TOOL_QT4_LRC)\
487 # Back to the Qt4 unit.
492 ## wrapper for the lrelease (LRC) command dependencies.
493 ifndef NO_COMPILE_CMDS_DEPS
494 _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
496 _UNIT_QT4_LRC_CMDS_DEP =
500 # def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
502 # This is necessary to resolve reference to local variables before doing
503 # assignments and setting up commands. They would otherwise be resolved
504 # later in a different context and the result would be completely wrong.
506 define def_unit_qt4_target_pre_handle_translation_dx
508 $(out) + $(more_output) +| $(maybe_output): \
510 $(value _UNIT_QT4_LRC_CMDS_DEP) \
513 %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
514 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
518 ifndef NO_COMPILE_CMDS_DEPS
519 %$$(QUIET2)$$(APPEND) '$(dep
)'
520 %$$(QUIET2)$$(APPEND) '$(dep
)' 'define $(target
)_
$(subst :,_
,$(source
))_QT4_LRC_CMDS_PREV_
'
521 %$$(QUIET2)$$(APPEND) -c '$(dep
)' '$(out
)'
522 %$$(QUIET2)$$(APPEND) '$(dep
)' 'endef'
525 $(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
526 $(target)-inst-nls_SOURCES += $(out)
528 endef # def_unit_qt4_target_pre_handle_translation_dx
531 # Handle a source file listed in QT_TRANSLATIONS.
533 # The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
534 # to be translated into .qm files that are loadble by Qt.
536 # @remarks Invoked via $(evalvalctx ).
537 define def_unit_qt4_target_pre_handle_translation
540 # fetch the properties.
541 local tool := $(kb-src-tool dummy_var)
542 local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
543 local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
544 local out := $(outbase).qm
545 local dep := $(out).dep
546 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
547 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
548 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
550 # default path + source dep.
552 local source := $(abspathex $(source),$(defpath))
553 local deps := $(abspathex $(deps),$(defpath)) $(source)
554 local incs := $(abspathex $(incs),$(defpath))
556 local deps += $(source)
560 ifndef TOOL_$(tool)_LRC_TS_CMDS
561 $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
563 local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
564 local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
565 local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
566 local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
567 local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
569 # generate the link rule and update some source and target variables.
570 ifndef NO_COMPILE_CMDS_DEPS
571 $(eval includedep $(dep))
573 $(eval $(def_unit_qt4_target_pre_handle_translation_dx))
575 endef # def_unit_qt4_target_pre_handle_translation
579 ## wrapper for the UIC command dependencies.
580 ifndef NO_COMPILE_CMDS_DEPS
581 _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
583 _UNIT_QT4_RCC_CMDS_DEP =
587 # def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
589 # This is necessary to resolve reference to local variables before doing
590 # assignments and setting up commands. They would otherwise be resolved
591 # later in a different context and the result would be completely wrong.
593 define def_unit_qt4_target_pre_handle_rcc_dx
595 $(out) +| $(realout) $(more_output) $(maybe_output): \
597 $(value _UNIT_QT4_RCC_CMDS_DEP) \
600 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
601 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
605 $(QUIET)$(CP) --changed -f $(out) $(realout)
606 ifndef NO_COMPILE_CMDS_DEPS
607 %$$(QUIET2)$$(APPEND) '$(dep
)'
608 %$$(QUIET2)$$(APPEND) '$(dep
)' 'define $(target
)_
$(subst :,_
,$(source
))_QT4_RCC_CMDS_PREV_
'
609 %$$(QUIET2)$$(APPEND) -c '$(dep
)' '$(out
)'
610 %$$(QUIET2)$$(APPEND) '$(dep
)' 'endef'
613 $(target)_2_INTERMEDIATES += $(realout)
614 $(target)_GEN_SOURCES_ += $(realout)
615 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
617 endef # def_unit_qt4_target_pre_handle_rcc_dx
620 # Source handler for .qrc sources (Qt resource files).
622 # @remarks $(evalvalctx me).
623 define def_unit_qt4_src_handler_qrc
626 # fetch the properties.
627 local tool := $(kb-src-tool dummy_var)
628 local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
629 local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
630 local out := $(outbase).tmp.gen.cpp
631 local realout := $(outbase).gen.cpp
632 local dep := $(realout).dep
633 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
634 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
635 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
637 # default path + source dep.
639 local source := $(abspathex $(source),$(defpath))
640 local deps := $(abspathex $(deps),$(defpath)) $(source)
641 local incs := $(abspathex $(incs),$(defpath))
643 local deps += $(source)
647 ifndef TOOL_$(tool)_RCC_QRC_CMDS
648 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
650 local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
651 local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
652 local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
653 local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
654 local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
656 # generate the link rule and update some source and target variables.
657 ifndef NO_COMPILE_CMDS_DEPS
658 $(eval includedep $(dep))
660 $(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
662 endef # def_unit_qt4_src_handler_qrc
666 ## wrapper for the UIC command dependencies.
667 ifndef NO_COMPILE_CMDS_DEPS
668 _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
670 _UNIT_QT4_UIC_CMDS_DEP =
674 # def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
676 # This is necessary to resolve reference to local variables before doing
677 # assignments and setting up commands. They would otherwise be resolved
678 # later in a different context and the result would be completely wrong.
680 define def_unit_qt4_target_pre_handle_ui_dx
682 $(out) +| $(realout) $(more_output) $(maybe_output): \
684 $(value _UNIT_QT4_UIC_CMDS_DEP) \
687 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
688 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
692 $(QUIET)$(CP) --changed -f $(out) $(realout)
693 ifndef NO_COMPILE_CMDS_DEPS
694 %$$(QUIET2)$$(APPEND) '$(dep
)'
695 %$$(QUIET2)$$(APPEND) '$(dep
)' 'define $(target
)_
$(subst :,_
,$(source
))_QT4_UIC_CMDS_PREV_
'
696 %$$(QUIET2)$$(APPEND) -c '$(dep
)' '$(out
)'
697 %$$(QUIET2)$$(APPEND) '$(dep
)' 'endef'
700 $(target)_2_INTERMEDIATES += $(realout)
701 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
703 endef # def_unit_qt4_target_pre_handle_ui_dx
706 # Source handler for .ui sources.
708 # @remarks $(evalvalctx me).
709 define def_unit_qt4_src_handler_ui
712 # fetch the properties.
713 local tool := $(kb-src-tool dummy_var)
714 local qtuicdir := $($(target)_0_OUTDIR)/qtuic
715 local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
716 local out := $(outbase).tmp.gen.h
717 local realout := $(outbase).gen.h
718 local dep := $(realout).dep
719 local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
720 local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
721 local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
723 # default path + source dep.
725 local source := $(abspathex $(source),$(defpath))
726 local deps := $(abspathex $(deps),$(defpath)) $(source)
727 local incs := $(abspathex $(incs),$(defpath))
729 local deps += $(source)
733 ifndef TOOL_$(tool)_UIC_UI_CMDS
734 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
736 local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
737 local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
738 local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
739 local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
740 local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
742 # generate the link rule and update some source and target variables.
743 ifndef NO_COMPILE_CMDS_DEPS
744 $(eval includedep $(dep))
746 $(eval $(def_unit_qt4_target_pre_handle_ui_dx))
748 endef # def_unit_qt4_src_handler_ui
752 ## wrapper for the MOC command dependencies.
753 ifndef NO_COMPILE_CMDS_DEPS
754 _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
756 _UNIT_QT4_MOC_HPP_CMDS_DEP =
760 # def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
762 # This is necessary to resolve reference to local variables before doing
763 # assignments and setting up commands. They would otherwise be resolved
764 # later in a different context and the result would be completely wrong.
766 define def_unit_qt4_target_pre_handle_moc_hdr_dx
768 $(out) +| $(realout) $(more_output) $(maybe_output): \
770 $(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
773 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
774 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
778 $(QUIET)$(CP) --changed -f $(out) $(realout)
779 ifndef NO_COMPILE_CMDS_DEPS
780 %$$(QUIET2)$$(APPEND) '$(dep
)'
781 %$$(QUIET2)$$(APPEND) '$(dep
)' 'define $(target
)_
$(subst :,_
,$(source
))_QT4_MOC_HPP_CMDS_PREV_
'
782 %$$(QUIET2)$$(APPEND) -c '$(dep
)' '$(out
)'
783 %$$(QUIET2)$$(APPEND) '$(dep
)' 'endef'
786 $(target)_2_INTERMEDIATES += $(realout)
787 $(target)_GEN_SOURCES_ += $(realout)
788 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
793 # Handle a source file listed in QT_MOCHDRS.
795 # The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
796 # generate a .cpp file for each of them and add it to the generated
797 # sources so that it's compiled and linked.
(There is an alternative
798 # way to do this where the .cpp file is included, this isn't currently
799 # supported by this unit.)
801 # @remarks Invoked via $(evalvalctx ).
802 define def_unit_qt4_target_pre_handle_moc_hdr
805 # fetch the properties.
806 local tool
:= $(kb-src-tool dummy_var
)
807 local outbase
:= $(qtmocdir
)/$(notdir $(basename $(source
)))
808 local out
:= $(outbase
).tmp.
cpp
809 local realout
:= $(outbase
).
cpp
810 local dep
:= $(realout
).dep
811 local defs
:= $(kb-src-prop DEFS
,dummy_var
,left-to-right
)
812 local incs
:= $(kb-src-prop INCS
,dummy_var
,right-to-left
)
813 local flags
:= $(kb-src-prop FLAGS
,dummy_var
,right-to-left
)
814 local deps
:= $(kb-src-prop DEPS
,dummy_var
,left-to-right
)
815 local orderdeps
:= $(call DIRDEP
,$(dir $(outbase
))) $(kb-src-prop ORDERDEPS
,dummy_var
,left-to-right
)
817 # default path + source dep.
819 local source
:= $(abspathex
$(source
),$(defpath
))
820 local deps
:= $(abspathex
$(deps
),$(defpath
)) $(source
)
821 local incs
:= $(abspathex
$(incs
),$(defpath
))
823 local deps
+= $(source
)
827 ifndef TOOL_
$(tool
)_MOC_HPP_CMDS
828 $(error kBuild
: qt moc tool not found
: TOOL_
$(tool
)_MOC_HPP_CMDS
)
830 local cmds
:= $(TOOL_
$(tool
)_MOC_HPP_CMDS
)
831 local more_output
:= $(TOOL_
$(tool
)_MOC_HPP_OUTPUT
)
832 local maybe_output
:= $(TOOL_
$(tool
)_MOC_HPP_OUTPUT_MAYBE
)
833 local deps
+= $(TOOL_
$(tool
)_MOC_HPP_DEPEND
)
834 local orderdeps
+= $(TOOL_
$(tool
)_MOC_HPP_DEPORD
)
836 # generate the link rule and update some source and target variables.
837 ifndef NO_COMPILE_CMDS_DEPS
838 $(eval includedep
$(dep
))
840 $(eval
$(def_unit_qt4_target_pre_handle_moc_hdr_dx
))
842 endef # def_unit_qt4_target_pre_handle_moc_hdr
845 ## wrapper for the MOC command dependencies.
846 ifndef NO_COMPILE_CMDS_DEPS
847 _UNIT_QT4_MOC_CPP_CMDS_DEP
= $$(comp-cmds-ex
$$($(target
)_
$(subst :,_
,$(source
))_QT4_MOC_CPP_CMDS_PREV_
),$$(commands
$(out
)),FORCE
)
849 _UNIT_QT4_MOC_CPP_CMDS_DEP
=
853 # def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
855 # This is necessary to resolve reference to local variables before doing
856 # assignments and setting up commands. They would otherwise be resolved
857 # later in a different context and the result would be completely wrong.
859 define def_unit_qt4_target_pre_handle_moc_src_dx
861 $(out
) +|
$(realout
) $(more_output
) $(maybe_output
): \
863 $(value _UNIT_QT4_MOC_CPP_CMDS_DEP
) \
866 %$$(call MSG_TOOL
,moc
,$(target
),$(source
),$$@
)
867 $(QUIET2
)$(RM
) -f
$(out
) $(more_output
) $(maybe_output
) $(dep
)
871 $(QUIET
)$(CP
) --changed
-f
$(out
) $(realout
)
872 ifndef NO_COMPILE_CMDS_DEPS
873 %$$(QUIET2
)$$(APPEND
) '$(dep)'
874 %$$(QUIET2
)$$(APPEND
) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
875 %$$(QUIET2
)$$(APPEND
) -c
'$(dep)' '$(out)'
876 %$$(QUIET2
)$$(APPEND
) '$(dep)' 'endef'
879 $(target
)_2_INTERMEDIATES
+= $(realout
)
880 $(target
)_CLEAN
+= $(out
) $(realout
) $(more_output
) $(maybe_output
) $(dep
)
885 # Handle a source file listed in QT_MOCSRCS.
887 # The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
888 # a .moc file that we're expected to generate here.
890 # @remarks Invoked via $(evalvalctx ).
891 define def_unit_qt4_target_pre_handle_moc_src
894 # fetch the properties.
895 local tool
:= $(kb-src-tool dummy_var
)
896 local outbase
:= $(qtmocdir
)/$(notdir $(basename $(source
)))
897 local out
:= $(outbase
).tmp.moc
898 local realout
:= $(outbase
).moc
899 local dep
:= $(realout
).dep
900 local defs
:= $(kb-src-prop DEFS
,dummy_var
,left-to-right
)
901 local incs
:= $(kb-src-prop INCS
,dummy_var
,right-to-left
)
902 local flags
:= $(kb-src-prop FLAGS
,dummy_var
,right-to-left
)
903 local deps
:= $(kb-src-prop DEPS
,dummy_var
,left-to-right
)
904 local orderdeps
:= $(call DIRDEP
,$(dir $(outbase
))) $(kb-src-prop ORDERDEPS
,dummy_var
,left-to-right
)
906 # default path + source dep.
908 local source
:= $(abspathex
$(source
),$(defpath
))
909 local deps
:= $(abspathex
$(deps
),$(defpath
)) $(source
)
910 local incs
:= $(abspathex
$(incs
),$(defpath
))
912 local deps
+= $(source
)
916 ifndef TOOL_
$(tool
)_MOC_CPP_CMDS
917 $(error kBuild
: qt moc tool not found
: TOOL_
$(tool
)_MOC_CPP_CMDS
)
919 local cmds
:= $(TOOL_
$(tool
)_MOC_CPP_CMDS
)
920 local more_output
:= $(TOOL_
$(tool
)_MOC_CPP_OUTPUT
)
921 local maybe_output
:= $(TOOL_
$(tool
)_MOC_CPP_OUTPUT_MAYBE
)
922 local deps
+= $(TOOL_
$(tool
)_MOC_CPP_DEPEND
)
923 local orderdeps
+= $(TOOL_
$(tool
)_MOC_CPP_DEPORD
)
925 # generate the link rule and update some source and target variables.
926 ifndef NO_COMPILE_CMDS_DEPS
927 $(eval includedep
$(dep
))
929 $(eval
$(def_unit_qt4_target_pre_handle_moc_src_dx
))
931 endef # def_unit_qt4_target_pre_handle_moc_src
935 # Adds sources containing Q_OBJECT to QT_MOCSRCS.
936 define def_unit_qt4_target_pre_cpp_source
937 ifneq ($(file-size
$(source
)),-1)
938 ifneq ($(strip $(shell $(SED
) -f
$(KBUILD_PATH
)/units
/qt-Q_OBJECT.sed
$(source
))),)
939 $(eval
$(target
)_QT_MOCSRCS
+= $(source
))
942 endef # def_unit_qt4_target_pre_cpp_source
945 # Invoked early in the processing of a target that uses the Qt unit.
947 # It will append the qt source handlers to the target (.h, .ui, .ts,
950 # It will then check all the C++ sources and check which needs
951 # a .moc files and generate rules and dependencies fofor these
953 define def_unit_qt4_target_pre
955 # Make QTTOOL the default for the specific Qt tools instead of TOOL.
956 ifneq ($($(target
)_QTTOOL
),)
957 ifeq ($($(target
)_MOCTOOL
),)
958 $(target
)_MOCTOOL
:= $($(target
)_QTTOOL
)
960 ifeq ($($(target
)_UICTOOL
),)
961 $(target
)_UICTOOL
:= $($(target
)_QTTOOL
)
963 ifeq ($($(target
)_RCCTOOL
),)
964 $(target
)_RCCTOOL
:= $($(target
)_QTTOOL
)
966 ifeq ($($(target
)_LRCTOOL
),)
967 $(target
)_LRCTOOL
:= $($(target
)_QTTOOL
)
971 # Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
972 local qt_modules
:= \
973 $($(target
)_QT_MODULES.
$(bld_trg
)) \
974 $($(target
)_QT_MODULES.
$(bld_trg_arch
)) \
975 $($(target
)_QT_MODULES.
$(bld_trg
).
$(bld_trg_arch
)) \
976 $($(target
)_QT_MODULES.
$(bld_trg_cpu
)) \
977 $($(target
)_QT_MODULES.
$(bld_type
)) \
978 $($(target
)_QT_MODULES
)
979 local qt_prefix
:= $(firstword \
980 $($(target
)_QT_PREFIX.
$(bld_trg
)) \
981 $($(target
)_QT_PREFIX.
$(bld_trg_arch
)) \
982 $($(target
)_QT_PREFIX.
$(bld_trg
).
$(bld_trg_arch
)) \
983 $($(target
)_QT_PREFIX.
$(bld_trg_cpu
)) \
984 $($(target
)_QT_PREFIX.
$(bld_type
)) \
985 $($(target
)_QT_PREFIX
))
986 local qt_infix
:= $(firstword \
987 $($(target
)_QT_INFIX.
$(bld_trg
)) \
988 $($(target
)_QT_INFIX.
$(bld_trg_arch
)) \
989 $($(target
)_QT_INFIX.
$(bld_trg
).
$(bld_trg_arch
)) \
990 $($(target
)_QT_INFIX.
$(bld_trg_cpu
)) \
991 $($(target
)_QT_INFIX.
$(bld_type
)) \
992 $($(target
)_QT_INFIX
))
993 ifeq ($(bld_trg
),darwin
)
994 # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
995 $(eval
$(target
)_CXXFLAGS
+= -F
$(PATH_SDK_QT4_LIB
) )
996 $(eval
$(target
)_OBJCXXFLAGS
+= -F
$(PATH_SDK_QT4_LIB
) )
997 $(eval
$(target
)_LDFLAGS
+= -F
$(PATH_SDK_QT4_LIB
) $(foreach module
,$(qt_modules
), -framework
$(qt_prefix
)Qt
$(module
)$(qt_infix
)) )
998 $(eval
$(target
)_INCS
+= $(foreach module
,$(qt_modules
), $(PATH_SDK_QT4_LIB
)/$(qt_prefix
)Qt
$(module
)$(qt_infix
).framework
/Versions
/4/Headers
) )
1000 ifeq ($(bld_trg
),win
)
1001 $(eval
$(target
)_LIBS
+= $(foreach module
,$(qt_modules
), $(PATH_SDK_QT4_LIB
)/$(qt_prefix
)Qt
$(module
)$(qt_infix
)4$(SUFF_LIB
)) )
1002 ifeq ($(tool_do
),LINK_PROGRAM
)
1003 $(eval
$(target
)_LIBS
+= $(PATH_SDK_QT4_LIB
)/$(qt_prefix
)qtmain
$(qt_infix
)$(SUFF_LIB
) )
1006 $(eval
$(target
)_LIBS
+= $(foreach module
,$(qt_modules
), $(PATH_SDK_QT4_LIB
)/lib
$(qt_prefix
)Qt
$(module
)$(qt_infix
)$(SUFF_DLL
)) )
1008 $(eval
$(target
)_INCS
+= $(addprefix $(PATH_SDK_QT4_INC
)/Qt
,$(qt_modules
)) $(PATH_SDK_QT4_INC
) )
1010 $(eval
$(target
)_DEFS
+= $(foreach module
,$(toupper
$(qt_modules
)), QT_
$(module
)_LIB
) )
1013 # Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
1014 # Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
1015 ifndef $(target
)_QT_MOCSRCS
1016 $(foreach source
, $(filter %.
cxx %.CXX
%.
cpp %.CPP
%.
cc %.CC
,\
1017 $($(target
)_SOURCES.
$(bld_trg
)) \
1018 $($(target
)_SOURCES.
$(bld_trg_arch
)) \
1019 $($(target
)_SOURCES.
$(bld_trg
).
$(bld_trg_arch
)) \
1020 $($(target
)_SOURCES.
$(bld_trg_cpu
)) \
1021 $($(target
)_SOURCES.
$(bld_type
)) \
1022 $($(target
)_SOURCES
) \
1023 ), $(evalval def_unit_qt4_target_pre_cpp_source
))
1026 # Install source handlers for .ui files.
1027 $(target
)_SRC_HANDLERS
+= \
1028 .ui
:def_unit_qt4_src_handler_ui \
1029 .UI
:def_unit_qt4_src_handler_ui \
1030 .qrc
:def_unit_qt4_src_handler_qrc \
1031 .qrc
:def_unit_qt4_src_handler_qrc
1033 # Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
1034 local qtmocdir
:= $($(target
)_0_OUTDIR
)/qtmoc
1035 local qtuicdir
:= $($(target
)_0_OUTDIR
)/qtuic
1036 local qtrccdir
:= $($(target
)_0_OUTDIR
)/qtrcc
1037 local qtnlsdir
:= $($(target
)_0_OUTDIR
)/qtnls
1038 $(eval
$(target
)_BLDDIRS
+= $(qtmocdir
) $(qtuicdir
) $(qtrccdir
) $(qtnlsdir
))
1039 $(eval
$(target
)_INCS
+= $(qtmocdir
) $(qtuicdir
))
1041 # Deal with QT_MOCSRCS.
1043 $($(target
)_QT_MOCSRCS.
$(bld_trg
)) \
1044 $($(target
)_QT_MOCSRCS.
$(bld_trg_arch
)) \
1045 $($(target
)_QT_MOCSRCS.
$(bld_trg
).
$(bld_trg_arch
)) \
1046 $($(target
)_QT_MOCSRCS.
$(bld_trg_cpu
)) \
1047 $($(target
)_QT_MOCSRCS.
$(bld_type
)) \
1048 $($(target
)_QT_MOCSRCS
) \
1049 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src
))
1051 # Deal with QT_MOCHDRS.
1053 $($(target
)_QT_MOCHDRS.
$(bld_trg
)) \
1054 $($(target
)_QT_MOCHDRS.
$(bld_trg_arch
)) \
1055 $($(target
)_QT_MOCHDRS.
$(bld_trg
).
$(bld_trg_arch
)) \
1056 $($(target
)_QT_MOCHDRS.
$(bld_trg_cpu
)) \
1057 $($(target
)_QT_MOCHDRS.
$(bld_type
)) \
1058 $($(target
)_QT_MOCHDRS
) \
1059 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr
))
1061 # Deal with QT_TRANSLATIONS.
1062 # ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
1063 local translations
:= \
1064 $($(target
)_QT_TRANSLATIONS.
$(bld_trg
)) \
1065 $($(target
)_QT_TRANSLATIONS.
$(bld_trg_arch
)) \
1066 $($(target
)_QT_TRANSLATIONS.
$(bld_trg
).
$(bld_trg_arch
)) \
1067 $($(target
)_QT_TRANSLATIONS.
$(bld_trg_cpu
)) \
1068 $($(target
)_QT_TRANSLATIONS.
$(bld_type
)) \
1069 $($(target
)_QT_TRANSLATIONS
)
1070 ifneq ($(strip $(translations
)),)
1071 local expr
:= _ALL_INSTALLS_IMPLICIT
+= $(target
)-inst-nls
1073 ifdef $(target
)_QT_TRANSLATIONS_TEMPLATE
1074 $(target
)-inst-nls_TEMPLATE
:= $($(target
)_QT_TRANSLATIONS_TEMPLATE
)
1076 $(target
)-inst-nls_MODE
:= 0644
1078 ifdef $(target
)_QT_TRANSLATIONS_INST
1079 $(target
)-inst-nls_INST
:= $($(target
)_QT_TRANSLATIONS_INST
)
1081 $(target
)-inst-nls_SOURCES
:=
1082 $(foreach source
, $(translations
)\
1083 , $(evalvalctx def_unit_qt4_target_pre_handle_translation
))
1086 endef # def_unit_qt4_target_pre
1090 # Rule for debugging.
1093 @
$(ECHO
) 'The Qt4 SDK variables:'
1094 @
$(ECHO
) ' PATH_SDK_QT4 = "$(PATH_SDK_QT4)"'
1095 @
$(ECHO
) ' PATH_SDK_QT4_INC = "$(PATH_SDK_QT4_INC)"'
1096 @
$(ECHO
) ' PATH_SDK_QT4_LIB = "$(PATH_SDK_QT4_LIB)"'
1097 @
$(ECHO
) ' PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
1098 @
$(ECHO
) ' PATH_SDK_QT4_LIB.x86 = "$(PATH_SDK_QT4_LIB.x86)"'
1099 @
$(ECHO
) 'The Qt4 TOOL variables:'
1100 @
$(ECHO
) ' PATH_TOOL_QT4_BIN = "$(PATH_TOOL_QT4_BIN)"'
1101 @
$(ECHO
) ' TOOL_QT4_BIN_SUFF = "$(TOOL_QT4_BIN_SUFF)"'
1102 @
$(ECHO
) ' TOOL_QT4_MOC = "$(TOOL_QT4_MOC)"'
1103 @
$(ECHO
) ' TOOL_QT4_UIC = "$(TOOL_QT4_UIC)"'
1104 @
$(ECHO
) ' TOOL_QT4_RCC = "$(TOOL_QT4_RCC)"'
1105 @
$(ECHO
) ' TOOL_QT4_LRC = "$(TOOL_QT4_LRC)"'
1106 @
$(ECHO
) ' TOOL_QT4_LUPDATE = "$(TOOL_QT4_LUPDATE)"'