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