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