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