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

Last change on this file since 1672 was 1671, checked in by bird, 17 years ago

Initial qt4 unit. Missing nls, but is otherwise fine.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 19.8 KB
Line 
1# $Id: qt4.kmk 1671 2008-07-07 21:36:05Z bird $
2## @file
3# lex 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
27UNIT_qt4 = qt4
28
29# Add our target properties.
30PROPS_SINGLE += MOCTOOL UICTOOL RCCTOOL
31PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS RCCFLAGS
32
33
34#
35# The QT4 SDK.
36#
37# This is implemented here rather than in sdks/QT4.kmk to enforce the global USES.
38# It also makes things easier to develop, with fewer files I mean.
39#
40SDK_QT4 = Qt4
41## @todo
42
43
44#
45# The QT4 tool.
46#
47# This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
48# It also makes things easier to develop, with fewer files I mean.
49#
50TOOL_QT4 = Qt4
51
52# Tool Specific Properties
53ifndef PATH_TOOL_QT4
54 PATH_TOOL_QT4 := $(firstword $(rsort $(wildcard $(PATH_DEVTOOLS_BLD)/qt/v4*)))
55 # If not found, we'll enter the 'pathless' mode.
56else
57 # Resolve any fancy stuff once and for all.
58 PATH_TOOL_QT4 := $(PATH_TOOL_QT4)
59endif
60ifneq ($(PATH_TOOL_QT4),)
61 PATH_TOOL_QT4_BIN ?= $(PATH_TOOL_QT4)/bin
62 TOOL_QT4_MOC ?= $(PATH_TOOL_QT4_BIN)/moc$(HOST_SUFF_EXE)
63 TOOL_QT4_UIC ?= $(PATH_TOOL_QT4_BIN)/uic$(HOST_SUFF_EXE)
64 TOOL_QT4_RCC ?= $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
65 TOOL_QT4_LUPDATE ?= $(PATH_TOOL_QT4_BIN)/lupdate$(HOST_SUFF_EXE)
66 TOOL_QT4_LRELEASE ?= $(PATH_TOOL_QT4_BIN)/lrelease$(HOST_SUFF_EXE)
67else
68 # Pathless, relies on the environment.
69 TOOL_QT4_MOC ?= moc$(HOST_SUFF_EXE)
70 TOOL_QT4_UIC ?= uic$(HOST_SUFF_EXE)
71 TOOL_QT4_RCC ?= rcc$(HOST_SUFF_EXE)
72 TOOL_QT4_LUPDATE ?= lupdate$(HOST_SUFF_EXE)
73 TOOL_QT4_LRELEASE ?= lrelease$(HOST_SUFF_EXE)
74endif
75
76# General Properties used by kBuild and/or units/qt.kmk
77TOOL_QT4_MOCFLAGS ?=
78TOOL_QT4_MOCINCS ?=
79TOOL_QT4_MOCDEFS ?=
80TOOL_QT4_MOCDEFS.darwin ?= __APPLE__ __GNUC__
81TOOL_QT4_MOCDEFS.solaris ?= __sun
82TOOL_QT4_MOCDEFS.win.amd64 ?= WIN64
83TOOL_QT4_MOCDEFS.win.x86 ?= WIN32
84
85
86## MOC a C++ source file.
87# @param $(target) Normalized main target name.
88# @param $(source) Source filename (relative).
89# @param $(out) Object file name. This shall be (re)created by the compilation.
90# @param $(dep) Dependcy file. This may be (re)created by the compilation.
91# @param $(flags) Flags.
92# @param $(defs) Definitions.
93# @param $(incs) Includes.
94# @param $(outbase) Output basename (full). Use this for list files and such.
95#
96TOOL_QT4_MOC_CPP_DEPEND =
97TOOL_QT4_MOC_CPP_DEPORD =
98TOOL_QT4_MOC_CPP_OUTPUT =
99TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
100define TOOL_QT4_MOC_CPP_CMDS
101 $(QUIET)$(TOOL_QT4_MOC)\
102 $(flags)\
103 $(addprefix -I, $(incs))\
104 $(addprefix -D, $(defs))\
105 -o $(out)\
106 $(source)
107endef
108
109## MOC a C++ header file.
110# @param $(target) Normalized main target name.
111# @param $(source) Source filename (relative).
112# @param $(out) Object file name. This shall be (re)created by the compilation.
113# @param $(dep) Dependcy file. This may be (re)created by the compilation.
114# @param $(flags) Flags.
115# @param $(defs) Definitions.
116# @param $(incs) Includes.
117# @param $(outbase) Output basename (full). Use this for list files and such.
118#
119TOOL_QT4_MOC_HPP_DEPEND =
120TOOL_QT4_MOC_HPP_DEPORD =
121TOOL_QT4_MOC_HPP_OUTPUT =
122TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
123define TOOL_QT4_MOC_HPP_CMDS
124 $(QUIET)$(TOOL_QT4_MOC)\
125 $(flags)\
126 $(addprefix -I, $(incs))\
127 $(addprefix -D, $(defs))\
128 -o $(out)\
129 $(source)
130endef
131
132## Compile a Qt user interface file (.ui).
133# @param $(target) Normalized main target name.
134# @param $(source) Source filename (relative).
135# @param $(out) Object file name. This shall be (re)created by the compilation.
136# @param $(dep) Dependcy file. This may be (re)created by the compilation.
137# @param $(flags) Flags.
138# @param $(defs) Definitions.
139# @param $(incs) Includes.
140# @param $(outbase) Output basename (full). Use this for list files and such.
141#
142TOOL_QT4_UIC_UI_DEPEND =
143TOOL_QT4_UIC_UI_DEPORD =
144TOOL_QT4_UIC_UI_OUTPUT =
145TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
146define TOOL_QT4_UIC_UI_CMDS
147 $(QUIET)$(TOOL_QT4_UIC)\
148 $(flags)\
149 -o $(out)\
150 $(source)
151endef
152
153## Compile a Qt resource file (.qrc).
154# @param $(target) Normalized main target name.
155# @param $(source) Source filename (relative).
156# @param $(out) Object file name. This shall be (re)created by the compilation.
157# @param $(dep) Dependcy file. This may be (re)created by the compilation.
158# @param $(flags) Flags.
159# @param $(defs) Definitions.
160# @param $(incs) Includes.
161# @param $(outbase) Output basename (full). Use this for list files and such.
162#
163# @remarks The sed script generating the dependency file is a bit naive.
164TOOL_QT4_RCC_QRC_DEPEND =
165TOOL_QT4_RCC_QRC_DEPORD =
166TOOL_QT4_RCC_QRC_OUTPUT =
167TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
168define TOOL_QT4_RCC_QRC_CMDS
169 $(QUIET)$(TOOL_QT4_RCC)\
170 $(flags)\
171 -o $(out)\
172 $(source)
173 $(APPEND) $(dep) '$(source): \'
174 $(SED) \
175 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
176 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
177 -e 's|^[^/]|$(abspathex $(dir $(source)),$(defpath))/&|' \
178 -e 's|$$$$| \\|' \
179 --append $(dep) \
180 $(source)
181 $(APPEND) $(dep)
182 $(SED) \
183 -e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
184 -e 's/^.*<file[[:blank:]][^>]*>\([^<]*\)<\/file>.*$$$$/\1/' \
185 -e 's|^[^/]|$(abspathex $(dir $(source)),$(defpath))/&|' \
186 -e 's|$$$$|:\n|' \
187 --append $(dep) \
188 $(source)
189 $(APPEND) $(dep)
190endef
191
192
193
194#
195#
196# Back to the Qt4 unit.
197#
198#
199
200
201##
202# Source handler for .ts sources (translations).
203#
204# @remarks $(evalvalctx me).
205define def_unit_qt4_src_handler_ts
206$(warning def_unit_qt4_src_handler_ts: $(source))
207## @todo not quite sure about this bugger, perhaps the translations doesn't really belong here...
208endef
209
210
211## wrapper for the UIC command dependencies.
212ifndef NO_COMPILE_CMDS_DEPS
213 _UNIT_QT_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
214else
215 _UNIT_QT_RCC_CMDS_DEP =
216endif
217
218##
219# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
220#
221# This is necessary to resolve reference to local variables before doing
222# assignments and setting up commands. They would otherwise be resolved
223# later in a different context and the result would be completely wrong.
224#
225define def_unit_qt4_target_pre_handle_rcc_dx
226
227$(out) +| $(realout) $(more_output) $(maybe_output): \
228 $(deps) \
229 $(value _UNIT_QT_RCC_CMDS_DEP) \
230 | \
231 $(orderdeps)
232 %$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
233 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
234
235$(cmds)
236
237 $(QUIET)$(CP) --changed -f $(out) $(realout)
238ifndef NO_COMPILE_CMDS_DEPS
239 %$$(QUIET2)$$(APPEND) '$(dep)'
240 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT_RCC_CMDS_PREV_'
241 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
242 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
243endif
244
245$(target)_INTERMEDIATES += $(realout)
246$(target)_GEN_SOURCES_ += $(realout)
247$(target)_OUT_FILES += $(out) $(realout) $(more_output) $(maybe_output)
248
249endef # def_unit_qt4_target_pre_handle_rcc_dx
250
251##
252# Source handler for .qrc sources (Qt resource files).
253#
254# @remarks $(evalvalctx me).
255define def_unit_qt4_src_handler_qrc
256local type := RCC
257
258# fetch the properties.
259local tool := $(kb-src-tool dummy_var)
260local qtrccdir := $(PATH_$(target))/qtrcc
261local outbase := $(qtrccdir)/$(notdir $(basename $(source)))
262local out := $(outbase).tmp.gen.cpp
263local realout := $(outbase).gen.cpp
264local dep := $(realout).dep
265local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
266local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
267local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
268
269# default path + source dep.
270ifneq ($(defpath),)
271local deps := $(abspathex $(deps) $(source),$($(target)_PATH))
272local incs := $(abspathex $(incs),$($(target)_PATH))
273else
274local deps += $(source)
275endif
276
277# call the tool
278ifndef TOOL_$(tool)_RCC_QRC_CMDS
279 $(error kBuild: qt rcc tool not found: TOOL_$(tool)_RCC_QRC_CMDS)
280endif
281local cmds := $(TOOL_$(tool)_RCC_QRC_CMDS)
282local more_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT)
283local maybe_output := $(TOOL_$(tool)_RCC_QRC_OUTPUT_MAYBE)
284local deps += $(TOOL_$(tool)_RCC_QRC_DEPEND)
285local orderdeps += $(TOOL_$(tool)_RCC_QRC_DEPORD)
286
287# generate the link rule and update some source and target variables.
288ifndef NO_COMPILE_CMDS_DEPS
289 $(eval includedep $(dep))
290endif
291$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
292
293endef # def_unit_qt4_src_handler_qrc
294
295
296## wrapper for the UIC command dependencies.
297ifndef NO_COMPILE_CMDS_DEPS
298 _UNIT_QT_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
299else
300 _UNIT_QT_UIC_CMDS_DEP =
301endif
302
303##
304# def_unit_qt4_target_pre_handle_uic_ui helper that is expanded before evaluation.
305#
306# This is necessary to resolve reference to local variables before doing
307# assignments and setting up commands. They would otherwise be resolved
308# later in a different context and the result would be completely wrong.
309#
310define def_unit_qt4_target_pre_handle_ui_dx
311
312$(out) +| $(realout) $(more_output) $(maybe_output): \
313 $(deps) \
314 $(value _UNIT_QT_UIC_CMDS_DEP) \
315 | \
316 $(orderdeps)
317 %$$(call MSG_TOOL,uic,$(target),$(source),$$@)
318 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
319
320$(cmds)
321
322 $(QUIET)$(CP) --changed -f $(out) $(realout)
323ifndef NO_COMPILE_CMDS_DEPS
324 %$$(QUIET2)$$(APPEND) '$(dep)'
325 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT_UIC_CMDS_PREV_'
326 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
327 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
328endif
329
330$(target)_INTERMEDIATES += $(realout)
331$(target)_OUT_FILES += $(out) $(realout) $(more_output) $(maybe_output)
332
333endef # def_unit_qt4_target_pre_handle_ui_dx
334
335##
336# Source handler for .ui sources.
337#
338# @remarks $(evalvalctx me).
339define def_unit_qt4_src_handler_ui
340local type := UIC
341
342# fetch the properties.
343local tool := $(kb-src-tool dummy_var)
344local qtuicdir := $(PATH_$(target))/qtuic
345local outbase := $(qtuicdir)/$(notdir $(basename $(source)))
346local out := $(outbase).tmp.gen.h
347local realout := $(outbase).gen.h
348local dep := $(realout).dep
349local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
350local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
351local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
352
353# default path + source dep.
354ifneq ($(defpath),)
355local deps := $(abspathex $(deps) $(source),$($(target)_PATH))
356local incs := $(abspathex $(incs),$($(target)_PATH))
357else
358local deps += $(source)
359endif
360
361# call the tool
362ifndef TOOL_$(tool)_UIC_UI_CMDS
363 $(error kBuild: qt uic tool not found: TOOL_$(tool)_UIC_UI_CMDS)
364endif
365local cmds := $(TOOL_$(tool)_UIC_UI_CMDS)
366local more_output := $(TOOL_$(tool)_UIC_UI_OUTPUT)
367local maybe_output := $(TOOL_$(tool)_UIC_UI_OUTPUT_MAYBE)
368local deps += $(TOOL_$(tool)_UIC_UI_DEPEND)
369local orderdeps += $(TOOL_$(tool)_UIC_UI_DEPORD)
370
371# generate the link rule and update some source and target variables.
372ifndef NO_COMPILE_CMDS_DEPS
373 $(eval includedep $(dep))
374endif
375$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
376
377endef # def_unit_qt4_src_handler_ui
378
379
380## wrapper for the MOC command dependencies.
381ifndef NO_COMPILE_CMDS_DEPS
382 _UNIT_QT_MOC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT_MOC_CMDS_PREV_),$$(commands $(out)),FORCE)
383else
384 _UNIT_QT_MOC_CMDS_DEP =
385endif
386
387##
388# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
389#
390# This is necessary to resolve reference to local variables before doing
391# assignments and setting up commands. They would otherwise be resolved
392# later in a different context and the result would be completely wrong.
393#
394define def_unit_qt4_target_pre_handle_moc_hdr_dx
395
396$(out) +| $(realout) $(more_output) $(maybe_output): \
397 $(deps) \
398 $(value _UNIT_QT_MOC_CMDS_DEP) \
399 | \
400 $(orderdeps)
401 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
402 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
403
404$(cmds)
405
406 $(QUIET)$(CP) --changed -f $(out) $(realout)
407ifndef NO_COMPILE_CMDS_DEPS
408 %$$(QUIET2)$$(APPEND) '$(dep)'
409 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT_MOC_CMDS_PREV_'
410 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
411 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
412endif
413
414$(target)_INTERMEDIATES += $(realout)
415$(target)_GEN_SOURCES_ += $(realout)
416$(target)_OUT_FILES += $(out) $(realout) $(more_output) $(maybe_output)
417
418endef
419
420##
421# Handle a source file listed in QT_MOCSRCS.
422#
423# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
424# a .moc file that we're expected to generate here.
425#
426# @remarks Invoked via $(evalvalctx ).
427define def_unit_qt4_target_pre_handle_moc_hdr
428local type := MOC
429
430# fetch the properties.
431local tool := $(kb-src-tool dummy_var)
432local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
433local out := $(outbase).tmp.cpp
434local realout := $(outbase).cpp
435local dep := $(realout).dep
436local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
437local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
438local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
439local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
440local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
441
442# default path + source dep.
443ifneq ($(defpath),)
444local deps := $(abspathex $(deps) $(source),$($(target)_PATH))
445local incs := $(abspathex $(incs),$($(target)_PATH))
446else
447local deps += $(source)
448endif
449
450# call the tool
451ifndef TOOL_$(tool)_MOC_HPP_CMDS
452 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_HPP_CMDS)
453endif
454local cmds := $(TOOL_$(tool)_MOC_HPP_CMDS)
455local more_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT)
456local maybe_output := $(TOOL_$(tool)_MOC_HPP_OUTPUT_MAYBE)
457local deps += $(TOOL_$(tool)_MOC_HPP_DEPEND)
458local orderdeps += $(TOOL_$(tool)_MOC_HPP_DEPORD)
459
460# generate the link rule and update some source and target variables.
461ifndef NO_COMPILE_CMDS_DEPS
462 $(eval includedep $(dep))
463endif
464$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
465
466endef # def_unit_qt4_target_pre_handle_moc_hdr
467
468
469##
470# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
471#
472# This is necessary to resolve reference to local variables before doing
473# assignments and setting up commands. They would otherwise be resolved
474# later in a different context and the result would be completely wrong.
475#
476define def_unit_qt4_target_pre_handle_moc_src_dx
477
478$(out) +| $(realout) $(more_output) $(maybe_output): \
479 $(deps) \
480 $(value _UNIT_QT_MOC_CMDS_DEP) \
481 | \
482 $(orderdeps)
483 %$$(call MSG_TOOL,moc,$(target),$(source),$$@)
484 $(QUIET2)$(RM) -f $(out) $(more_output) $(maybe_output) $(dep)
485
486$(cmds)
487
488 $(QUIET)$(CP) --changed -f $(out) $(realout)
489ifndef NO_COMPILE_CMDS_DEPS
490 %$$(QUIET2)$$(APPEND) '$(dep)'
491 %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT_MOC_CMDS_PREV_'
492 %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
493 %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
494endif
495
496$(target)_INTERMEDIATES += $(realout)
497$(target)_OUT_FILES += $(out) $(realout) $(more_output) $(maybe_output)
498
499endef
500
501##
502# Handle a source file listed in QT_MOCSRCS.
503#
504# The files listed in QT_MOCSRCS uses the Q_OBJECT macro and will include
505# a .moc file that we're expected to generate here.
506#
507# @remarks Invoked via $(evalvalctx ).
508define def_unit_qt4_target_pre_handle_moc_src
509local type := MOC
510
511# fetch the properties.
512local tool := $(kb-src-tool dummy_var)
513local outbase := $(qtmocdir)/$(notdir $(basename $(source)))
514local out := $(outbase).tmp.moc
515local realout := $(outbase).moc
516local dep := $(realout).dep
517local defs := $(kb-src-prop DEFS,dummy_var,left-to-right)
518local incs := $(kb-src-prop INCS,dummy_var,right-to-left)
519local flags := $(kb-src-prop FLAGS,dummy_var,right-to-left)
520local deps := $(kb-src-prop DEPS,dummy_var,left-to-right)
521local orderdeps := $(call DIRDEP,$(dir $(outbase))) $(kb-src-prop ORDERDEPS,dummy_var,left-to-right)
522
523# default path + source dep.
524ifneq ($(defpath),)
525local deps := $(abspathex $(deps) $(source),$($(target)_PATH))
526local incs := $(abspathex $(incs),$($(target)_PATH))
527else
528local deps += $(source)
529endif
530
531# call the tool
532ifndef TOOL_$(tool)_MOC_CPP_CMDS
533 $(error kBuild: qt moc tool not found: TOOL_$(tool)_MOC_CPP_CMDS)
534endif
535local cmds := $(TOOL_$(tool)_MOC_CPP_CMDS)
536local more_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT)
537local maybe_output := $(TOOL_$(tool)_MOC_CPP_OUTPUT_MAYBE)
538local deps += $(TOOL_$(tool)_MOC_CPP_DEPEND)
539local orderdeps += $(TOOL_$(tool)_MOC_CPP_DEPORD)
540
541# generate the link rule and update some source and target variables.
542ifndef NO_COMPILE_CMDS_DEPS
543 $(eval includedep $(dep))
544endif
545$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
546
547endef # def_unit_qt4_target_pre_handle_moc_src
548
549
550##
551# Adds sources containing Q_OBJECT to QT_MOCSRCS.
552define def_unit_qt4_target_pre_cpp_source
553ifneq ($(file-size $(source)),-1)
554 ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
555 $(eval $(target)_QT_MOCSRCS += $(source))
556 endif
557endif
558endef # def_unit_qt4_target_pre_cpp_source
559
560##
561# Invoked early in the processing of a target that uses the Qt unit.
562#
563# It will append the qt source handlers to the target (.h, .ui, .ts,
564# .png, .bmp, .gif).
565#
566# It will then check all the C++ sources and check which needs
567# a .moc files and generate rules and dependencies fofor these
568#
569define def_unit_qt4_target_pre
570
571# Autodetect source files with Q_OBJECT references if QT_MOCSRCS is undefined. (slow)
572# Tip: Use target_QT_MOCSRCS = $(NO_SUCH_VARIABLE) to avoid this.
573ifndef $(target)_QT_MOCSRCS
574 $(foreach source, $(filter %.cxx %.CXX %.cpp %.CPP %.cc %.CC,\
575 $($(target)_SOURCES.$(_bld_trg)) \
576 $($(target)_SOURCES.$(_bld_trg_arch)) \
577 $($(target)_SOURCES.$(_bld_trg).$(_bld_trg_arch)) \
578 $($(target)_SOURCES.$(_bld_trg_cpu)) \
579 $($(target)_SOURCES.$(_bld_type)) \
580 $($(target)_SOURCES) \
581 ), $(evalval def_unit_qt4_target_pre_cpp_source))
582endif
583
584# Install source handlers for .ui files.
585$(target)_SRC_HANDLERS += \
586 .ui:def_unit_qt4_src_handler_ui \
587 .UI:def_unit_qt4_src_handler_ui \
588 .qrc:def_unit_qt4_src_handler_qrc \
589 .qrc:def_unit_qt4_src_handler_qrc \
590 .ts:def_unit_qt4_src_handler_ts \
591 .TS:def_unit_qt4_src_handler_ts
592
593# Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
594local qtmocdir := $(PATH_$(target))/qtmoc
595local qtuicdir := $(PATH_$(target))/qtuic
596local qtrccdir := $(PATH_$(target))/qtrcc
597$(eval $(target)_BLDDIRS += $(qtmocdir) $(qtuicdir) $(qtrccdir))
598$(eval $(target)_INCS += $(qtmocdir) $(qtuicdir) $(qtrccdir))
599
600# Deal with QT_MOCSRCS.
601$(foreach source, \
602 $($(target)_QT_MOCSRCS.$(_bld_trg)) \
603 $($(target)_QT_MOCSRCS.$(_bld_trg_arch)) \
604 $($(target)_QT_MOCSRCS.$(_bld_trg).$(_bld_trg_arch)) \
605 $($(target)_QT_MOCSRCS.$(_bld_trg_cpu)) \
606 $($(target)_QT_MOCSRCS.$(_bld_type)) \
607 $($(target)_QT_MOCSRCS) \
608 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
609
610# Deal with QT_MOCHDRS.
611$(foreach source, \
612 $($(target)_QT_MOCHDRS.$(_bld_trg)) \
613 $($(target)_QT_MOCHDRS.$(_bld_trg_arch)) \
614 $($(target)_QT_MOCHDRS.$(_bld_trg).$(_bld_trg_arch)) \
615 $($(target)_QT_MOCHDRS.$(_bld_trg_cpu)) \
616 $($(target)_QT_MOCHDRS.$(_bld_type)) \
617 $($(target)_QT_MOCHDRS) \
618 , $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
619
620endef # def_unit_qt4_target_pre
621
Note: See TracBrowser for help on using the repository browser.