1 | # $Id: qt6.kmk 3593 2023-05-19 10:39:04Z bird $
|
---|
2 | ## @file
|
---|
3 | # Qt 6 unit.
|
---|
4 | #
|
---|
5 |
|
---|
6 | #
|
---|
7 | # Copyright (c) 2008-2022 knut st. osmundsen <bird-kBuild-spam-xviiv@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 |
|
---|
35 | ifdef UNIT_qt6
|
---|
36 | $(error kBuild: The qt6 unit was included twice!)
|
---|
37 | endif
|
---|
38 | UNIT_qt6 = qt6
|
---|
39 |
|
---|
40 |
|
---|
41 | if !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
|
---|
45 | endif
|
---|
46 | PROPS_SINGLE += RCCTOOL QT_INFIX
|
---|
47 | PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
|
---|
48 |
|
---|
49 |
|
---|
50 | ## @todo use pkg-config?
|
---|
51 |
|
---|
52 | #
|
---|
53 | # The QT6 SDK.
|
---|
54 | #
|
---|
55 | # This is implemented here rather than in sdks/QT6.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.
|
---|
60 | SDK_QT6 = Qt6
|
---|
61 |
|
---|
62 | # SDK Specific Properties
|
---|
63 | # PATH_SDK_QT6 - The general Qt6 root directory.
|
---|
64 | # PATH_SDK_QT6_INC - The include directory.
|
---|
65 | # PATH_SDK_QT6_LIB.amd64 - The lib directory for AMD64.
|
---|
66 | # PATH_SDK_QT6_LIB.x86 - The lib directory for X86.
|
---|
67 | # PATH_SDK_QT6_LIB - The lib directory for KBUILD_TARGET.
|
---|
68 | ifndef PATH_SDK_QT6
|
---|
69 | PATH_SDK_QT6 := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_TRG)/qt/v6*)))
|
---|
70 | ifeq ($(PATH_SDK_QT6),)
|
---|
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_QT6 := $(patsubst %/Frameworks/QtCore.framework/Versions/6,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/6)))
|
---|
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_QT6_LIB* stuff if it doesn't work.
|
---|
81 | # Try find the general root of thing by looking for the rcc program, as there seems to be no qt6 specific one to look for.
|
---|
82 | PATH_SDK_QT6 := $(patsubst %/bin/rcc-qt6,%,$(firstword $(wildcard \
|
---|
83 | /usr/bin/rcc-qt6 \
|
---|
84 | /usr/local/bin/rcc-qt6 \
|
---|
85 | /usr/qt/6/bin/rcc-qt6 \
|
---|
86 | $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/rcc-qt6) \
|
---|
87 | /usr/lib/qt6/bin/rcc-qt6 \
|
---|
88 | /usr/share/qt6/bin/rcc-qt6 \
|
---|
89 | )))
|
---|
90 | ifeq ($(PATH_SDK_QT6),)
|
---|
91 | PATH_SDK_QT6 := $(patsubst %/libexec/rcc-qt6,%,$(firstword $(wildcard \
|
---|
92 | /usr/libexec/rcc-qt6 \
|
---|
93 | /usr/local/libexec/rcc-qt6 \
|
---|
94 | /usr/qt/6/libexec/rcc-qt6 \
|
---|
95 | $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/libexec/rcc-qt6) \
|
---|
96 | /usr/lib/qt6/libexec/rcc-qt6 \
|
---|
97 | /usr/share/qt6/libexec/rcc-qt6 \
|
---|
98 | )))
|
---|
99 | endif
|
---|
100 | ifeq ($(PATH_SDK_QT6),)
|
---|
101 | PATH_SDK_QT6 := $(patsubst %/libexec/rcc,%,$(firstword $(wildcard \
|
---|
102 | /usr/qt/6/libexec/rcc \
|
---|
103 | $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/libexec/rcc) \
|
---|
104 | /usr/lib/qt6/libexec/rcc \
|
---|
105 | /usr/share/qt6/libexec/rcc \
|
---|
106 | /usr/libexec/rcc \
|
---|
107 | /usr/local/libexec/rcc \
|
---|
108 | )))
|
---|
109 | endif
|
---|
110 | ifeq ($(PATH_SDK_QT6),)
|
---|
111 | PATH_SDK_QT6 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
|
---|
112 | /usr/qt/6/bin/rcc \
|
---|
113 | $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/rcc) \
|
---|
114 | /usr/lib/qt6/bin/rcc \
|
---|
115 | /usr/share/qt6/bin/rcc \
|
---|
116 | /usr/bin/rcc \
|
---|
117 | /usr/local/bin/rcc \
|
---|
118 | )))
|
---|
119 | endif
|
---|
120 | ifneq ($(PATH_SDK_QT6),)
|
---|
121 | export PATH_SDK_QT6
|
---|
122 |
|
---|
123 | # Locate the include files. Check for QStringConverter (since 6.?) first.
|
---|
124 | ifeq ($(PATH_SDK_QT6_INC),)
|
---|
125 | PATH_SDK_QT6_INC := $(patsubst %/QtCore/QStringConverter,%,$(firstword $(wildcard \
|
---|
126 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt6/QtCore/QStringConverter) \
|
---|
127 | $(PATH_SDK_QT6)/include/qt6/QtCore/QStringConverter \
|
---|
128 | /usr/include/qt6/QtCore/QStringConverter \
|
---|
129 | /usr/local/include/qt6/QtCore/QStringConverter \
|
---|
130 | $(PATH_SDK_QT6)/include/QtCore/QStringConverter \
|
---|
131 | /usr/include/qt/QtCore/QStringConverter \
|
---|
132 | /usr/local/include/qt/QtCore/QStringConverter \
|
---|
133 | )))
|
---|
134 | ifeq ($(PATH_SDK_QT6_INC),)
|
---|
135 | PATH_SDK_QT6_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
|
---|
136 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/include/$(type)/qt6/QtCore/qglobal.h) \
|
---|
137 | $(PATH_SDK_QT6)/include/qt6/QtCore/qglobal.h \
|
---|
138 | /usr/include/qt6/QtCore/qglobal.h \
|
---|
139 | /usr/local/include/qt6/QtCore/qglobal.h \
|
---|
140 | $(PATH_SDK_QT6)/include/QtCore/qglobal.h \
|
---|
141 | )))
|
---|
142 | endif
|
---|
143 | ifneq ($(PATH_SDK_QT6_INC),)
|
---|
144 | export PATH_SDK_QT6_INC
|
---|
145 | endif
|
---|
146 | endif
|
---|
147 |
|
---|
148 | # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
|
---|
149 | ifeq ($(PATH_SDK_QT6_LIB.x86),)
|
---|
150 | PATH_SDK_QT6_LIB.x86 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
|
---|
151 | $(PATH_SDK_QT6)/lib32/libQt6Core$(SUFF_DLL) \
|
---|
152 | $(PATH_SDK_QT6)/lib32/qt6/libQt6Core$(SUFF_DLL) \
|
---|
153 | /usr/lib32/libQt6Core$(SUFF_DLL) \
|
---|
154 | /usr/lib32/qt6/libQt6Core$(SUFF_DLL) \
|
---|
155 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
156 | /usr/local/lib32/libQt6Core$(SUFF_DLL) \
|
---|
157 | /usr/local/lib32/qt6/libQt6Core$(SUFF_DLL) \
|
---|
158 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).x86),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
159 | $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
|
---|
160 | $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
161 | $(PATH_SDK_QT6)/lib/i386-linux-gnu/libQt6Core$(SUFF_DLL) \
|
---|
162 | )))
|
---|
163 | ifneq ($(PATH_SDK_QT6_LIB.x86),)
|
---|
164 | export PATH_SDK_QT6_LIB.x86
|
---|
165 | endif
|
---|
166 | endif
|
---|
167 | ifeq ($(PATH_SDK_QT6_LIB.amd64),)
|
---|
168 | PATH_SDK_QT6_LIB.amd64 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
|
---|
169 | $(PATH_SDK_QT6)/lib64/libQt6Core$(SUFF_DLL) \
|
---|
170 | $(PATH_SDK_QT6)/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
171 | $(PATH_SDK_QT6)/lib/amd64/libQt6Core$(SUFF_DLL) \
|
---|
172 | /usr/lib64/libQt6Core$(SUFF_DLL) \
|
---|
173 | /usr/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
174 | /usr/lib/amd64/libQt6Core$(SUFF_DLL) \
|
---|
175 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
176 | /usr/local/lib64/libQt6Core$(SUFF_DLL) \
|
---|
177 | /usr/local/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
178 | /usr/local/lib/amd64/libQt6Core$(SUFF_DLL) \
|
---|
179 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).amd64),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
180 | $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
|
---|
181 | $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
182 | $(PATH_SDK_QT6)/lib/x86_64-linux-gnu/libQt6Core$(SUFF_DLL) \
|
---|
183 | )))
|
---|
184 | ifneq ($(PATH_SDK_QT6_LIB.amd64),)
|
---|
185 | export PATH_SDK_QT6_LIB.amd64
|
---|
186 | endif
|
---|
187 | endif
|
---|
188 | ifeq ($(PATH_SDK_QT6_LIB.arm64),)
|
---|
189 | PATH_SDK_QT6_LIB.arm64 := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
|
---|
190 | $(PATH_SDK_QT6)/lib64/libQt6Core$(SUFF_DLL) \
|
---|
191 | $(PATH_SDK_QT6)/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
192 | $(PATH_SDK_QT6)/lib/arm64/libQt6Core$(SUFF_DLL) \
|
---|
193 | /usr/lib64/libQt6Core$(SUFF_DLL) \
|
---|
194 | /usr/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
195 | /usr/lib/arm64/libQt6Core$(SUFF_DLL) \
|
---|
196 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).arm64),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
197 | /usr/local/lib64/libQt6Core$(SUFF_DLL) \
|
---|
198 | /usr/local/lib64/qt6/libQt6Core$(SUFF_DLL) \
|
---|
199 | /usr/local/lib/arm64/libQt6Core$(SUFF_DLL) \
|
---|
200 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET).arm64),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
201 | $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
|
---|
202 | $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
203 | $(PATH_SDK_QT6)/lib/x86_64-linux-gnu/libQt6Core$(SUFF_DLL) \
|
---|
204 | )))
|
---|
205 | ifneq ($(PATH_SDK_QT6_LIB.arm64),)
|
---|
206 | export PATH_SDK_QT6_LIB.arm64
|
---|
207 | endif
|
---|
208 | endif
|
---|
209 |
|
---|
210 | # And finally, the library path for KBUILD_TARGET.
|
---|
211 | ifeq ($(PATH_SDK_QT6_LIB),)
|
---|
212 | PATH_SDK_QT6_LIB := $(PATH_SDK_QT6_LIB.$(KBUILD_TARGET_ARCH))
|
---|
213 | ifeq ($(PATH_SDK_QT6_LIB),)
|
---|
214 | PATH_SDK_QT6_LIB := $(patsubst %/libQt6Core$(SUFF_DLL),%,$(firstword $(wildcard \
|
---|
215 | $(PATH_SDK_QT6)/lib/libQt6Core$(SUFF_DLL) \
|
---|
216 | $(PATH_SDK_QT6)/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
217 | /usr/lib/libQt6Core$(SUFF_DLL) \
|
---|
218 | /usr/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
219 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
220 | /usr/local/lib/libQt6Core$(SUFF_DLL) \
|
---|
221 | /usr/local/lib/qt6/libQt6Core$(SUFF_DLL) \
|
---|
222 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_TARGET_DOT_ARCH)),/usr/local/lib/$(type)/libQt6Core$(SUFF_DLL)) \
|
---|
223 | )))
|
---|
224 | endif
|
---|
225 | ifneq ($(PATH_SDK_QT6_LIB),)
|
---|
226 | export PATH_SDK_QT6_LIB
|
---|
227 | endif
|
---|
228 | endif
|
---|
229 |
|
---|
230 | endif
|
---|
231 | endif # Unices
|
---|
232 | endif
|
---|
233 | # Found it?
|
---|
234 | ifeq ($(PATH_SDK_QT6),)
|
---|
235 | $(warning kBuild: Couldn't find the Qt6 headers and libaries...)
|
---|
236 | PATH_SDK_QT6 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
|
---|
237 | endif
|
---|
238 | endif
|
---|
239 | else
|
---|
240 | # Resolve any fancy stuff once and for all.
|
---|
241 | PATH_SDK_QT6 := $(PATH_SDK_QT6)
|
---|
242 | endif
|
---|
243 |
|
---|
244 | # Libraries can be in either Frameworks or lib depending on how you
|
---|
245 | # build it on the mac. The .dmg installs into Frameworks but builds into lib.
|
---|
246 | ifeq ($(KBUILD_TARGET),darwin)
|
---|
247 | ifndef PATH_SDK_QT6_LIB
|
---|
248 | ifneq ($(wildcard $(PATH_SDK_QT6)/Frameworks),)
|
---|
249 | PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/Frameworks
|
---|
250 | else
|
---|
251 | PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/lib
|
---|
252 | endif
|
---|
253 | endif
|
---|
254 | else
|
---|
255 | PATH_SDK_QT6_LIB ?= $(PATH_SDK_QT6)/lib
|
---|
256 | PATH_SDK_QT6_INC ?= $(PATH_SDK_QT6)/include
|
---|
257 | endif
|
---|
258 |
|
---|
259 | # The bits that kBuild picks up.
|
---|
260 | # (nothing here)
|
---|
261 |
|
---|
262 |
|
---|
263 | #
|
---|
264 | # The QT6 tool.
|
---|
265 | #
|
---|
266 | # This is implemented here rather than in tools/QT6.kmk to enforce the global USES.
|
---|
267 | # It also makes things easier to develop, with fewer files I mean.
|
---|
268 | #
|
---|
269 | TOOL_QT6 = Qt6
|
---|
270 |
|
---|
271 | # Tool Specific Properties
|
---|
272 | # PATH_TOOL_QT6 - Obsolete.
|
---|
273 | # PATH_TOOL_QT6_BIN - The path to the lrc and lupdate tools.
|
---|
274 | # PATH_TOOL_QT6_LIBEXEC - The path to the moc, uic & rcc tools.
|
---|
275 | # TOOL_QT6_BIN_SUFF - The binary suffix for PATH_TOOL_QT6_BIN tools.
|
---|
276 | # TOOL_QT6_LIBEXEC_SUFF - The binary suffix for PATH_TOOL_QT6_LIBEXEC tools.
|
---|
277 | if !defined(PATH_TOOL_QT6_BIN) && defined(PATH_TOOL_QT6)
|
---|
278 | PATH_TOOL_QT6_BIN := $(PATH_TOOL_QT6)/bin
|
---|
279 | endif
|
---|
280 | ifndef PATH_TOOL_QT6_BIN
|
---|
281 | PATH_TOOL_QT6_BIN := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST)/qt/v6*/bin)))
|
---|
282 | if "$(PATH_TOOL_QT6_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
|
---|
283 | PATH_TOOL_QT6_BIN := $(firstfile $(rversortfiles $(qwildcard ,$(KBUILD_DEVTOOLS_HST_ALT)/qt/v6*/bin)))
|
---|
284 | endif
|
---|
285 | ifeq ($(PATH_TOOL_QT6_BIN),)
|
---|
286 | ifdef TOOL_QT6_BIN_SUFF
|
---|
287 | TOOL_QT6_BIN_SUFF := $(TOOL_QT6_BIN_SUFF)
|
---|
288 | endif
|
---|
289 | # Try looking for lupdate-qt6 / lupdate-$(suffix) first (this is in bin rather than libexec).
|
---|
290 | ifneq ($(TOOL_QT6_BIN_SUFF),)
|
---|
291 | PATH_TOOL_QT6_BIN := $(patsubst %/lupdate$(TOOL_QT6_BIN_SUFF),%,$(firstword $(wildcard \
|
---|
292 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF)) \
|
---|
293 | $(if $(intersects $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF)) \
|
---|
294 | /usr/lib/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
|
---|
295 | /usr/qt/6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
|
---|
296 | /usr/share/qt6/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
|
---|
297 | /usr/local/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
|
---|
298 | /usr/bin/lupdate$(TOOL_QT6_BIN_SUFF) \
|
---|
299 | )))
|
---|
300 | else
|
---|
301 | # No suffix given, so before we check out -qt6 look at qt6 specific locations to avoid choosers and symlinks.
|
---|
302 | PATH_TOOL_QT6_BIN := $(patsubst %/lupdate,%,$(firstword $(wildcard \
|
---|
303 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate) \
|
---|
304 | $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate,) \
|
---|
305 | /usr/lib/qt6/bin/lupdate \
|
---|
306 | /usr/local/lib/qt6/bin/lupdate \
|
---|
307 | /usr/qt/6/bin/lupdate \
|
---|
308 | /usr/local/qt/6/bin/lupdate \
|
---|
309 | /usr/share/qt6/bin/lupdate \
|
---|
310 | /usr/local/share/qt6/bin/lupdate \
|
---|
311 | )))
|
---|
312 | ifeq ($(PATH_TOOL_QT6_BIN),)
|
---|
313 | PATH_TOOL_QT6_BIN := $(patsubst %/lupdate-qt6,%,$(firstword $(wildcard \
|
---|
314 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/lupdate-qt6) \
|
---|
315 | $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/lupdate-qt6,) \
|
---|
316 | /usr/lib/qt6/bin/lupdate-qt6 \
|
---|
317 | /usr/qt/6/bin/lupdate-qt6 \
|
---|
318 | /usr/share/qt6/bin/lupdate-qt6 \
|
---|
319 | /usr/local/bin/lupdate-qt6 \
|
---|
320 | /usr/bin/lupdate-qt6 \
|
---|
321 | )))
|
---|
322 | ifneq ($(PATH_TOOL_QT6_BIN),)
|
---|
323 | TOOL_QT6_BIN_SUFF := -qt6
|
---|
324 | endif
|
---|
325 | endif
|
---|
326 | endif
|
---|
327 | # If still no go, try looking for qmake.
|
---|
328 | ifeq ($(PATH_TOOL_QT6_BIN),)
|
---|
329 | PATH_TOOL_QT6_BIN := $(patsubst %/qmake,%,$(firstword $(wildcard \
|
---|
330 | $(foreach type,$(KBUILD_OSARCH_2_GNU_SYSTEM_TYPES.$(KBUILD_HOST_DOT_ARCH)),/usr/lib/$(type)/qt6/bin/qmake) \
|
---|
331 | $(if $(intersects $(KBUILD_HOST_ARCH), $(KBUILD_ARCHES_64)),/usr/lib64/qt6/bin/qmake,) \
|
---|
332 | /usr/lib/qt6/bin/qmake \
|
---|
333 | /usr/qt/6/bin/qmake \
|
---|
334 | /usr/share/qt6/bin/qmake \
|
---|
335 | /usr/local/bin/qmake \
|
---|
336 | /usr/bin/qmake \
|
---|
337 | )))
|
---|
338 | endif
|
---|
339 | ifneq ($(PATH_TOOL_QT6_BIN),)
|
---|
340 | export PATH_TOOL_QT6_BIN
|
---|
341 | endif
|
---|
342 | endif
|
---|
343 | # If not found, we'll enter the 'pathless' mode.
|
---|
344 | else
|
---|
345 | # Resolve any fancy stuff once and for all.
|
---|
346 | PATH_TOOL_QT6_BIN := $(PATH_TOOL_QT6_BIN)
|
---|
347 | endif
|
---|
348 |
|
---|
349 | # Unixes have moc, rcc, uic in a libexec dir rather than the bin dir, so try
|
---|
350 | # find that directory or alias the LIBEXEC stuff onto BIN.
|
---|
351 | ifndef PATH_TOOL_QT6_LIBEXEC
|
---|
352 | ifneq ($(PATH_TOOL_QT6_BIN),)
|
---|
353 | ifneq ($(qwildcard ,$(PATH_TOOL_QT6_BIN)/../libexec/moc*),)
|
---|
354 | PATH_TOOL_QT6_LIBEXEC := $(qabspath ,$(PATH_TOOL_QT6_BIN)/../libexec)
|
---|
355 | else
|
---|
356 | PATH_TOOL_QT6_LIBEXEC := $(PATH_TOOL_QT6_BIN)
|
---|
357 | endif
|
---|
358 | endif
|
---|
359 | else
|
---|
360 | PATH_TOOL_QT6_LIBEXEC := $(PATH_TOOL_QT6_LIBEXEC)
|
---|
361 | endif
|
---|
362 | if !defined(TOOL_QT6_LIBEXEC_SUFF) && defined(PATH_TOOL_QT6_LIBEXEC)
|
---|
363 | ifneq ($(qwildcard ,$(PATH_TOOL_QT6_LIBEXEC)/moc-qt6$(HOSTSUFF_EXE)),)
|
---|
364 | TOOL_QT6_LIBEXEC_SUFF := -qt6
|
---|
365 | endif
|
---|
366 | endif
|
---|
367 |
|
---|
368 | ifneq ($(PATH_TOOL_QT6_BIN),)
|
---|
369 | TOOL_QT6_MOC ?= $(PATH_TOOL_QT6_LIBEXEC)/moc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
370 | TOOL_QT6_UIC ?= $(PATH_TOOL_QT6_LIBEXEC)/uic$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
371 | TOOL_QT6_RCC ?= $(PATH_TOOL_QT6_LIBEXEC)/rcc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
372 | TOOL_QT6_LRC ?= $(PATH_TOOL_QT6_BIN)/lrelease$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
|
---|
373 | TOOL_QT6_LUPDATE ?= $(PATH_TOOL_QT6_BIN)/lupdate$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
|
---|
374 | else
|
---|
375 | # Pathless, relies on the environment.
|
---|
376 | TOOL_QT6_MOC ?= moc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
377 | TOOL_QT6_UIC ?= uic$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
378 | TOOL_QT6_RCC ?= rcc$(TOOL_QT6_LIBEXEC_SUFF)$(HOSTSUFF_EXE)
|
---|
379 | TOOL_QT6_LRC ?= lrelease$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
|
---|
380 | TOOL_QT6_LUPDATE ?= lupdate$(TOOL_QT6_BIN_SUFF)$(HOSTSUFF_EXE)
|
---|
381 | endif
|
---|
382 | ifdef TOOL_QT6_USE_KSUBMIT
|
---|
383 | ifeq ($(KBUILD_HOST),win)
|
---|
384 | TOOL_QT6_MOC_KSUBMIT ?= kmk_builtin_kSubmit --$(SP)
|
---|
385 | endif
|
---|
386 | endif
|
---|
387 |
|
---|
388 | # General Properties used by kBuild and/or units/qt.kmk
|
---|
389 | TOOL_QT6_MOCFLAGS ?=
|
---|
390 | TOOL_QT6_MOCINCS ?=
|
---|
391 | TOOL_QT6_MOCDEFS ?=
|
---|
392 | TOOL_QT6_MOCDEFS.darwin ?= __APPLE__ __GNUC__
|
---|
393 | TOOL_QT6_MOCDEFS.solaris ?= __sun
|
---|
394 | TOOL_QT6_MOCDEFS.win.amd64 ?= WIN64
|
---|
395 | TOOL_QT6_MOCDEFS.win.x86 ?= WIN32
|
---|
396 |
|
---|
397 |
|
---|
398 | ## MOC a C++ source file.
|
---|
399 | # @param $(target) Normalized main target name.
|
---|
400 | # @param $(source) Source filename (relative).
|
---|
401 | # @param $(out) Object file name. This shall be (re)created by the compilation.
|
---|
402 | # @param $(dep) Dependcy file. This may be (re)created by the compilation.
|
---|
403 | # @param $(flags) Flags.
|
---|
404 | # @param $(defs) Definitions.
|
---|
405 | # @param $(incs) Includes.
|
---|
406 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
407 | #
|
---|
408 | TOOL_QT6_MOC_CPP_DEPEND =
|
---|
409 | TOOL_QT6_MOC_CPP_DEPORD =
|
---|
410 | TOOL_QT6_MOC_CPP_OUTPUT =
|
---|
411 | TOOL_QT6_MOC_CPP_OUTPUT_MAYBE =
|
---|
412 | ifdef KMK_WITH_QUOTING
|
---|
413 | define TOOL_QT6_MOC_CPP_CMDS
|
---|
414 | $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
|
---|
415 | $(flags)\
|
---|
416 | $(qaddprefix sh,-I, $(incs))\
|
---|
417 | $(qaddprefix sh,-D, $(defs))\
|
---|
418 | -o $(out)\
|
---|
419 | $(source)
|
---|
420 | endef
|
---|
421 | else
|
---|
422 | define TOOL_QT6_MOC_CPP_CMDS
|
---|
423 | $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
|
---|
424 | $(flags)\
|
---|
425 | $(addprefix -I, $(incs))\
|
---|
426 | $(addprefix -D, $(defs))\
|
---|
427 | -o $(out)\
|
---|
428 | $(source)
|
---|
429 | endef
|
---|
430 | endif
|
---|
431 |
|
---|
432 | ## MOC a C++ header file.
|
---|
433 | # @param $(target) Normalized main target name.
|
---|
434 | # @param $(source) Source filename (relative).
|
---|
435 | # @param $(out) Object file name. This shall be (re)created by the compilation.
|
---|
436 | # @param $(dep) Dependcy file. This may be (re)created by the compilation.
|
---|
437 | # @param $(flags) Flags.
|
---|
438 | # @param $(defs) Definitions.
|
---|
439 | # @param $(incs) Includes.
|
---|
440 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
441 | #
|
---|
442 | TOOL_QT6_MOC_HPP_DEPEND =
|
---|
443 | TOOL_QT6_MOC_HPP_DEPORD =
|
---|
444 | TOOL_QT6_MOC_HPP_OUTPUT =
|
---|
445 | TOOL_QT6_MOC_HPP_OUTPUT_MAYBE =
|
---|
446 | ifdef KMK_WITH_QUOTING
|
---|
447 | define TOOL_QT6_MOC_HPP_CMDS
|
---|
448 | $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
|
---|
449 | $(flags)\
|
---|
450 | $(qaddprefix sh,-I, $(incs))\
|
---|
451 | $(qaddprefix sh,-D, $(defs))\
|
---|
452 | -o $(out)\
|
---|
453 | $(source)
|
---|
454 | endef
|
---|
455 | else
|
---|
456 | define TOOL_QT6_MOC_HPP_CMDS
|
---|
457 | $(QUIET)$(TOOL_QT6_MOC_KSUBMIT)$(TOOL_QT6_MOC)\
|
---|
458 | $(flags)\
|
---|
459 | $(addprefix -I, $(incs))\
|
---|
460 | $(addprefix -D, $(defs))\
|
---|
461 | -o $(out)\
|
---|
462 | $(source)
|
---|
463 | endef
|
---|
464 | endif
|
---|
465 |
|
---|
466 | ## Compile a Qt user interface file (.ui).
|
---|
467 | # @param $(target) Normalized main target name.
|
---|
468 | # @param $(source) Source filename (relative).
|
---|
469 | # @param $(out) Object file name. This shall be (re)created by the compilation.
|
---|
470 | # @param $(dep) Dependcy file. This may be (re)created by the compilation.
|
---|
471 | # @param $(flags) Flags.
|
---|
472 | # @param $(defs) Definitions.
|
---|
473 | # @param $(incs) Includes.
|
---|
474 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
475 | #
|
---|
476 | TOOL_QT6_UIC_UI_DEPEND =
|
---|
477 | TOOL_QT6_UIC_UI_DEPORD =
|
---|
478 | TOOL_QT6_UIC_UI_OUTPUT =
|
---|
479 | TOOL_QT6_UIC_UI_OUTPUT_MAYBE =
|
---|
480 | define TOOL_QT6_UIC_UI_CMDS
|
---|
481 | $(QUIET)$(TOOL_QT6_UIC)\
|
---|
482 | $(flags)\
|
---|
483 | -o $(out)\
|
---|
484 | $(source)
|
---|
485 | endef
|
---|
486 |
|
---|
487 | ## Compile a Qt resource file (.qrc).
|
---|
488 | # @param $(target) Normalized main target name.
|
---|
489 | # @param $(source) Source filename (relative).
|
---|
490 | # @param $(out) Object file name. This shall be (re)created by the compilation.
|
---|
491 | # @param $(dep) Dependcy file. This may be (re)created by the compilation.
|
---|
492 | # @param $(flags) Flags.
|
---|
493 | # @param $(defs) Definitions.
|
---|
494 | # @param $(incs) Includes.
|
---|
495 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
496 | #
|
---|
497 | # @remarks The sed script generating the dependency file is a bit naive.
|
---|
498 | TOOL_QT6_RCC_QRC_DEPEND =
|
---|
499 | TOOL_QT6_RCC_QRC_DEPORD =
|
---|
500 | TOOL_QT6_RCC_QRC_OUTPUT =
|
---|
501 | TOOL_QT6_RCC_QRC_OUTPUT_MAYBE =
|
---|
502 | define TOOL_QT6_RCC_QRC_CMDS
|
---|
503 | $(QUIET)$(TOOL_QT6_RCC)\
|
---|
504 | $(flags)\
|
---|
505 | -o $(out)\
|
---|
506 | $(source)
|
---|
507 | $(QUIET2)$(APPEND) -n $(dep) '\' \
|
---|
508 | '$(out): \' \
|
---|
509 | '$(source) \'
|
---|
510 | $(QUIET2)$(SED) \
|
---|
511 | -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
|
---|
512 | -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
|
---|
513 | -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
|
---|
514 | -e 's|$$$$| \\|' \
|
---|
515 | --append $(dep) \
|
---|
516 | $(source)
|
---|
517 | $(QUIET2)$(APPEND) $(dep)
|
---|
518 | $(QUIET2)$(SED) \
|
---|
519 | -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
|
---|
520 | -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
|
---|
521 | -e 's|^[^/][^:]|$(abspathex $(dir $(source)),$(defpath))/&|' \
|
---|
522 | -e 's|$$$$|:\n|' \
|
---|
523 | --append $(dep) \
|
---|
524 | $(source)
|
---|
525 | $(QUIET2)$(APPEND) $(dep)
|
---|
526 | endef
|
---|
527 |
|
---|
528 | ## Compile a Qt translation file (.ts).
|
---|
529 | # @param $(target) Normalized main target name.
|
---|
530 | # @param $(source) Source filename (relative).
|
---|
531 | # @param $(out) Object file name. This shall be (re)created by the compilation.
|
---|
532 | # @param $(dep) Dependcy file. This may be (re)created by the compilation.
|
---|
533 | # @param $(flags) Flags.
|
---|
534 | # @param $(defs) Definitions.
|
---|
535 | # @param $(incs) Includes.
|
---|
536 | # @param $(outbase) Output basename (full). Use this for list files and such.
|
---|
537 | #
|
---|
538 | TOOL_QT6_LRC_TS_DEPEND =
|
---|
539 | TOOL_QT6_LRC_TS_DEPORD =
|
---|
540 | TOOL_QT6_LRC_TS_OUTPUT =
|
---|
541 | TOOL_QT6_LRC_TS_OUTPUT_MAYBE =
|
---|
542 | define TOOL_QT6_LRC_TS_CMDS
|
---|
543 | $(QUIET)$(TOOL_QT6_LRC)\
|
---|
544 | $(flags)\
|
---|
545 | $(source)\
|
---|
546 | -qm $(out)
|
---|
547 | endef
|
---|
548 |
|
---|
549 |
|
---|
550 |
|
---|
551 | #
|
---|
552 | #
|
---|
553 | # Back to the Qt6 unit.
|
---|
554 | #
|
---|
555 | #
|
---|
556 |
|
---|
557 |
|
---|
558 | ## wrapper for the lrelease (LRC) command dependencies.
|
---|
559 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
560 | _UNIT_QT6_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
|
---|
561 | else
|
---|
562 | _UNIT_QT6_LRC_CMDS_DEP =
|
---|
563 | endif
|
---|
564 |
|
---|
565 | ##
|
---|
566 | # def_unit_qt6_target_pre_handle_translation helper that is expanded before evaluation.
|
---|
567 | #
|
---|
568 | # This is necessary to resolve reference to local variables before doing
|
---|
569 | # assignments and setting up commands. They would otherwise be resolved
|
---|
570 | # later in a different context and the result would be completely wrong.
|
---|
571 | #
|
---|
572 | define def_unit_qt6_target_pre_handle_translation_dx
|
---|
573 |
|
---|
574 | $(out) + $(more_output) +| $(maybe_output): \
|
---|
575 | $(deps) \
|
---|
576 | $(value _UNIT_QT6_LRC_CMDS_DEP) \
|
---|
577 | | \
|
---|
578 | $(orderdeps)
|
---|
579 | %$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
|
---|
580 | $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
|
---|
581 |
|
---|
582 | $(cmds)
|
---|
583 |
|
---|
584 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
585 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
---|
586 | %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
|
---|
587 | 'define $(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_' \
|
---|
588 | '--insert-command=$(out)' \
|
---|
589 | 'endef'
|
---|
590 | else
|
---|
591 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
---|
592 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_LRC_CMDS_PREV_'
|
---|
593 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
---|
594 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
595 | endif
|
---|
596 | endif
|
---|
597 |
|
---|
598 | $(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
|
---|
599 | $(target)-inst-nls_SOURCES += $(out)
|
---|
600 |
|
---|
601 | endef # def_unit_qt6_target_pre_handle_translation_dx
|
---|
602 |
|
---|
603 | ##
|
---|
604 | # Handle a source file listed in QT_TRANSLATIONS.
|
---|
605 | #
|
---|
606 | # The files listed in QT_TRANSLATIONS are translation files (.ts) which needs
|
---|
607 | # to be translated into .qm files that are loadble by Qt.
|
---|
608 | #
|
---|
609 | # @remarks Invoked via $(evalvalctx ).
|
---|
610 | define def_unit_qt6_target_pre_handle_translation
|
---|
611 | local type := LRC
|
---|
612 |
|
---|
613 | # fetch the properties.
|
---|
614 | local tool := $(kb-src-tool dummy_var)
|
---|
615 | local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
|
---|
616 | local outbase := $(qtnlsdir)/$(notdir $(basename $(source)))
|
---|
617 | local out := $(outbase).qm
|
---|
618 | local dep := $(out).dep
|
---|
619 | local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
|
---|
620 | local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
|
---|
621 | local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
|
---|
622 |
|
---|
623 | # default path + source dep.
|
---|
624 | ifneq ($(defpath),)
|
---|
625 | ifdef KMK_WITH_QUOTING
|
---|
626 | local source := $(qabspathex ,$(source),$(defpath))
|
---|
627 | local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
|
---|
628 | local incs := $(qabspathex ,$(incs),$(defpath))
|
---|
629 | else
|
---|
630 | local source := $(abspathex $(source),$(defpath))
|
---|
631 | local deps := $(abspathex $(deps),$(defpath)) $(source)
|
---|
632 | local incs := $(abspathex $(incs),$(defpath))
|
---|
633 | endif
|
---|
634 | else
|
---|
635 | local deps += $(source)
|
---|
636 | endif
|
---|
637 |
|
---|
638 | # call the tool
|
---|
639 | ifndef TOOL_$(tool)_LRC_TS_CMDS
|
---|
640 | $(error kBuild: qt lrelease tool not found: TOOL_$(tool)_LRC_TS_CMDS)
|
---|
641 | endif
|
---|
642 | local cmds := $(TOOL_$(tool)_LRC_TS_CMDS)
|
---|
643 | local more_output := $(TOOL_$(tool)_LRC_TS_OUTPUT)
|
---|
644 | local maybe_output := $(TOOL_$(tool)_LRC_TS_OUTPUT_MAYBE)
|
---|
645 | local deps += $(TOOL_$(tool)_LRC_TS_DEPEND)
|
---|
646 | local orderdeps += $(TOOL_$(tool)_LRC_TS_DEPORD)
|
---|
647 |
|
---|
648 | # generate the link rule and update some source and target variables.
|
---|
649 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
650 | $(eval includedep $(dep))
|
---|
651 | endif
|
---|
652 | $(eval $(def_unit_qt6_target_pre_handle_translation_dx))
|
---|
653 |
|
---|
654 | endef # def_unit_qt6_target_pre_handle_translation
|
---|
655 |
|
---|
656 |
|
---|
657 |
|
---|
658 | ## wrapper for the UIC command dependencies.
|
---|
659 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
660 | _UNIT_QT6_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
|
---|
661 | else
|
---|
662 | _UNIT_QT6_RCC_CMDS_DEP =
|
---|
663 | endif
|
---|
664 |
|
---|
665 | ##
|
---|
666 | # def_unit_qt6_target_pre_handle_qrc helper that is expanded before evaluation.
|
---|
667 | #
|
---|
668 | # This is necessary to resolve reference to local variables before doing
|
---|
669 | # assignments and setting up commands. They would otherwise be resolved
|
---|
670 | # later in a different context and the result would be completely wrong.
|
---|
671 | #
|
---|
672 | define def_unit_qt6_target_pre_handle_rcc_dx
|
---|
673 |
|
---|
674 | $(out) +| $(realout) $(more_output) $(maybe_output): \
|
---|
675 | $(deps) \
|
---|
676 | $(value _UNIT_QT6_RCC_CMDS_DEP) \
|
---|
677 | | \
|
---|
678 | $(orderdeps)
|
---|
679 | %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
|
---|
680 | $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
|
---|
681 |
|
---|
682 | $(cmds)
|
---|
683 |
|
---|
684 | $(QUIET)$(CP) --changed -f $(out) $(realout)
|
---|
685 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
686 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
---|
687 | %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
|
---|
688 | 'define $(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_' \
|
---|
689 | '--insert-command=$(out)' \
|
---|
690 | 'endef'
|
---|
691 | else
|
---|
692 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
---|
693 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_RCC_CMDS_PREV_'
|
---|
694 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
---|
695 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
696 | endif
|
---|
697 | endif
|
---|
698 |
|
---|
699 | $(target)_2_INTERMEDIATES += $(realout)
|
---|
700 | $(target)_GEN_SOURCES_ += $(realout)
|
---|
701 | $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
|
---|
702 |
|
---|
703 | endef # def_unit_qt6_target_pre_handle_rcc_dx
|
---|
704 |
|
---|
705 | ##
|
---|
706 | # Source handler for .qrc sources (Qt resource files).
|
---|
707 | #
|
---|
708 | # @remarks $(evalvalctx me).
|
---|
709 | define def_unit_qt6_src_handler_qrc
|
---|
710 | local type := RCC
|
---|
711 |
|
---|
712 | # fetch the properties.
|
---|
713 | local tool := $(kb-src-tool dummy_var)
|
---|
714 | local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
|
---|
715 | local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
|
---|
716 | local out := $(outbase).tmp.gen.cpp
|
---|
717 | local realout := $(outbase).gen.cpp
|
---|
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)
|
---|
722 |
|
---|
723 | # default path + source dep.
|
---|
724 | ifneq ($(defpath),)
|
---|
725 | ifdef KMK_WITH_QUOTING
|
---|
726 | local source := $(qabspathex ,$(source),$(defpath))
|
---|
727 | local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
|
---|
728 | local incs := $(qabspathex ,$(incs),$(defpath))
|
---|
729 | else
|
---|
730 | local source := $(abspathex $(source),$(defpath))
|
---|
731 | local deps := $(abspathex $(deps),$(defpath)) $(source)
|
---|
732 | local incs := $(abspathex $(incs),$(defpath))
|
---|
733 | endif
|
---|
734 | else
|
---|
735 | local deps += $(source)
|
---|
736 | endif
|
---|
737 |
|
---|
738 | # call the tool
|
---|
739 | ifndef TOOL_$(tool)_RCC_QRC_CMDS
|
---|
740 | $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
|
---|
741 | endif
|
---|
742 | local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
|
---|
743 | local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
|
---|
744 | local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
|
---|
745 | local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
|
---|
746 | local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
|
---|
747 |
|
---|
748 | # generate the link rule and update some source and target variables.
|
---|
749 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
750 | $(eval includedep $(dep))
|
---|
751 | endif
|
---|
752 | $(eval $(def_unit_qt6_target_pre_handle_rcc_dx))
|
---|
753 |
|
---|
754 | endef # def_unit_qt6_src_handler_qrc
|
---|
755 |
|
---|
756 |
|
---|
757 |
|
---|
758 | ## wrapper for the UIC command dependencies.
|
---|
759 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
760 | _UNIT_QT6_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
|
---|
761 | else
|
---|
762 | _UNIT_QT6_UIC_CMDS_DEP =
|
---|
763 | endif
|
---|
764 |
|
---|
765 | ##
|
---|
766 | # def_unit_qt6_src_handler_ui helper that is expanded before evaluation.
|
---|
767 | #
|
---|
768 | # This is necessary to resolve reference to local variables before doing
|
---|
769 | # assignments and setting up commands. They would otherwise be resolved
|
---|
770 | # later in a different context and the result would be completely wrong.
|
---|
771 | #
|
---|
772 | define def_unit_qt6_target_pre_handle_ui_dx
|
---|
773 |
|
---|
774 | $(out) +| $(realout) $(more_output) $(maybe_output): \
|
---|
775 | $(deps) \
|
---|
776 | $(value _UNIT_QT6_UIC_CMDS_DEP) \
|
---|
777 | | \
|
---|
778 | $(orderdeps)
|
---|
779 | %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
|
---|
780 | $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
|
---|
781 |
|
---|
782 | $(cmds)
|
---|
783 |
|
---|
784 | $(QUIET)$(CP) --changed -f $(out) $(realout)
|
---|
785 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
786 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
---|
787 | %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
|
---|
788 | 'define $(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_' \
|
---|
789 | '--insert-command=$(out)' \
|
---|
790 | 'endef'
|
---|
791 | else
|
---|
792 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
---|
793 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_UIC_CMDS_PREV_'
|
---|
794 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
---|
795 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
796 | endif
|
---|
797 | endif
|
---|
798 |
|
---|
799 | $(target)_2_INTERMEDIATES += $(realout)
|
---|
800 | $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
|
---|
801 |
|
---|
802 | endef # def_unit_qt6_target_pre_handle_ui_dx
|
---|
803 |
|
---|
804 | ##
|
---|
805 | # Source handler for .ui sources.
|
---|
806 | #
|
---|
807 | # @remarks $(evalvalctx me).
|
---|
808 | define def_unit_qt6_src_handler_ui
|
---|
809 | local type := UIC
|
---|
810 |
|
---|
811 | # fetch the properties.
|
---|
812 | local tool := $(kb-src-tool dummy_var)
|
---|
813 | local qtuicdir := $($(target)_0_OUTDIR)/qtuic
|
---|
814 | local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
|
---|
815 | local out := $(outbase).tmp.gen.h
|
---|
816 | local realout := $(outbase).gen.h
|
---|
817 | local dep := $(realout).dep
|
---|
818 | local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
|
---|
819 | local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
|
---|
820 | local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
|
---|
821 |
|
---|
822 | # default path + source dep.
|
---|
823 | ifneq ($(defpath),)
|
---|
824 | ifdef KMK_WITH_QUOTING
|
---|
825 | local source := $(qabspathex ,$(source),$(defpath))
|
---|
826 | local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
|
---|
827 | local incs := $(qabspathex ,$(incs),$(defpath))
|
---|
828 | else
|
---|
829 | local source := $(abspathex $(source),$(defpath))
|
---|
830 | local deps := $(abspathex $(deps),$(defpath)) $(source)
|
---|
831 | local incs := $(abspathex $(incs),$(defpath))
|
---|
832 | endif
|
---|
833 | else
|
---|
834 | local deps += $(source)
|
---|
835 | endif
|
---|
836 |
|
---|
837 | # call the tool
|
---|
838 | ifndef TOOL_$(tool)_UIC_UI_CMDS
|
---|
839 | $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
|
---|
840 | endif
|
---|
841 | local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
|
---|
842 | local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
|
---|
843 | local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
|
---|
844 | local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
|
---|
845 | local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
|
---|
846 |
|
---|
847 | # generate the link rule and update some source and target variables.
|
---|
848 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
849 | $(eval includedep $(dep))
|
---|
850 | endif
|
---|
851 | $(eval $(def_unit_qt6_target_pre_handle_ui_dx))
|
---|
852 |
|
---|
853 | endef # def_unit_qt6_src_handler_ui
|
---|
854 |
|
---|
855 |
|
---|
856 |
|
---|
857 | ## wrapper for the MOC command dependencies.
|
---|
858 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
859 | _UNIT_QT6_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
|
---|
860 | else
|
---|
861 | _UNIT_QT6_MOC_HPP_CMDS_DEP =
|
---|
862 | endif
|
---|
863 |
|
---|
864 | ##
|
---|
865 | # def_unit_qt6_target_pre_handle_moc_hdr helper that is expanded before evaluation.
|
---|
866 | #
|
---|
867 | # This is necessary to resolve reference to local variables before doing
|
---|
868 | # assignments and setting up commands. They would otherwise be resolved
|
---|
869 | # later in a different context and the result would be completely wrong.
|
---|
870 | #
|
---|
871 | define def_unit_qt6_target_pre_handle_moc_hdr_dx
|
---|
872 |
|
---|
873 | $(out) +| $(realout) $(more_output) $(maybe_output): \
|
---|
874 | $(deps) \
|
---|
875 | $(value _UNIT_QT6_MOC_HPP_CMDS_DEP) \
|
---|
876 | | \
|
---|
877 | $(orderdeps) $(my_target_intermediate_vars)
|
---|
878 | %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
|
---|
879 | $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
|
---|
880 |
|
---|
881 | $(cmds)
|
---|
882 |
|
---|
883 | $(QUIET)$(CP) --changed -f $(out) $(realout)
|
---|
884 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
885 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
---|
886 | %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
|
---|
887 | 'define $(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_' \
|
---|
888 | '--insert-command=$(out)' \
|
---|
889 | 'endef'
|
---|
890 | else
|
---|
891 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
---|
892 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_MOC_HPP_CMDS_PREV_'
|
---|
893 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
---|
894 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
895 | endif
|
---|
896 | endif
|
---|
897 |
|
---|
898 | $(target)_2_INTERMEDIATES += $(realout)
|
---|
899 | $(target)_GEN_SOURCES_ += $(realout)
|
---|
900 | $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
|
---|
901 |
|
---|
902 | endef
|
---|
903 |
|
---|
904 | ##
|
---|
905 | # Handle a source file listed in QT_MOCHDRS.
|
---|
906 | #
|
---|
907 | # The files listed in QT_MOCHDRS uses the Q_OBJECT macro and we will
|
---|
908 | # generate a .cpp file for each of them and add it to the generated
|
---|
909 | # sources so that it's compiled and linked. (There is an alternative
|
---|
910 | # way to do this where the .cpp file is included, this isn't currently
|
---|
911 | # supported by this unit.)
|
---|
912 | #
|
---|
913 | # @remarks Invoked via $(evalvalctx ).
|
---|
914 | define def_unit_qt6_target_pre_handle_moc_hdr
|
---|
915 | local type := MOC
|
---|
916 |
|
---|
917 | # fetch the properties.
|
---|
918 | local tool := $(kb-src-tool dummy_var)
|
---|
919 | local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
|
---|
920 | local out := $(outbase).tmp.cpp
|
---|
921 | local realout := $(outbase).cpp
|
---|
922 | local dep := $(realout).dep
|
---|
923 | local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
|
---|
924 | local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
|
---|
925 | local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
|
---|
926 | local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
|
---|
927 | local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
|
---|
928 |
|
---|
929 | # default path + source dep.
|
---|
930 | ifneq ($(defpath),)
|
---|
931 | ifdef KMK_WITH_QUOTING
|
---|
932 | local source := $(qabspathex ,$(source),$(defpath))
|
---|
933 | local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
|
---|
934 | local incs := $(qabspathex ,$(incs),$(defpath))
|
---|
935 | else
|
---|
936 | local source := $(abspathex $(source),$(defpath))
|
---|
937 | local deps := $(abspathex $(deps),$(defpath)) $(source)
|
---|
938 | local incs := $(abspathex $(incs),$(defpath))
|
---|
939 | endif
|
---|
940 | else
|
---|
941 | local deps += $(source)
|
---|
942 | endif
|
---|
943 |
|
---|
944 | # call the tool
|
---|
945 | ifndef TOOL_$(tool)_MOC_HPP_CMDS
|
---|
946 | $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
|
---|
947 | endif
|
---|
948 | local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
|
---|
949 | local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
|
---|
950 | local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
|
---|
951 | local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
|
---|
952 | local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
|
---|
953 |
|
---|
954 | # generate the link rule and update some source and target variables.
|
---|
955 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
956 | $(eval includedep $(dep))
|
---|
957 | endif
|
---|
958 | $(eval $(def_unit_qt6_target_pre_handle_moc_hdr_dx))
|
---|
959 |
|
---|
960 | endef # def_unit_qt6_target_pre_handle_moc_hdr
|
---|
961 |
|
---|
962 |
|
---|
963 | ## wrapper for the MOC command dependencies.
|
---|
964 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
965 | _UNIT_QT6_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
|
---|
966 | else
|
---|
967 | _UNIT_QT6_MOC_CPP_CMDS_DEP =
|
---|
968 | endif
|
---|
969 |
|
---|
970 | ##
|
---|
971 | # def_unit_qt6_target_pre_handle_moc_src helper that is expanded before evaluation.
|
---|
972 | #
|
---|
973 | # This is necessary to resolve reference to local variables before doing
|
---|
974 | # assignments and setting up commands. They would otherwise be resolved
|
---|
975 | # later in a different context and the result would be completely wrong.
|
---|
976 | #
|
---|
977 | define def_unit_qt6_target_pre_handle_moc_src_dx
|
---|
978 |
|
---|
979 | $(out) +| $(realout) $(more_output) $(maybe_output): \
|
---|
980 | $(deps) \
|
---|
981 | $(value _UNIT_QT6_MOC_CPP_CMDS_DEP) \
|
---|
982 | | \
|
---|
983 | $(orderdeps) $(my_target_intermediate_vars)
|
---|
984 | %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
|
---|
985 | $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
|
---|
986 |
|
---|
987 | $(cmds)
|
---|
988 |
|
---|
989 | $(QUIET)$(CP) --changed -f $(out) $(realout)
|
---|
990 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
991 | ifdef KBUILD_HAVE_OPTIMIZED_APPEND
|
---|
992 | %$$(QUIET2)$$(APPEND) -ni '$(dep)' \
|
---|
993 | 'define $(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_' \
|
---|
994 | '--insert-command=$(out)' \
|
---|
995 | 'endef'
|
---|
996 | else
|
---|
997 | %$$(QUIET2)$$(APPEND) '$(dep)'
|
---|
998 | %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT6_MOC_CPP_CMDS_PREV_'
|
---|
999 | %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
|
---|
1000 | %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
|
---|
1001 | endif
|
---|
1002 | endif
|
---|
1003 |
|
---|
1004 | $(target)_2_INTERMEDIATES += $(realout)
|
---|
1005 | $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
|
---|
1006 |
|
---|
1007 | endef
|
---|
1008 |
|
---|
1009 | ##
|
---|
1010 | # Handle a source file listed in QT_MOCSRCS.
|
---|
1011 | #
|
---|
1012 | # The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
|
---|
1013 | # a .moc file that we're expected to generate here.
|
---|
1014 | #
|
---|
1015 | # @remarks Invoked via $(evalvalctx ).
|
---|
1016 | define def_unit_qt6_target_pre_handle_moc_src
|
---|
1017 | local type := MOC
|
---|
1018 |
|
---|
1019 | # fetch the properties.
|
---|
1020 | local tool := $(kb-src-tool dummy_var)
|
---|
1021 | local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
|
---|
1022 | local out := $(outbase).tmp.moc
|
---|
1023 | local realout := $(outbase).moc
|
---|
1024 | local dep := $(realout).dep
|
---|
1025 | local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
|
---|
1026 | local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
|
---|
1027 | local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
|
---|
1028 | local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
|
---|
1029 | local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
|
---|
1030 |
|
---|
1031 | # default path + source dep.
|
---|
1032 | ifneq ($(defpath),)
|
---|
1033 | ifdef KMK_WITH_QUOTING
|
---|
1034 | local source := $(qabspathex ,$(source),$(defpath))
|
---|
1035 | local deps := $(qabspathex ,$(deps),$(defpath)) $(source)
|
---|
1036 | local incs := $(qabspathex ,$(incs),$(defpath))
|
---|
1037 | else
|
---|
1038 | local source := $(abspathex $(source),$(defpath))
|
---|
1039 | local deps := $(abspathex $(deps),$(defpath)) $(source)
|
---|
1040 | local incs := $(abspathex $(incs),$(defpath))
|
---|
1041 | endif
|
---|
1042 | else
|
---|
1043 | local deps += $(source)
|
---|
1044 | endif
|
---|
1045 |
|
---|
1046 | # call the tool
|
---|
1047 | ifndef TOOL_$(tool)_MOC_CPP_CMDS
|
---|
1048 | $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
|
---|
1049 | endif
|
---|
1050 | local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
|
---|
1051 | local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
|
---|
1052 | local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
|
---|
1053 | local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
|
---|
1054 | local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
|
---|
1055 |
|
---|
1056 | # generate the link rule and update some source and target variables.
|
---|
1057 | ifndef NO_COMPILE_CMDS_DEPS
|
---|
1058 | $(eval includedep $(dep))
|
---|
1059 | endif
|
---|
1060 | $(eval $(def_unit_qt6_target_pre_handle_moc_src_dx))
|
---|
1061 |
|
---|
1062 | endef # def_unit_qt6_target_pre_handle_moc_src
|
---|
1063 |
|
---|
1064 |
|
---|
1065 | ##
|
---|
1066 | # Adds sources containing Q_OBJECT to QT_MOCSRCS.
|
---|
1067 | define def_unit_qt6_target_pre_cpp_source
|
---|
1068 | ifneq ($(file-size $(source)),-1)
|
---|
1069 | ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
|
---|
1070 | $(eval $(target)_QT_MOCSRCS += $(source))
|
---|
1071 | endif
|
---|
1072 | endif
|
---|
1073 | endef # def_unit_qt6_target_pre_cpp_source
|
---|
1074 |
|
---|
1075 | ##
|
---|
1076 | # Invoked early in the processing of a target that uses the Qt unit.
|
---|
1077 | #
|
---|
1078 | # It will append the qt source handlers to the target (.h, .ui, .ts,
|
---|
1079 | # .png, .bmp, .gif).
|
---|
1080 | #
|
---|
1081 | # It will then check all the C++ sources and check which needs
|
---|
1082 | # a .moc files and generate rules and dependencies fofor these
|
---|
1083 | #
|
---|
1084 | define def_unit_qt6_target_pre
|
---|
1085 |
|
---|
1086 | # Make QTTOOL the default for the specific Qt tools instead of TOOL.
|
---|
1087 | ifneq ($($(target)_QTTOOL),)
|
---|
1088 | ifeq ($($(target)_MOCTOOL),)
|
---|
1089 | $(target)_MOCTOOL := $($(target)_QTTOOL)
|
---|
1090 | endif
|
---|
1091 | ifeq ($($(target)_UICTOOL),)
|
---|
1092 | $(target)_UICTOOL := $($(target)_QTTOOL)
|
---|
1093 | endif
|
---|
1094 | ifeq ($($(target)_RCCTOOL),)
|
---|
1095 | $(target)_RCCTOOL := $($(target)_QTTOOL)
|
---|
1096 | endif
|
---|
1097 | ifeq ($($(target)_LRCTOOL),)
|
---|
1098 | $(target)_LRCTOOL := $($(target)_QTTOOL)
|
---|
1099 | endif
|
---|
1100 | endif
|
---|
1101 |
|
---|
1102 | # Deal with QT_MODULES, QT_PREFIX and QT_INFIX.
|
---|
1103 | local qt_modules := \
|
---|
1104 | $($(target)_QT_MODULES.$(bld_trg)) \
|
---|
1105 | $($(target)_QT_MODULES.$(bld_trg_arch)) \
|
---|
1106 | $($(target)_QT_MODULES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1107 | $($(target)_QT_MODULES.$(bld_trg_cpu)) \
|
---|
1108 | $($(target)_QT_MODULES.$(bld_type)) \
|
---|
1109 | $($(target)_QT_MODULES)
|
---|
1110 | local qt_prefix := $(firstword \
|
---|
1111 | $($(target)_QT_PREFIX.$(bld_trg)) \
|
---|
1112 | $($(target)_QT_PREFIX.$(bld_trg_arch)) \
|
---|
1113 | $($(target)_QT_PREFIX.$(bld_trg).$(bld_trg_arch)) \
|
---|
1114 | $($(target)_QT_PREFIX.$(bld_trg_cpu)) \
|
---|
1115 | $($(target)_QT_PREFIX.$(bld_type)) \
|
---|
1116 | $($(target)_QT_PREFIX))
|
---|
1117 | local qt_infix := $(firstword \
|
---|
1118 | $($(target)_QT_INFIX.$(bld_trg)) \
|
---|
1119 | $($(target)_QT_INFIX.$(bld_trg_arch)) \
|
---|
1120 | $($(target)_QT_INFIX.$(bld_trg).$(bld_trg_arch)) \
|
---|
1121 | $($(target)_QT_INFIX.$(bld_trg_cpu)) \
|
---|
1122 | $($(target)_QT_INFIX.$(bld_type)) \
|
---|
1123 | $($(target)_QT_INFIX))
|
---|
1124 | ifeq ($(bld_trg),darwin)
|
---|
1125 | # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
|
---|
1126 | $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT6_LIB) )
|
---|
1127 | $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT6_LIB) )
|
---|
1128 | $(eval $(target)_LDFLAGS += -F$(PATH_SDK_QT6_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
|
---|
1129 | $(eval $(target)_INCS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/A/Headers) )
|
---|
1130 | else
|
---|
1131 | ifeq ($(bld_trg),win)
|
---|
1132 | $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/$(qt_prefix)Qt6$(module)$(qt_infix)$(SUFF_LIB)) )
|
---|
1133 | else
|
---|
1134 | $(eval $(target)_LIBS += $(foreach module,$(qt_modules), $(PATH_SDK_QT6_LIB)/lib$(qt_prefix)Qt6$(module)$(qt_infix)$(SUFF_DLL)) )
|
---|
1135 | endif
|
---|
1136 | $(eval $(target)_INCS += $(addprefix $(PATH_SDK_QT6_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT6_INC) )
|
---|
1137 | endif
|
---|
1138 | $(eval $(target)_DEFS += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
|
---|
1139 |
|
---|
1140 |
|
---|
1141 | # Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
|
---|
1142 | # Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
|
---|
1143 | ifndef $(target)_QT_MOCSRCS
|
---|
1144 | $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
|
---|
1145 | $($(target)_SOURCES.$(bld_trg)) \
|
---|
1146 | $($(target)_SOURCES.$(bld_trg_arch)) \
|
---|
1147 | $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
|
---|
1148 | $($(target)_SOURCES.$(bld_trg_cpu)) \
|
---|
1149 | $($(target)_SOURCES.$(bld_type)) \
|
---|
1150 | $($(target)_SOURCES) \
|
---|
1151 | ), $(evalval def_unit_qt6_target_pre_cpp_source))
|
---|
1152 | endif
|
---|
1153 |
|
---|
1154 | # Install source handlers for .ui files.
|
---|
1155 | $(target)_SRC_HANDLERS += \
|
---|
1156 | .ui:def_unit_qt6_src_handler_ui \
|
---|
1157 | .UI:def_unit_qt6_src_handler_ui \
|
---|
1158 | .qrc:def_unit_qt6_src_handler_qrc \
|
---|
1159 | .qrc:def_unit_qt6_src_handler_qrc
|
---|
1160 |
|
---|
1161 | # Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
|
---|
1162 | local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
|
---|
1163 | local qtuicdir := $($(target)_0_OUTDIR)/qtuic
|
---|
1164 | local qtrccdir := $($(target)_0_OUTDIR)/qtrcc
|
---|
1165 | local qtnlsdir := $($(target)_0_OUTDIR)/qtnls
|
---|
1166 | $(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir) $(qtnlsdir))
|
---|
1167 | $(eval $(target)_INCS += $(qtmocdir) $(qtuicdir))
|
---|
1168 |
|
---|
1169 | # Since we add a lot of stuff to 2_INTERMEDIATES, we must exclude it from the intermediates
|
---|
1170 | # used by the rules we generate to avoid circular dependencies.
|
---|
1171 | local my_target_intermediate_vars := $(filter-out %_2_INTERMEDIATES$(CLOSEPAR),$(target_intermediate_vars))
|
---|
1172 |
|
---|
1173 | # Deal with QT_MOCSRCS.
|
---|
1174 | $(foreach source, \
|
---|
1175 | $($(target)_QT_MOCSRCS.$(bld_trg)) \
|
---|
1176 | $($(target)_QT_MOCSRCS.$(bld_trg_arch)) \
|
---|
1177 | $($(target)_QT_MOCSRCS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1178 | $($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
|
---|
1179 | $($(target)_QT_MOCSRCS.$(bld_type)) \
|
---|
1180 | $($(target)_QT_MOCSRCS) \
|
---|
1181 | , $(evalvalctx def_unit_qt6_target_pre_handle_moc_src))
|
---|
1182 |
|
---|
1183 | # Deal with QT_MOCHDRS.
|
---|
1184 | $(foreach source, \
|
---|
1185 | $($(target)_QT_MOCHDRS.$(bld_trg)) \
|
---|
1186 | $($(target)_QT_MOCHDRS.$(bld_trg_arch)) \
|
---|
1187 | $($(target)_QT_MOCHDRS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1188 | $($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
|
---|
1189 | $($(target)_QT_MOCHDRS.$(bld_type)) \
|
---|
1190 | $($(target)_QT_MOCHDRS) \
|
---|
1191 | , $(evalvalctx def_unit_qt6_target_pre_handle_moc_hdr))
|
---|
1192 |
|
---|
1193 | # Deal with QT_TRANSLATIONS.
|
---|
1194 | # ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
|
---|
1195 | local translations := \
|
---|
1196 | $($(target)_QT_TRANSLATIONS.$(bld_trg)) \
|
---|
1197 | $($(target)_QT_TRANSLATIONS.$(bld_trg_arch)) \
|
---|
1198 | $($(target)_QT_TRANSLATIONS.$(bld_trg).$(bld_trg_arch)) \
|
---|
1199 | $($(target)_QT_TRANSLATIONS.$(bld_trg_cpu)) \
|
---|
1200 | $($(target)_QT_TRANSLATIONS.$(bld_type)) \
|
---|
1201 | $($(target)_QT_TRANSLATIONS)
|
---|
1202 | ifneq ($(strip $(translations)),)
|
---|
1203 | local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
|
---|
1204 | $(eval $(expr))
|
---|
1205 | ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
|
---|
1206 | $(target)-inst-nls_TEMPLATE := $($(target)_QT_TRANSLATIONS_TEMPLATE)
|
---|
1207 | else
|
---|
1208 | $(target)-inst-nls_MODE := 0644
|
---|
1209 | endif
|
---|
1210 | ifdef $(target)_QT_TRANSLATIONS_INST
|
---|
1211 | $(target)-inst-nls_INST := $($(target)_QT_TRANSLATIONS_INST)
|
---|
1212 | endif
|
---|
1213 | $(target)-inst-nls_SOURCES :=
|
---|
1214 | $(foreach source, $(translations)\
|
---|
1215 | , $(evalvalctx def_unit_qt6_target_pre_handle_translation))
|
---|
1216 | endif
|
---|
1217 |
|
---|
1218 | endef # def_unit_qt6_target_pre
|
---|
1219 |
|
---|
1220 |
|
---|
1221 | #
|
---|
1222 | # Rule for debugging.
|
---|
1223 | #
|
---|
1224 | unit-qt6-show-vars:
|
---|
1225 | @$(ECHO) 'The Qt6 SDK variables:'
|
---|
1226 | @$(ECHO) ' PATH_SDK_QT6 = "$(PATH_SDK_QT6)"'
|
---|
1227 | @$(ECHO) ' PATH_SDK_QT6_INC = "$(PATH_SDK_QT6_INC)"'
|
---|
1228 | @$(ECHO) ' PATH_SDK_QT6_LIB = "$(PATH_SDK_QT6_LIB)"'
|
---|
1229 | @$(ECHO) ' PATH_SDK_QT6_LIB.amd64 = "$(PATH_SDK_QT6_LIB.amd64)"'
|
---|
1230 | @$(ECHO) ' PATH_SDK_QT6_LIB.x86 = "$(PATH_SDK_QT6_LIB.x86)"'
|
---|
1231 | @$(ECHO) 'The Qt6 TOOL variables:'
|
---|
1232 | @$(ECHO) ' PATH_TOOL_QT6_BIN = "$(PATH_TOOL_QT6_BIN)"'
|
---|
1233 | @$(ECHO) ' PATH_TOOL_QT6_LIBEXEC = "$(PATH_TOOL_QT6_LIBEXEC)"'
|
---|
1234 | @$(ECHO) ' TOOL_QT6_BIN_SUFF = "$(TOOL_QT6_BIN_SUFF)"'
|
---|
1235 | @$(ECHO) ' TOOL_QT6_LIBEXEC_SUFF = "$(TOOL_QT6_LIBEXEC_SUFF)"'
|
---|
1236 | @$(ECHO) ' TOOL_QT6_MOC = "$(TOOL_QT6_MOC)"'
|
---|
1237 | @$(ECHO) ' TOOL_QT6_UIC = "$(TOOL_QT6_UIC)"'
|
---|
1238 | @$(ECHO) ' TOOL_QT6_RCC = "$(TOOL_QT6_RCC)"'
|
---|
1239 | @$(ECHO) ' TOOL_QT6_LRC = "$(TOOL_QT6_LRC)"'
|
---|
1240 | @$(ECHO) ' TOOL_QT6_LUPDATE = "$(TOOL_QT6_LUPDATE)"'
|
---|
1241 |
|
---|