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