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