source: trunk/kBuild/units/qt5.kmk@ 2942

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

units/qt5.kmk: kSubmit experiments for moc; corrected host exe suffix variable name.

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