| 1 | # $Id: header.kmk 1782 2008-09-12 22:39:39Z bird $ | 
|---|
| 2 | ## @file | 
|---|
| 3 | # kBuild - File included at top of a makefile. | 
|---|
| 4 | # | 
|---|
| 5 |  | 
|---|
| 6 | # | 
|---|
| 7 | # Copyright (c) 2004-2008 knut st. osmundsen <bird-kBuild-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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 | ifndef __header_kmk__ | 
|---|
| 35 | # start-of-file-content | 
|---|
| 36 | ifdef KBUILD_PROFILE_SELF | 
|---|
| 37 | _KBUILD_TS_HEADER_START := $(nanots ) # just a dummy warm up query | 
|---|
| 38 | $(info prof: since start - since previous - event description) | 
|---|
| 39 | $(info stat: $(make-stats )) | 
|---|
| 40 | _KBUILD_TS_HEADER_START := $(nanots ) | 
|---|
| 41 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_START) | 
|---|
| 42 | endif | 
|---|
| 43 |  | 
|---|
| 44 |  | 
|---|
| 45 | # | 
|---|
| 46 | # Check make version before we do anything else. | 
|---|
| 47 | # | 
|---|
| 48 | ifndef KMK_VERSION | 
|---|
| 49 | $(error kBuild: The kmk default variable KMK_VERSION isn't defined! Make sure you are using 'kmk' and not 'make', 'gmake', 'kmk_gmake', 'dmake' or any other make program) | 
|---|
| 50 | endif | 
|---|
| 51 | ifneq ($(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR),0.1) | 
|---|
| 52 | ifneq ($(KBUILD_VERSION_MAJOR),0) | 
|---|
| 53 | $(warning kBuild: kmk major version mismatch! Expected '0' but found '$(KBUILD_VERSION_MAJOR)'!) | 
|---|
| 54 | else | 
|---|
| 55 | $(warning kBuild: kmk minor version mismatch! Expected '1' but found '$(KBUILD_VERSION_MINOR)'!) | 
|---|
| 56 | endif | 
|---|
| 57 | else | 
|---|
| 58 | ifneq ($(int-ge $(KBUILD_VERSION_PATCH),4),1) | 
|---|
| 59 | $(warning kBuild: kmk version mismatch! Expected 0.1.4 or later. Actual version is $(KBUILD_VERSION_MAJOR).$(KBUILD_VERSION_MINOR).$(KBUILD_VERSION_PATCH).) | 
|---|
| 60 | endif | 
|---|
| 61 | endif | 
|---|
| 62 |  | 
|---|
| 63 | # | 
|---|
| 64 | # The revision in which this file was last modified. | 
|---|
| 65 | # This can be useful when using development versions of kBuild. | 
|---|
| 66 | # | 
|---|
| 67 | KMK_REVISION := $(patsubst %:,,  $Rev: 1782 $  ) | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | # | 
|---|
| 71 | # Define the default goal. | 
|---|
| 72 | # | 
|---|
| 73 | .PHONY: all all_recursive | 
|---|
| 74 | all: all_recursive | 
|---|
| 75 |  | 
|---|
| 76 | # | 
|---|
| 77 | # The phony FORCE target. | 
|---|
| 78 | # | 
|---|
| 79 | .PHONY: FORCE | 
|---|
| 80 | FORCE: | 
|---|
| 81 |  | 
|---|
| 82 |  | 
|---|
| 83 | # | 
|---|
| 84 | # Enable delete on error and second expansion of prerequisites and targets. | 
|---|
| 85 | # | 
|---|
| 86 | .DELETE_ON_ERROR: | 
|---|
| 87 |  | 
|---|
| 88 | .SECONDEXPANSION: | 
|---|
| 89 |  | 
|---|
| 90 | .SECONDTARGETEXPANSION: | 
|---|
| 91 |  | 
|---|
| 92 |  | 
|---|
| 93 | # | 
|---|
| 94 | # General purpose macros. | 
|---|
| 95 | # | 
|---|
| 96 |  | 
|---|
| 97 | ## | 
|---|
| 98 | # Newline character(s). | 
|---|
| 99 | define NL | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|
| 102 | endef | 
|---|
| 103 |  | 
|---|
| 104 | ## | 
|---|
| 105 | # Tab character. | 
|---|
| 106 | TAB := $(subst .,       ,.) | 
|---|
| 107 |  | 
|---|
| 108 | ## | 
|---|
| 109 | # Newline + tab characters (for generating commands). | 
|---|
| 110 | NLTAB = $(NL)$(TAB) | 
|---|
| 111 |  | 
|---|
| 112 | ## | 
|---|
| 113 | # Space character. | 
|---|
| 114 | SP := $(subst ., ,.) | 
|---|
| 115 |  | 
|---|
| 116 | ## | 
|---|
| 117 | # Hash character. | 
|---|
| 118 | define HASH | 
|---|
| 119 | # | 
|---|
| 120 | endef | 
|---|
| 121 |  | 
|---|
| 122 | ## | 
|---|
| 123 | # Colon character. | 
|---|
| 124 | COLON := : | 
|---|
| 125 |  | 
|---|
| 126 | ## | 
|---|
| 127 | # Semicolon character. | 
|---|
| 128 | SEMICOLON := ; | 
|---|
| 129 |  | 
|---|
| 130 | ## | 
|---|
| 131 | # Comma character. | 
|---|
| 132 | COMMA := , | 
|---|
| 133 |  | 
|---|
| 134 | ## | 
|---|
| 135 | # Dot character. | 
|---|
| 136 | DOT := . | 
|---|
| 137 |  | 
|---|
| 138 | ## | 
|---|
| 139 | # Dollar character. | 
|---|
| 140 | DOLLAR := $$ | 
|---|
| 141 |  | 
|---|
| 142 | ## | 
|---|
| 143 | # Equal character. | 
|---|
| 144 | EQUAL := = | 
|---|
| 145 |  | 
|---|
| 146 |  | 
|---|
| 147 | # | 
|---|
| 148 | # The list of standard build types in kBuild. | 
|---|
| 149 | # | 
|---|
| 150 | # This list can be extended in Config.kmk and it's possible to extend | 
|---|
| 151 | # (inherit) another build type. | 
|---|
| 152 | # | 
|---|
| 153 | KBUILD_BLD_TYPES := release profile debug | 
|---|
| 154 |  | 
|---|
| 155 |  | 
|---|
| 156 | # | 
|---|
| 157 | # The OSes, Architectures and CPUs that kBuild recognizes. | 
|---|
| 158 | # | 
|---|
| 159 | # When kBuild is ported to a new OS or architecture a unique keyword needs | 
|---|
| 160 | # to be assigned to it and added here. This strictness is required because | 
|---|
| 161 | # this keyword namespace is shared between OSes, architectures, cpus and | 
|---|
| 162 | # build types. (PORTME) | 
|---|
| 163 | # | 
|---|
| 164 | KBUILD_OSES   := darwin dragonfly freebsd l4 linux netbsd nt openbsd os2 solaris win | 
|---|
| 165 | KBUILD_ARCHES := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha | 
|---|
| 166 |  | 
|---|
| 167 |  | 
|---|
| 168 | # | 
|---|
| 169 | # Set default build type. | 
|---|
| 170 | # | 
|---|
| 171 | ifndef KBUILD_TYPE | 
|---|
| 172 | ifdef BUILD_TYPE | 
|---|
| 173 | KBUILD_TYPE := $(BUILD_TYPE) | 
|---|
| 174 | endif | 
|---|
| 175 | else ifdef BUILD_TYPE | 
|---|
| 176 | ifneq ($(KBUILD_TYPE),$(BUILD_TYPE)) | 
|---|
| 177 | ifeq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),environment:command line) | 
|---|
| 178 | KBUILD_TYPE := $(BUILD_TYPE) | 
|---|
| 179 | else ifneq ($(origin KBUILD_TYPE):$(origin BUILD_TYPE),command line:environment) | 
|---|
| 180 | $(error kBuild: KBUILD_TYPE and BUILD_TYPE disagree.) | 
|---|
| 181 | endif | 
|---|
| 182 | endif | 
|---|
| 183 | endif | 
|---|
| 184 | override BUILD_TYPE = $(KBUILD_TYPE) | 
|---|
| 185 |  | 
|---|
| 186 | ifndef KBUILD_TYPE | 
|---|
| 187 | KBUILD_TYPE := release | 
|---|
| 188 | else | 
|---|
| 189 | if1of ($(KBUILD_TYPE), $(KBUILD_OSES) $(KBUILD_ARCHES)) | 
|---|
| 190 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' is an OS or architecture!) | 
|---|
| 191 | endif | 
|---|
| 192 | ifneq (.$(words $(KBUILD_TYPE)).$(KBUILD_TYPE).,.1.$(strip $(KBUILD_TYPE)).) | 
|---|
| 193 | $(error kBuild: The KBUILD_TYPE value '$(KBUILD_TYPE)' contains spaces/tabs!) | 
|---|
| 194 | endif | 
|---|
| 195 | endif | 
|---|
| 196 |  | 
|---|
| 197 |  | 
|---|
| 198 | # | 
|---|
| 199 | # Host platform legacy | 
|---|
| 200 | # kmk deals with this, so this is only temporary until I've rebuilt everything. | 
|---|
| 201 | # | 
|---|
| 202 | ifndef KBUILD_HOST | 
|---|
| 203 | KBUILD_HOST := $(BUILD_PLATFORM) | 
|---|
| 204 | endif | 
|---|
| 205 | ifndef KBUILD_HOST_ARCH | 
|---|
| 206 | KBUILD_HOST_ARCH := $(BUILD_PLATFORM_ARCH) | 
|---|
| 207 | endif | 
|---|
| 208 | ifndef KBUILD_HOST_CPU | 
|---|
| 209 | KBUILD_HOST_CPU := $(BUILD_PLATFORM_CPU) | 
|---|
| 210 | endif | 
|---|
| 211 |  | 
|---|
| 212 |  | 
|---|
| 213 | # | 
|---|
| 214 | # Assert valid build platform variables. | 
|---|
| 215 | # | 
|---|
| 216 | # All these are set by kmk so they shouldn't be any trouble | 
|---|
| 217 | # unless the user starts messing about with environment variables. | 
|---|
| 218 | # | 
|---|
| 219 | ifneq (.$(words $(KBUILD_HOST)).$(KBUILD_HOST).,.1.$(strip $(KBUILD_HOST)).) | 
|---|
| 220 | $(error kBuild: The KBUILD_HOST value '$(KBUILD_HOST)' contains spaces/tabs!) | 
|---|
| 221 | endif | 
|---|
| 222 | ifneq ($(words $(filter $(KBUILD_HOST),$(KBUILD_OSES))),1) | 
|---|
| 223 | $(error kBuild: KBUILD_HOST value '$(KBUILD_HOST)' is not recognized (valid: $(KBUILD_OSES))) | 
|---|
| 224 | endif | 
|---|
| 225 |  | 
|---|
| 226 | ifneq (.$(words $(KBUILD_HOST_ARCH)).$(KBUILD_HOST_ARCH).,.1.$(strip $(KBUILD_HOST_ARCH)).) | 
|---|
| 227 | $(error kBuild: The KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' contains spaces/tabs!) | 
|---|
| 228 | endif | 
|---|
| 229 | ifneq ($(words $(filter $(KBUILD_HOST_ARCH),$(KBUILD_ARCHES))),1) | 
|---|
| 230 | $(error kBuild: KBUILD_HOST_ARCH value '$(KBUILD_HOST_ARCH)' is not recognized (valid: $(KBUILD_ARCHES))) | 
|---|
| 231 | endif | 
|---|
| 232 |  | 
|---|
| 233 | ifeq ($(strip $(KBUILD_HOST_CPU)),) | 
|---|
| 234 | KBUILD_HOST_CPU := blend | 
|---|
| 235 | else | 
|---|
| 236 | ifneq (.$(words $(KBUILD_HOST_CPU)).$(KBUILD_HOST_CPU).,.1.$(strip $(KBUILD_HOST_CPU)).) | 
|---|
| 237 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' contains spaces/tabs!) | 
|---|
| 238 | endif | 
|---|
| 239 | if1of ($(KBUILD_HOST_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)) | 
|---|
| 240 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' was found in the OS or architecture keywords!) | 
|---|
| 241 | endif | 
|---|
| 242 | ifeq ($(KBUILD_HOST_CPU),$(KBUILD_TYPE)) | 
|---|
| 243 | $(error kBuild: The KBUILD_HOST_CPU value '$(KBUILD_HOST_CPU)' is the same as the KBUILD_TYPE!) | 
|---|
| 244 | endif | 
|---|
| 245 | endif | 
|---|
| 246 |  | 
|---|
| 247 |  | 
|---|
| 248 | # | 
|---|
| 249 | # Deal with target platform legacy. | 
|---|
| 250 | # | 
|---|
| 251 | ifndef KBUILD_TARGET | 
|---|
| 252 | ifdef BUILD_TARGET | 
|---|
| 253 | KBUILD_TARGET := $(BUILD_TARGET) | 
|---|
| 254 | endif | 
|---|
| 255 | else ifdef BUILD_TARGET | 
|---|
| 256 | ifneq ($(KBUILD_TARGET),$(BUILD_TARGET)) | 
|---|
| 257 | ifeq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),environment:command line) | 
|---|
| 258 | KBUILD_TARGET := $(BUILD_TARGET) | 
|---|
| 259 | else ifneq ($(origin KBUILD_TARGET):$(origin BUILD_TARGET),command line:environment) | 
|---|
| 260 | $(error kBuild: KBUILD_TARGET and BUILD_TARGET disagree) | 
|---|
| 261 | endif | 
|---|
| 262 | endif | 
|---|
| 263 | endif | 
|---|
| 264 | override BUILD_TARGET = $(KBUILD_TARGET) | 
|---|
| 265 |  | 
|---|
| 266 | ifndef KBUILD_TARGET_ARCH | 
|---|
| 267 | ifdef BUILD_TARGET_ARCH | 
|---|
| 268 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH) | 
|---|
| 269 | endif | 
|---|
| 270 | else ifdef BUILD_TARGET_ARCH | 
|---|
| 271 | ifneq ($(KBUILD_TARGET_ARCH),$(BUILD_TARGET_ARCH)) | 
|---|
| 272 | ifeq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),environment:command line) | 
|---|
| 273 | KBUILD_TARGET_ARCH := $(BUILD_TARGET_ARCH) | 
|---|
| 274 | else ifneq ($(origin KBUILD_TARGET_ARCH):$(origin BUILD_TARGET_ARCH),command line:environment) | 
|---|
| 275 | $(error kBuild: KBUILD_TARGET_ARCH and BUILD_TARGET_ARCH disagree) | 
|---|
| 276 | endif | 
|---|
| 277 | endif | 
|---|
| 278 | endif | 
|---|
| 279 | override BUILD_TARGET_ARCH = $(KBUILD_TARGET_ARCH) | 
|---|
| 280 |  | 
|---|
| 281 | ifndef KBUILD_TARGET_CPU | 
|---|
| 282 | ifdef BUILD_TARGET_CPU | 
|---|
| 283 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU) | 
|---|
| 284 | endif | 
|---|
| 285 | else ifdef BUILD_TARGET_CPU | 
|---|
| 286 | ifneq ($(KBUILD_TARGET_CPU),$(BUILD_TARGET_CPU)) | 
|---|
| 287 | ifeq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),environment:command line) | 
|---|
| 288 | KBUILD_TARGET_CPU := $(BUILD_TARGET_CPU) | 
|---|
| 289 | else ifneq ($(origin KBUILD_TARGET_CPU):$(origin BUILD_TARGET_CPU),command line:environment) | 
|---|
| 290 | $(error kBuild: KBUILD_TARGET_CPU and BUILD_TARGET_CPU disagree) | 
|---|
| 291 | endif | 
|---|
| 292 | endif | 
|---|
| 293 | endif | 
|---|
| 294 | override BUILD_TARGET_CPU = $(KBUILD_TARGET_CPU) | 
|---|
| 295 |  | 
|---|
| 296 |  | 
|---|
| 297 | # | 
|---|
| 298 | # Assert or set default target platform. | 
|---|
| 299 | # When not defined use the corresponding KBUILD_HOST value. | 
|---|
| 300 | # | 
|---|
| 301 | ifndef KBUILD_TARGET | 
|---|
| 302 | KBUILD_TARGET := $(KBUILD_HOST) | 
|---|
| 303 | else | 
|---|
| 304 | ifneq (.$(words $(KBUILD_TARGET)).$(KBUILD_TARGET).,.1.$(strip $(KBUILD_TARGET)).) | 
|---|
| 305 | $(error kBuild: The KBUILD_TARGET value '$(KBUILD_TARGET)' contains spaces/tabs!) | 
|---|
| 306 | endif | 
|---|
| 307 | ifneq ($(words $(filter $(KBUILD_TARGET),$(KBUILD_OSES))),1) | 
|---|
| 308 | $(error kBuild: KBUILD_TARGET value '$(KBUILD_TARGET)' is not recognized (valid: $(KBUILD_OSES))) | 
|---|
| 309 | endif | 
|---|
| 310 | endif | 
|---|
| 311 |  | 
|---|
| 312 | ifndef KBUILD_TARGET_ARCH | 
|---|
| 313 | KBUILD_TARGET_ARCH := $(KBUILD_HOST_ARCH) | 
|---|
| 314 | else | 
|---|
| 315 | ifneq (.$(words $(KBUILD_TARGET_ARCH)).$(KBUILD_TARGET_ARCH).,.1.$(strip $(KBUILD_TARGET_ARCH)).) | 
|---|
| 316 | $(error kBuild: The KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' contains spaces/tabs!) | 
|---|
| 317 | endif | 
|---|
| 318 | ifneq ($(words $(filter $(KBUILD_TARGET_ARCH),$(KBUILD_ARCHES))),1) | 
|---|
| 319 | $(error kBuild: KBUILD_TARGET_ARCH value '$(KBUILD_TARGET_ARCH)' is not recognized (valid: $(KBUILD_ARCHES))) | 
|---|
| 320 | endif | 
|---|
| 321 | endif | 
|---|
| 322 |  | 
|---|
| 323 | ifndef KBUILD_TARGET_CPU | 
|---|
| 324 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU) | 
|---|
| 325 | else ifeq ($(strip $(KBUILD_TARGET_CPU)),) | 
|---|
| 326 | ifeq ($(KBUILD_TARGET_ARCH),$(KBUILD_HOST_ARCH)) | 
|---|
| 327 | KBUILD_TARGET_CPU := $(KBUILD_HOST_CPU) | 
|---|
| 328 | else | 
|---|
| 329 | KBUILD_TARGET_CPU := blend | 
|---|
| 330 | endif | 
|---|
| 331 | else | 
|---|
| 332 | ifneq (.$(words $(KBUILD_TARGET_CPU)).$(KBUILD_TARGET_CPU).,.1.$(strip $(KBUILD_TARGET_CPU)).) | 
|---|
| 333 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' contains spaces/tabs!) | 
|---|
| 334 | endif | 
|---|
| 335 | if1of ($(KBUILD_TARGET_CPU), $(KBUILD_OSES) $(BUILD_ARCHES)) | 
|---|
| 336 | $(error kBuild: The KBUILD_TARGET_CPU value was found in the OS or architecture keywords!) | 
|---|
| 337 | endif | 
|---|
| 338 | ifeq ($(KBUILD_TARGET_CPU),$(KBUILD_TYPE)) | 
|---|
| 339 | $(error kBuild: The KBUILD_TARGET_CPU value '$(KBUILD_TARGET_CPU)' is the same as the KBUILD_TYPE!) | 
|---|
| 340 | endif | 
|---|
| 341 | endif | 
|---|
| 342 |  | 
|---|
| 343 |  | 
|---|
| 344 | # | 
|---|
| 345 | # Paths and stuff. | 
|---|
| 346 | # | 
|---|
| 347 |  | 
|---|
| 348 | # Adjust DEPTH first. | 
|---|
| 349 | DEPTH := $(strip $(DEPTH)) | 
|---|
| 350 | ifeq ($(DEPTH),) | 
|---|
| 351 | DEPTH := . | 
|---|
| 352 | endif | 
|---|
| 353 |  | 
|---|
| 354 | ## PATH_CURRENT is the current directory (getcwd). | 
|---|
| 355 | PATH_CURRENT        := $(abspath $(CURDIR)) | 
|---|
| 356 | ## PATH_SUB_CURRENT points to current directory of the current makefile. | 
|---|
| 357 | # Meaning that it will change value as we enter and exit sub-makefiles. | 
|---|
| 358 | PATH_SUB_CURRENT    := $(PATH_CURRENT) | 
|---|
| 359 | ## PATH_ROOT points to the project root directory. | 
|---|
| 360 | PATH_ROOT           := $(abspath $(PATH_CURRENT)/$(DEPTH)) | 
|---|
| 361 | ## PATH_SUB_ROOT points to the directory of the top-level makefile. | 
|---|
| 362 | ifneq ($(strip $(SUB_DEPTH)),) | 
|---|
| 363 | SUB_DEPTH          := $(strip $(SUB_DEPTH)) | 
|---|
| 364 | PATH_SUB_ROOT      := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH)) | 
|---|
| 365 | else | 
|---|
| 366 | PATH_SUB_ROOT      := $(PATH_CURRENT) | 
|---|
| 367 | endif | 
|---|
| 368 |  | 
|---|
| 369 | ## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT. | 
|---|
| 370 | # This variable is used to determin where the object files and other output goes. | 
|---|
| 371 | ifneq ($(PATH_ROOT),$(PATH_SUB_ROOT)) | 
|---|
| 372 | CURSUBDIR          := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT)) | 
|---|
| 373 | else | 
|---|
| 374 | CURSUBDIR          := . | 
|---|
| 375 | endif | 
|---|
| 376 |  | 
|---|
| 377 | # Output directories. | 
|---|
| 378 | ifndef PATH_OUT_BASE | 
|---|
| 379 | PATH_OUT_BASE      := $(PATH_ROOT)/out | 
|---|
| 380 | endif | 
|---|
| 381 | ifndef PATH_OUT | 
|---|
| 382 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places - obsolete) | 
|---|
| 383 | PATH_OUT           = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(KBUILD_TYPE) | 
|---|
| 384 | else | 
|---|
| 385 | PATH_OUT           = $(PATH_OUT_BASE)/$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)/$(KBUILD_TYPE) | 
|---|
| 386 | endif | 
|---|
| 387 | endif # !define PATH_OUT | 
|---|
| 388 | PATH_OBJCACHE        = $(PATH_OUT_BASE)/kObjCache | 
|---|
| 389 | PATH_OBJ             = $(PATH_OUT)/obj | 
|---|
| 390 | PATH_TARGET          = $(PATH_OBJ)/$(CURSUBDIR) | 
|---|
| 391 | PATH_INS             = $(PATH_OUT) | 
|---|
| 392 | PATH_BIN             = $(PATH_INS)/bin | 
|---|
| 393 | PATH_DLL             = $(PATH_INS)/bin | 
|---|
| 394 | PATH_SYS             = $(PATH_INS)/bin | 
|---|
| 395 | PATH_LIB             = $(PATH_INS)/lib | 
|---|
| 396 | PATH_DOC             = $(PATH_INS)/doc | 
|---|
| 397 |  | 
|---|
| 398 | # KBUILD_PATH / PATH_KBUILD is determined by kmk. | 
|---|
| 399 | ifndef KBUILD_PATH | 
|---|
| 400 | KBUILD_PATH := $(PATH_KBUILD) | 
|---|
| 401 | endif | 
|---|
| 402 | ifeq ($(strip $(KBUILD_PATH)),) | 
|---|
| 403 | $(error kBuild: KBUILD_PATH is missing or empty! kmk is supposed to set it.) | 
|---|
| 404 | endif | 
|---|
| 405 | # KBUILD_BIN_PATH / PATH_KBUILD_BIN is determined by kmk. | 
|---|
| 406 | ifndef KBUILD_BIN_PATH | 
|---|
| 407 | KBUILD_BIN_PATH := $(PATH_KBUILD_BIN) | 
|---|
| 408 | endif | 
|---|
| 409 | ifeq ($(strip $(KBUILD_BIN_PATH)),) | 
|---|
| 410 | $(error kBuild: KBUILD_BIN_PATH is missing or empty! kmk is supposed to set it.) | 
|---|
| 411 | endif | 
|---|
| 412 |  | 
|---|
| 413 | # kBuild files which might be of interest. | 
|---|
| 414 | FILE_KBUILD_HEADER := $(KBUILD_PATH)/header.kmk | 
|---|
| 415 | #FILE_KBUILD_CONFIG := $(KBUILD_PATH)/config.kmk | 
|---|
| 416 | FILE_KBUILD_FOOTER := $(KBUILD_PATH)/footer.kmk | 
|---|
| 417 | FILE_KBUILD_SUB_HEADER := $(KBUILD_PATH)/subheader.kmk | 
|---|
| 418 | FILE_KBUILD_SUB_FOOTER := $(KBUILD_PATH)/subfooter.kmk | 
|---|
| 419 |  | 
|---|
| 420 | ## MAKEFILE is the name of the main makefile. | 
|---|
| 421 | MAKEFILE            := $(firstword $(MAKEFILE_LIST)) | 
|---|
| 422 | ## MAKEFILE_CURRENT is the name of the current makefile. | 
|---|
| 423 | # This is updated everything a sub-makefile is included. | 
|---|
| 424 | MAKEFILE_CURRENT    := $(MAKEFILE) | 
|---|
| 425 |  | 
|---|
| 426 |  | 
|---|
| 427 | ## @todo this should be done via SUFF_XYZ.target/host... | 
|---|
| 428 |  | 
|---|
| 429 | # | 
|---|
| 430 | # Build platform setup. | 
|---|
| 431 | # (PORTME) | 
|---|
| 432 | # | 
|---|
| 433 | if1of ($(KBUILD_HOST), win nt) | 
|---|
| 434 | # Win, Win32, Win64, NT. | 
|---|
| 435 | EXEC_X86_WIN32      := | 
|---|
| 436 | HOSTSUFF_EXE        := .exe | 
|---|
| 437 |  | 
|---|
| 438 | # OS/2. | 
|---|
| 439 | else ifeq ($(KBUILD_HOST),os2) | 
|---|
| 440 | EXEC_X86_WIN32      := innopec.exe | 
|---|
| 441 | HOSTSUFF_EXE        := .exe | 
|---|
| 442 |  | 
|---|
| 443 | else if1of ($(KBUILD_HOST), freebsd dragonfly linux openbsd netbsd) | 
|---|
| 444 | # Unix (like) systems with wine. | 
|---|
| 445 | EXEC_X86_WIN32      := wine | 
|---|
| 446 | HOSTSUFF_EXE        := | 
|---|
| 447 |  | 
|---|
| 448 | else | 
|---|
| 449 | # Unix (like) systems without wine. | 
|---|
| 450 | EXEC_X86_WIN32      := false | 
|---|
| 451 | HOSTSUFF_EXE        := | 
|---|
| 452 | endif | 
|---|
| 453 |  | 
|---|
| 454 |  | 
|---|
| 455 | # | 
|---|
| 456 | # Build target setup. | 
|---|
| 457 | # (PORTME) | 
|---|
| 458 | # | 
|---|
| 459 | SUFF_DEP    := .dep | 
|---|
| 460 | if1of ($(KBUILD_TARGET), win nt os2) | 
|---|
| 461 | SUFF_OBJ    := .obj | 
|---|
| 462 | SUFF_LIB    := .lib | 
|---|
| 463 | SUFF_DLL    := .dll | 
|---|
| 464 | SUFF_EXE    := .exe | 
|---|
| 465 | SUFF_SYS    := .sys | 
|---|
| 466 | SUFF_RES    := .res | 
|---|
| 467 | else ifeq ($(KBUILD_TARGET),l4) | 
|---|
| 468 | SUFF_OBJ    := .o | 
|---|
| 469 | SUFF_LIB    := .a | 
|---|
| 470 | SUFF_DLL    := .s.so | 
|---|
| 471 | SUFF_EXE    := | 
|---|
| 472 | SUFF_SYS    := .a | 
|---|
| 473 | SUFF_RES    := | 
|---|
| 474 | else ifeq ($(KBUILD_TARGET),darwin) | 
|---|
| 475 | SUFF_OBJ    := .o | 
|---|
| 476 | SUFF_LIB    := .a | 
|---|
| 477 | SUFF_DLL    := .dylib | 
|---|
| 478 | SUFF_EXE    := | 
|---|
| 479 | SUFF_SYS    := | 
|---|
| 480 | SUFF_RES    := | 
|---|
| 481 | else | 
|---|
| 482 | SUFF_OBJ    := .o | 
|---|
| 483 | SUFF_LIB    := .a | 
|---|
| 484 | SUFF_DLL    := .so | 
|---|
| 485 | SUFF_EXE    := | 
|---|
| 486 | if1of ($(KBUILD_TARGET), dragonfly freebsd linux netbsd openbsd) ## @todo check netbsd and openbsd. | 
|---|
| 487 | SUFF_SYS    := .ko | 
|---|
| 488 | else | 
|---|
| 489 | SUFF_SYS    := | 
|---|
| 490 | endif | 
|---|
| 491 | SUFF_RES    := | 
|---|
| 492 | endif | 
|---|
| 493 |  | 
|---|
| 494 | # | 
|---|
| 495 | # Standard kBuild tools. | 
|---|
| 496 | # | 
|---|
| 497 | ifeq ($(KMK),kmk) | 
|---|
| 498 | KMK         := $(KBUILD_BIN_PATH)/kmk$(HOSTSUFF_EXE) | 
|---|
| 499 | endif | 
|---|
| 500 | MAKE        := $(KMK) | 
|---|
| 501 |  | 
|---|
| 502 | GMAKE       := $(KBUILD_BIN_PATH)/kmk_gmake$(HOSTSUFF_EXE) | 
|---|
| 503 |  | 
|---|
| 504 | DEP_EXT     := $(KBUILD_BIN_PATH)/kDep$(HOSTSUFF_EXE) | 
|---|
| 505 | if1of (kDep, $(KMK_BUILTIN)) | 
|---|
| 506 | DEP         := kmk_builtin_kDep | 
|---|
| 507 | else | 
|---|
| 508 | DEP         := $(DEP_EXT) | 
|---|
| 509 | endif | 
|---|
| 510 |  | 
|---|
| 511 | DEP_IDB_EXT := $(KBUILD_BIN_PATH)/kDepIDB$(HOSTSUFF_EXE) | 
|---|
| 512 | if1of (kDepIDB, $(KMK_BUILTIN)) | 
|---|
| 513 | DEP_IDB     := kmk_builtin_kDepIDB | 
|---|
| 514 | else | 
|---|
| 515 | DEP_IDB     := $(DEP_IDB_EXT) | 
|---|
| 516 | endif | 
|---|
| 517 |  | 
|---|
| 518 | DEP_PRE_EXT := $(KBUILD_BIN_PATH)/kDepPre$(HOSTSUFF_EXE) | 
|---|
| 519 | if1of (kDepPre, $(KMK_BUILTIN)) | 
|---|
| 520 | DEP_PRE     := kmk_builtin_kDepPre | 
|---|
| 521 | else | 
|---|
| 522 | DEP_PRE     := $(DEP_PRE_EXT) | 
|---|
| 523 | endif | 
|---|
| 524 |  | 
|---|
| 525 | KOBJCACHE_EXT := $(KBUILD_BIN_PATH)/kObjCache$(HOSTSUFF_EXE) | 
|---|
| 526 | if1of (kObjCache, $(KMK_BUILTIN)) | 
|---|
| 527 | KOBJCACHE   := kmk_builtin_kObjCache | 
|---|
| 528 | else | 
|---|
| 529 | KOBJCACHE   := $(KOBJCACHE_EXT) | 
|---|
| 530 | endif | 
|---|
| 531 |  | 
|---|
| 532 | APPEND_EXT  := $(KBUILD_BIN_PATH)/kmk_append$(HOSTSUFF_EXE) | 
|---|
| 533 | APPEND      := kmk_builtin_append | 
|---|
| 534 |  | 
|---|
| 535 | CAT_EXT     := $(KBUILD_BIN_PATH)/kmk_cat$(HOSTSUFF_EXE) | 
|---|
| 536 | CAT         := kmk_builtin_cat | 
|---|
| 537 |  | 
|---|
| 538 | CHMOD_EXT   := $(KBUILD_BIN_PATH)/kmk_chmod$(HOSTSUFF_EXE) | 
|---|
| 539 | CHMOD       := kmk_builtin_chmod | 
|---|
| 540 |  | 
|---|
| 541 | CMP_EXT     := $(KBUILD_BIN_PATH)/kmk_cmp$(HOSTSUFF_EXE) | 
|---|
| 542 | CMP         := kmk_builtin_cmp | 
|---|
| 543 |  | 
|---|
| 544 | CP_EXT      := $(KBUILD_BIN_PATH)/kmk_cp$(HOSTSUFF_EXE) | 
|---|
| 545 | CP          := kmk_builtin_cp | 
|---|
| 546 |  | 
|---|
| 547 | ECHO_EXT    := $(KBUILD_BIN_PATH)/kmk_echo$(HOSTSUFF_EXE) | 
|---|
| 548 | ECHO        := kmk_builtin_echo | 
|---|
| 549 |  | 
|---|
| 550 | EXPR_EXT    := $(KBUILD_BIN_PATH)/kmk_expr$(HOSTSUFF_EXE) | 
|---|
| 551 | EXPR        := kmk_builtin_expr | 
|---|
| 552 |  | 
|---|
| 553 | INSTALL_EXT := $(KBUILD_BIN_PATH)/kmk_install$(HOSTSUFF_EXE) | 
|---|
| 554 | INSTALL     := kmk_builtin_install | 
|---|
| 555 |  | 
|---|
| 556 | LN_EXT      := $(KBUILD_BIN_PATH)/kmk_ln$(HOSTSUFF_EXE) | 
|---|
| 557 | LN          := kmk_builtin_ln | 
|---|
| 558 |  | 
|---|
| 559 | MD5SUM_EXT  := $(KBUILD_BIN_PATH)/kmk_md5sum$(HOSTSUFF_EXE) | 
|---|
| 560 | MD5SUM      := kmk_builtin_md5sum | 
|---|
| 561 |  | 
|---|
| 562 | MKDIR_EXT   := $(KBUILD_BIN_PATH)/kmk_mkdir$(HOSTSUFF_EXE) | 
|---|
| 563 | MKDIR       := kmk_builtin_mkdir | 
|---|
| 564 |  | 
|---|
| 565 | MV_EXT      := $(KBUILD_BIN_PATH)/kmk_mv$(HOSTSUFF_EXE) | 
|---|
| 566 | MV          := kmk_builtin_mv | 
|---|
| 567 |  | 
|---|
| 568 | PRINTF_EXT  := $(KBUILD_BIN_PATH)/kmk_printf$(HOSTSUFF_EXE) | 
|---|
| 569 | PRINTF      := kmk_builtin_printf | 
|---|
| 570 |  | 
|---|
| 571 | REDIRECT_EXT:= $(KBUILD_BIN_PATH)/kmk_redirect$(HOSTSUFF_EXE) | 
|---|
| 572 | if1of (redirect, $(KMK_BUILTIN)) | 
|---|
| 573 | REDIRECT    := kmk_builtin_redirect | 
|---|
| 574 | else | 
|---|
| 575 | REDIRECT    := $(REDIRECT_EXT) | 
|---|
| 576 | endif | 
|---|
| 577 |  | 
|---|
| 578 | RM_EXT      := $(KBUILD_BIN_PATH)/kmk_rm$(HOSTSUFF_EXE) | 
|---|
| 579 | RM          := kmk_builtin_rm | 
|---|
| 580 |  | 
|---|
| 581 | RMDIR_EXT   := $(KBUILD_BIN_PATH)/kmk_rmdir$(HOSTSUFF_EXE) | 
|---|
| 582 | RMDIR       := kmk_builtin_rmdir | 
|---|
| 583 |  | 
|---|
| 584 | SED_EXT     := $(KBUILD_BIN_PATH)/kmk_sed$(HOSTSUFF_EXE) | 
|---|
| 585 | if1of (sed, $(KMK_BUILTIN)) | 
|---|
| 586 | SED_INT     := kmk_builtin_sed | 
|---|
| 587 | else | 
|---|
| 588 | SED_INT     := $(SED_EXT) | 
|---|
| 589 | endif | 
|---|
| 590 | SED         := $(SED_EXT) | 
|---|
| 591 |  | 
|---|
| 592 | TEST_EXT    := $(KBUILD_BIN_PATH)/kmk_test$(HOSTSUFF_EXE) | 
|---|
| 593 | TEST        := kmk_builtin_test | 
|---|
| 594 |  | 
|---|
| 595 | # Our default shell is the Almquist shell from *BSD. | 
|---|
| 596 | ASH         := $(KBUILD_BIN_PATH)/kmk_ash$(HOSTSUFF_EXE) | 
|---|
| 597 | MAKESHELL   := $(ASH) | 
|---|
| 598 | SHELL       := $(ASH) | 
|---|
| 599 | export SHELL MAKESHELL | 
|---|
| 600 |  | 
|---|
| 601 | # Symlinking is problematic on some platforms... | 
|---|
| 602 | LN_SYMLINK  := $(LN) -s | 
|---|
| 603 |  | 
|---|
| 604 |  | 
|---|
| 605 | # | 
|---|
| 606 | # Some Functions. | 
|---|
| 607 | # The lower cased ones are either fallbacks or candidates for functions.c. | 
|---|
| 608 | # | 
|---|
| 609 |  | 
|---|
| 610 | ## ABSPATH - make paths absolute. | 
|---|
| 611 | # This implementation is clumsy and doesn't resolve '..' and '.' components. | 
|---|
| 612 | # | 
|---|
| 613 | # @param        $1      The paths to make absolute. | 
|---|
| 614 | # @obsolete Use the GNU make function $(abspath) directly now. | 
|---|
| 615 | ABSPATH = $(abspath $(1))$(warning ABSPATH is deprecated, use abspath directly!) | 
|---|
| 616 |  | 
|---|
| 617 | ## DIRDEP - make create directory dependencies. | 
|---|
| 618 | # | 
|---|
| 619 | # @param        $1      The paths to the directories which must be created. | 
|---|
| 620 | DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/) | 
|---|
| 621 |  | 
|---|
| 622 | ## Cygwin kludge. | 
|---|
| 623 | # This converts /cygdrive/x/% to x:%. | 
|---|
| 624 | # | 
|---|
| 625 | # @param        $1      The paths to make native. | 
|---|
| 626 | # @remark       This macro is pretty much obsolete since we don't use cygwin base make. | 
|---|
| 627 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR)) | 
|---|
| 628 | CYGPATHMIXED = $(foreach path,$(1)\ | 
|---|
| 629 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path))))) | 
|---|
| 630 | else | 
|---|
| 631 | CYGPATHMIXED = $(1) | 
|---|
| 632 | endif | 
|---|
| 633 |  | 
|---|
| 634 | ## Removes the drive letter from a path (if it has one) | 
|---|
| 635 | # @param        $1              the path | 
|---|
| 636 | no-drive    = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1))) | 
|---|
| 637 |  | 
|---|
| 638 | ## Removes the root slash from a path (if it has one) | 
|---|
| 639 | # @param        $1              the path | 
|---|
| 640 | no-root-slash = $(patsubst /%,%,$(1)) | 
|---|
| 641 |  | 
|---|
| 642 | ## Figure out where to put object files. | 
|---|
| 643 | # @param    $1      real target name. | 
|---|
| 644 | # @param    $2      normalized main target | 
|---|
| 645 | TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(1))) | 
|---|
| 646 |  | 
|---|
| 647 | ## Figure out where to put object files. | 
|---|
| 648 | # @param    $1      normalized main target | 
|---|
| 649 | TARGET_PATH = $(PATH_TARGET)/$(1) | 
|---|
| 650 |  | 
|---|
| 651 |  | 
|---|
| 652 | # | 
|---|
| 653 | # Initialize some of the globals which the Config.kmk and | 
|---|
| 654 | # others can add stuff to if they like for processing in the footer. | 
|---|
| 655 | # | 
|---|
| 656 |  | 
|---|
| 657 | ## KBUILD_TEMPLATE_PATHS | 
|---|
| 658 | # List a paths (separated by space) where templates can be found. | 
|---|
| 659 | KBUILD_TEMPLATE_PATHS := | 
|---|
| 660 |  | 
|---|
| 661 | ## KBUILD_TOOL_PATHS | 
|---|
| 662 | # List of paths (separated by space) where tools can be found. | 
|---|
| 663 | KBUILD_TOOL_PATHS := | 
|---|
| 664 |  | 
|---|
| 665 | ## KBUILD_SDK_PATHS | 
|---|
| 666 | # List of paths (separated by space) where SDKs can be found. | 
|---|
| 667 | KBUILD_SDK_PATHS := | 
|---|
| 668 |  | 
|---|
| 669 | ## KBUILD_UNIT_PATHS | 
|---|
| 670 | # List of paths (separated by space) where units (USES) can be found. | 
|---|
| 671 | KBUILD_UNIT_PATHS := | 
|---|
| 672 |  | 
|---|
| 673 | ## KBUILD_DEFAULT_PATHS | 
|---|
| 674 | # List of paths (separated by space) to search for stuff as a last resort. | 
|---|
| 675 | KBUILD_DEFAULT_PATHS := | 
|---|
| 676 |  | 
|---|
| 677 | ## Proritized list of the default makefile when walking subdirectories. | 
|---|
| 678 | # The user can overload this list. | 
|---|
| 679 | DEFAULT_MAKEFILE := Makefile.kmk makefile.kmk Makefile makefile | 
|---|
| 680 |  | 
|---|
| 681 | ## KBUILD_SRC_HANDLERS | 
|---|
| 682 | # The list of source handlers, pair of extension and handler. | 
|---|
| 683 | # The user can overload this list to provide additional or custom | 
|---|
| 684 | # handlers. On a per-target/template see SRC_HANDLERS. | 
|---|
| 685 | KBUILD_SRC_HANDLERS := \ | 
|---|
| 686 | .c:def_src_handler_c \ | 
|---|
| 687 | .C:def_src_handler_c \ | 
|---|
| 688 | .cxx:def_src_handler_cxx \ | 
|---|
| 689 | .CXX:def_src_handler_cxx \ | 
|---|
| 690 | .cpp:def_src_handler_cxx \ | 
|---|
| 691 | .CPP:def_src_handler_cxx \ | 
|---|
| 692 | .cc:def_src_handler_cxx \ | 
|---|
| 693 | .CC:def_src_handler_cxx \ | 
|---|
| 694 | .m:def_src_handler_objc \ | 
|---|
| 695 | .asm:def_src_handler_asm \ | 
|---|
| 696 | .ASM:def_src_handler_asm \ | 
|---|
| 697 | .s:def_src_handler_asm \ | 
|---|
| 698 | .S:def_src_handler_asm \ | 
|---|
| 699 | .rc:def_src_handler_rc \ | 
|---|
| 700 | .obj:def_src_handler_obj \ | 
|---|
| 701 | .o:def_src_handler_obj \ | 
|---|
| 702 | .res:def_src_handler_obj | 
|---|
| 703 |  | 
|---|
| 704 | ## PROPS_TOOLS | 
|---|
| 705 | # This is a subset of PROPS_SINGLE. | 
|---|
| 706 | PROPS_TOOLS := TOOL CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL ARTOOL LDTOOL LEXTOOL FETCHTOOL UNPACKTOOL PATCHTOOL | 
|---|
| 707 |  | 
|---|
| 708 | ## PROPS_SINGLE | 
|---|
| 709 | # The list of non-accumulative target properties. | 
|---|
| 710 | # A Config.kmk file can add it's own properties to this list and kBuild | 
|---|
| 711 | # will do the necessary inheritance for templates, sdks, tools and targets. | 
|---|
| 712 | PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \ | 
|---|
| 713 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF | 
|---|
| 714 | ## PROPS_SINGLE_LNK | 
|---|
| 715 | # Subset of PROPS_SINGLE which applies to all linkable targets. | 
|---|
| 716 | PROPS_SINGLE_LNK := TOOL TEMPLATE CTOOL CXXTOOL OBJCTOOL ASTOOL RCTOOL \ | 
|---|
| 717 | INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \ | 
|---|
| 718 | OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF ASOBJSUFF RCOBJSUFF | 
|---|
| 719 |  | 
|---|
| 720 | ## PROPS_DEFERRED | 
|---|
| 721 | # This list of non-accumulative target properties which are or may be | 
|---|
| 722 | # functions, and thus should not be expanded until the very last moment. | 
|---|
| 723 | PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS NAME SONAME | 
|---|
| 724 |  | 
|---|
| 725 | ## PROPS_ACCUMULATE_R | 
|---|
| 726 | # The list of accumulative target properties where the right most value/flag | 
|---|
| 727 | # is the 'most significant'. | 
|---|
| 728 | # A Config.kmk file can add it's own properties to this list and kBuild | 
|---|
| 729 | # will do the necessary inheritance from templates to targets. | 
|---|
| 730 | PROPS_ACCUMULATE_R := \ | 
|---|
| 731 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \ | 
|---|
| 732 | ARFLAGS \ | 
|---|
| 733 | CFLAGS CDEFS \ | 
|---|
| 734 | CXXFLAGS CXXDEFS \ | 
|---|
| 735 | OBJCFLAGS OBJCDEFS \ | 
|---|
| 736 | ASFLAGS ASDEFS \ | 
|---|
| 737 | RCFLAGS RCDEFS \ | 
|---|
| 738 | LDFLAGS \ | 
|---|
| 739 | IDFLAGS IFDLAGS ISFLAGS \ | 
|---|
| 740 | FETCHFLAGS UNPACKFLAGS PATCHFLAGS | 
|---|
| 741 | ## PROPS_ACCUMULATE_R_LNK | 
|---|
| 742 | # Subset of PROPS_ACCUMULATE_R which applies to all linkable targets. | 
|---|
| 743 | PROPS_ACCUMULATE_R_LNK := \ | 
|---|
| 744 | DEPS LNK_DEPS ORDERDEPS LNK_ORDERDEPS DEFS \ | 
|---|
| 745 | CFLAGS CDEFS \ | 
|---|
| 746 | CXXFLAGS CXXDEFS \ | 
|---|
| 747 | OBJCFLAGS OBJCDEFS \ | 
|---|
| 748 | ASFLAGS ASDEFS \ | 
|---|
| 749 | RCFLAGS RCDEFS \ | 
|---|
| 750 | IDFLAGS IFDLAGS ISFLAGS | 
|---|
| 751 |  | 
|---|
| 752 | ## PROPS_ACCUMULATE | 
|---|
| 753 | # The list of accumulative target properties where the left most value/flag | 
|---|
| 754 | # is the 'most significant'. | 
|---|
| 755 | # A Config.kmk file can add it's own properties to this list and kBuild | 
|---|
| 756 | # will do the necessary inheritance from templates to targets. | 
|---|
| 757 | PROPS_ACCUMULATE_L := \ | 
|---|
| 758 | SDKS USES SOURCES SRC_HANDLERS INTERMEDIATES \ | 
|---|
| 759 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \ | 
|---|
| 760 | LIBS LIBPATH \ | 
|---|
| 761 | DIRS BLDDIRS CLEAN | 
|---|
| 762 | ## PROPS_ACCUMULATE_L_LNK | 
|---|
| 763 | # Subset of PROPS_ACCUMULATE_L which applies to all linkable targets. | 
|---|
| 764 | PROPS_ACCUMULATE_L_LNK := \ | 
|---|
| 765 | SDKS SOURCES SRC_HANDLERS \ | 
|---|
| 766 | INCS CINCS CXXINCS OBJCINCS ASINCS RCINCS \ | 
|---|
| 767 | BLDDIRS CLEAN | 
|---|
| 768 |  | 
|---|
| 769 | ## PROPS_ALL | 
|---|
| 770 | # List of all the properties. | 
|---|
| 771 | PROPS_ALL = $(PROPS_SINGLE) $(PROPS_DEFERRED) $(PROPS_ACCUMULATE_L) $(PROPS_ACCUMULATE_R) | 
|---|
| 772 |  | 
|---|
| 773 |  | 
|---|
| 774 | ## @name Properties valid on programs (BLDPROGS and PROGRAMS) | 
|---|
| 775 | ## @{ | 
|---|
| 776 | PROPS_PROGRAMS_SINGLE        := $(PROPS_SINGLE_LNK) LDTOOL EXESUFF | 
|---|
| 777 | PROPS_PROGRAMS_DEFERRED      := $(PROPS_DEFERRED) | 
|---|
| 778 | PROPS_PROGRAMS_ACCUMULATE_R  := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS | 
|---|
| 779 | PROPS_PROGRAMS_ACCUMULATE_L  := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH | 
|---|
| 780 | ## @} | 
|---|
| 781 |  | 
|---|
| 782 | ## @name Properties valid on libraries (LIBRARIES and IMPORT_LIBS) | 
|---|
| 783 | ## @{ | 
|---|
| 784 | PROPS_LIBRARIES_SINGLE       := $(PROPS_SINGLE_LNK) ARTOOL LIBSUFF ARLIBSUFF LIBSUFF | 
|---|
| 785 | PROPS_LIBRARIES_DEFERRED     := $(filter-out SONAME,$(PROPS_DEFERRED)) | 
|---|
| 786 | PROPS_LIBRARIES_ACCUMULATE_R := $(PROPS_ACCUMULATE_R_LNK) ARFLAGS | 
|---|
| 787 | PROPS_LIBRARIES_ACCUMULATE_L := $(PROPS_ACCUMULATE_L_LNK) | 
|---|
| 788 | ## @} | 
|---|
| 789 |  | 
|---|
| 790 | ## @name Properties valid on dlls (DLLS) | 
|---|
| 791 | ## @{ | 
|---|
| 792 | PROPS_DLLS_SINGLE            := $(PROPS_SINGLE_LNK) LDTOOL DLLSUFF LIBSUFF | 
|---|
| 793 | PROPS_DLLS_DEFERRED          := $(PROPS_DEFERRED) | 
|---|
| 794 | PROPS_DLLS_ACCUMULATE_R      := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS | 
|---|
| 795 | PROPS_DLLS_ACCUMULATE_L      := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH | 
|---|
| 796 | ## @} | 
|---|
| 797 |  | 
|---|
| 798 | ## @name Properties valid on system modules (SYSMODS) | 
|---|
| 799 | ## @{ | 
|---|
| 800 | PROPS_SYSMODS_SINGLE         := $(PROPS_SINGLE_LNK) LDTOOL SYSSUFF | 
|---|
| 801 | PROPS_SYSMODS_DEFERRED       := $(PROPS_DEFERRED) | 
|---|
| 802 | PROPS_SYSMODS_ACCUMULATE_R   := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS | 
|---|
| 803 | PROPS_SYSMODS_ACCUMULATE_L   := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH | 
|---|
| 804 | ## @} | 
|---|
| 805 |  | 
|---|
| 806 | ## @name Properties valid on installs (INSTALLS) | 
|---|
| 807 | ## @{ | 
|---|
| 808 | PROPS_INSTALLS_SINGLE        := TOOL TEMPLATE INST NOINST | 
|---|
| 809 | PROPS_INSTALLS_DEFERRED      := INSTFUN INSTALLER | 
|---|
| 810 | PROPS_INSTALLS_ACCUMULATE_R  := DEPS ORDERDEPS | 
|---|
| 811 | PROPS_INSTALLS_ACCUMULATE_L  := SOURCES DIRS CLEAN | 
|---|
| 812 | ## @} | 
|---|
| 813 |  | 
|---|
| 814 | ## @name Properties valid on fetches (INSTALLS) | 
|---|
| 815 | ## @{ | 
|---|
| 816 | PROPS_FETCHES_SINGLE         := TOOL TEMPLATE FETCHTOOL UNPACKTOOL PATCHTOOL INST FETCHDIR | 
|---|
| 817 | PROPS_FETCHES_DEFERRED       := | 
|---|
| 818 | PROPS_FETCHES_ACCUMULATE_R   := FETCHFLAGS UNPACKFLAGS PATCHFLAGS | 
|---|
| 819 | PROPS_FETCHES_ACCUMULATE_L   := SOURCES CLEAN | 
|---|
| 820 | ## @} | 
|---|
| 821 |  | 
|---|
| 822 |  | 
|---|
| 823 | # | 
|---|
| 824 | # Here is a special 'hack' to prevent innocent environment variables being | 
|---|
| 825 | # picked up and treated as properties. (The most annoying example of why | 
|---|
| 826 | # this is necessary is the Visual C++ commandline with it's LIBPATH.) | 
|---|
| 827 | # | 
|---|
| 828 | # Define KBUILD_DONT_KILL_ENV_PROPS in the env. or on the commandline to | 
|---|
| 829 | # disable this 'hack'. | 
|---|
| 830 | # | 
|---|
| 831 | ifndef KBUILD_DONT_KILL_ENV_PROPS | 
|---|
| 832 |  | 
|---|
| 833 | define def_nuke_environment_prop | 
|---|
| 834 | ifeq ($(origin $(prop)),environment) | 
|---|
| 835 | $(prop) = | 
|---|
| 836 | endif | 
|---|
| 837 | endef | 
|---|
| 838 | $(foreach prop, $(PROPS_ALL) \ | 
|---|
| 839 | FETCHES PATCHES BLDPROGS LIBRARIES IMPORT_LIBS DLLS PROGRAMS SYSMODS INSTALLS OTHERS \ | 
|---|
| 840 | SUBDIRS MAKEFILES BLDDIRS \ | 
|---|
| 841 | ,$(eval $(value def_nuke_environment_prop))) | 
|---|
| 842 |  | 
|---|
| 843 | endif # KBUILD_DONT_KILL_ENV_PROPS | 
|---|
| 844 |  | 
|---|
| 845 |  | 
|---|
| 846 | # | 
|---|
| 847 | # Pass configuration. | 
|---|
| 848 | # | 
|---|
| 849 | # The PASS_<passname>_trgs variable is listing the targets. | 
|---|
| 850 | # The PASS_<passname>_vars variable is listing the target variables. | 
|---|
| 851 | # The PASS_<passname>_pass variable is the lowercased passname. | 
|---|
| 852 | # | 
|---|
| 853 |  | 
|---|
| 854 | ## PASS: fetches | 
|---|
| 855 | # This pass fetches and unpacks things needed to complete the build. | 
|---|
| 856 | PASS_FETCHES        := Fetches | 
|---|
| 857 | PASS_FETCHES_trgs   := | 
|---|
| 858 | PASS_FETCHES_vars   := _FETCHES | 
|---|
| 859 | PASS_FETCHES_pass   := fetches | 
|---|
| 860 |  | 
|---|
| 861 | ## PASS: patches | 
|---|
| 862 | # This pass applies patches. | 
|---|
| 863 | PASS_PATCHES        := Patches | 
|---|
| 864 | PASS_PATCHES_trgs   := | 
|---|
| 865 | PASS_PATCHES_vars   := _PATCHES | 
|---|
| 866 | PASS_PATCHES_pass   := patches | 
|---|
| 867 |  | 
|---|
| 868 | ## PASS: bldprogs | 
|---|
| 869 | # This pass builds targets which are required for building the rest. | 
|---|
| 870 | PASS_BLDPROGS       := Build Programs | 
|---|
| 871 | PASS_BLDPROGS_trgs  := | 
|---|
| 872 | PASS_BLDPROGS_vars  := _BLDPROGS | 
|---|
| 873 | PASS_BLDPROGS_pass  := bldprogs | 
|---|
| 874 |  | 
|---|
| 875 | ## PASS: libraries | 
|---|
| 876 | # This pass builds library targets. | 
|---|
| 877 | PASS_LIBRARIES      := Libraries | 
|---|
| 878 | PASS_LIBRARIES_trgs := | 
|---|
| 879 | PASS_LIBRARIES_vars := _LIBS _IMPORT_LIBS _OTHER_LIBRARIES | 
|---|
| 880 | PASS_LIBRARIES_pass := libraries | 
|---|
| 881 |  | 
|---|
| 882 | ## PASS: binaries | 
|---|
| 883 | # This pass builds dll targets. | 
|---|
| 884 | PASS_DLLS           := DLLs | 
|---|
| 885 | PASS_DLLS_trgs      := | 
|---|
| 886 | PASS_DLLS_vars      := _DLLS _OTHER_DLLS | 
|---|
| 887 | PASS_DLLS_pass      := dlls | 
|---|
| 888 |  | 
|---|
| 889 | ## PASS: binaries | 
|---|
| 890 | # This pass builds binary targets, i.e. programs, system modules and stuff. | 
|---|
| 891 | PASS_BINARIES       := Programs | 
|---|
| 892 | PASS_BINARIES_trgs  := | 
|---|
| 893 | PASS_BINARIES_vars  := _PROGRAMS _SYSMODS _OTHER_BINARIES | 
|---|
| 894 | PASS_BINARIES_pass  := binaries | 
|---|
| 895 |  | 
|---|
| 896 | ## PASS: others | 
|---|
| 897 | # This pass builds other targets. | 
|---|
| 898 | PASS_OTHERS         := Other Stuff | 
|---|
| 899 | PASS_OTHERS_trgs    := | 
|---|
| 900 | PASS_OTHERS_vars    := _OTHERS | 
|---|
| 901 | PASS_OTHERS_pass    := others | 
|---|
| 902 |  | 
|---|
| 903 | ## PASS: install | 
|---|
| 904 | # This pass installs the built entities to a sandbox area. | 
|---|
| 905 | ## @todo split this up into build install (to sandbox) and real installation. | 
|---|
| 906 | PASS_INSTALLS       := Install | 
|---|
| 907 | PASS_INSTALLS_trgs  := | 
|---|
| 908 | PASS_INSTALLS_vars  := _INSTALLS_DIRS _INSTALLS _INSTALLS_FILES | 
|---|
| 909 | PASS_INSTALLS_pass  := installs | 
|---|
| 910 |  | 
|---|
| 911 | ## PASS: testing | 
|---|
| 912 | # This pass processes custom rules for executing tests. | 
|---|
| 913 | PASS_TESTING        := Tests | 
|---|
| 914 | PASS_TESTING_trgs   := | 
|---|
| 915 | PASS_TESTING_vars   := _TESTING | 
|---|
| 916 | PASS_TESTING_pass   := testing | 
|---|
| 917 | # aliases | 
|---|
| 918 | .PHONY: check test | 
|---|
| 919 | check test: pass_testing | 
|---|
| 920 |  | 
|---|
| 921 | ## PASS: packing | 
|---|
| 922 | # This pass processes custom packing rules. | 
|---|
| 923 | PASS_PACKING        := Packing | 
|---|
| 924 | PASS_PACKING_trgs   := | 
|---|
| 925 | PASS_PACKING_vars   := _PACKING | 
|---|
| 926 | PASS_PACKING_pass   := packing | 
|---|
| 927 | # alias | 
|---|
| 928 | .PHONY: packing | 
|---|
| 929 | packing: pass_packing | 
|---|
| 930 |  | 
|---|
| 931 | ## PASS: clean | 
|---|
| 932 | # This pass removes all generated files. | 
|---|
| 933 | PASS_CLEAN          := Clean | 
|---|
| 934 | PASS_CLEAN_trgs     := do-clean | 
|---|
| 935 | PASS_CLEAN_vars     := | 
|---|
| 936 | PASS_CLEAN_pass     := clean | 
|---|
| 937 | # alias | 
|---|
| 938 | .PHONY: clean | 
|---|
| 939 | clean: pass_clean | 
|---|
| 940 |  | 
|---|
| 941 | ## PASS: nothing | 
|---|
| 942 | # This pass just walks the tree. | 
|---|
| 943 | PASS_NOTHING        := Nothing | 
|---|
| 944 | PASS_NOTHING_trgs   := do-nothing | 
|---|
| 945 | PASS_NOTHING_vars   := | 
|---|
| 946 | PASS_NOTHING_pass   := nothing | 
|---|
| 947 | # alias | 
|---|
| 948 | .PHONY: nothing | 
|---|
| 949 | nothing: pass_nothing | 
|---|
| 950 |  | 
|---|
| 951 | ## DEFAULT_PASSES | 
|---|
| 952 | # The default passes and their order. | 
|---|
| 953 | DEFAULT_PASSES := BLDPROGS LIBRARIES DLLS BINARIES OTHERS INSTALLS | 
|---|
| 954 |  | 
|---|
| 955 | ## PASSES | 
|---|
| 956 | # The passes that should be defined. This must include | 
|---|
| 957 | # all passes mentioned by DEFAULT_PASSES. | 
|---|
| 958 | PASSES := FETCHES PATCHES $(DEFAULT_PASSES) TESTING PACKING CLEAN NOTHING | 
|---|
| 959 |  | 
|---|
| 960 |  | 
|---|
| 961 | # | 
|---|
| 962 | # Check for --pretty-command-printing before including the Config.kmk | 
|---|
| 963 | # so that anyone overriding the message macros can take the implied | 
|---|
| 964 | # verbosity level change into account. | 
|---|
| 965 | # | 
|---|
| 966 | ifndef KBUILD_VERBOSE | 
|---|
| 967 | ifndef KBUILD_QUIET | 
|---|
| 968 | ifeq ($(KMK_OPTS_PRETTY_COMMAND_PRINTING),1) | 
|---|
| 969 | export KBUILD_VERBOSE := 2 | 
|---|
| 970 | endif | 
|---|
| 971 | endif | 
|---|
| 972 | endif | 
|---|
| 973 |  | 
|---|
| 974 |  | 
|---|
| 975 | # | 
|---|
| 976 | # Legacy variable translation. | 
|---|
| 977 | # These will be eliminated when switching to the next version. | 
|---|
| 978 | # | 
|---|
| 979 | ifdef USE_KOBJCACHE | 
|---|
| 980 | ifndef KBUILD_USE_KOBJCACHE | 
|---|
| 981 | export KBUILD_USE_KOBJCACHE := $(USE_KOBJCACHE) | 
|---|
| 982 | endif | 
|---|
| 983 | endif | 
|---|
| 984 |  | 
|---|
| 985 |  | 
|---|
| 986 | # | 
|---|
| 987 | # This is how we find the closest config.kmk. | 
|---|
| 988 | # It's a little hacky but I think it works fine. | 
|---|
| 989 | # | 
|---|
| 990 | _CFGDIR     := . | 
|---|
| 991 | _CFGFILES   := ./Config.kmk ./config.kmk | 
|---|
| 992 | define def_include_config | 
|---|
| 993 | $(eval _CFGDIR := $(_CFGDIR)/$(dir)) | 
|---|
| 994 | _CFGFILES   += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk | 
|---|
| 995 | endef | 
|---|
| 996 | # walk down the _RELATIVE_ path specified by DEPTH. | 
|---|
| 997 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) ) | 
|---|
| 998 | # add the default config file. | 
|---|
| 999 | _CFGFILE    := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG))) | 
|---|
| 1000 | _CFGFILES   := | 
|---|
| 1001 | _CFGDIR     := | 
|---|
| 1002 | ifeq ($(_CFGFILE),) | 
|---|
| 1003 | $(error kBuild: no Config.kmk file found! Check the DEPTH: DEPTH='$(DEPTH)' PATH_CURRENT='$(PATH_CURRENT)') | 
|---|
| 1004 | endif | 
|---|
| 1005 |  | 
|---|
| 1006 | # Include the config.kmk we found file (or the default one). | 
|---|
| 1007 | ifdef KBUILD_PROFILE_SELF | 
|---|
| 1008 | _KBUILD_TS_NOW := $(nanots ) | 
|---|
| 1009 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - including $(_CFGFILE)) | 
|---|
| 1010 | $(info stat: $(make-stats )) | 
|---|
| 1011 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW) | 
|---|
| 1012 |  | 
|---|
| 1013 | include $(_CFGFILE) | 
|---|
| 1014 |  | 
|---|
| 1015 | _KBUILD_TS_NOW := $(nanots ) | 
|---|
| 1016 | $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - included $(_CFGFILE)) | 
|---|
| 1017 | $(info stat: $(make-stats )) | 
|---|
| 1018 | _KBUILD_TS_PREV := $(_KBUILD_TS_NOW) | 
|---|
| 1019 | else | 
|---|
| 1020 | include $(_CFGFILE) | 
|---|
| 1021 | endif | 
|---|
| 1022 |  | 
|---|
| 1023 |  | 
|---|
| 1024 |  | 
|---|
| 1025 | # | 
|---|
| 1026 | # Finalize a the central path variables now that we've included the Config.kmk file. | 
|---|
| 1027 | # | 
|---|
| 1028 | # This prevents some trouble when users override the defaults for these | 
|---|
| 1029 | # variables and uses relative paths or paths with incorrect case. | 
|---|
| 1030 | # | 
|---|
| 1031 | PATH_OUT_BASE := $(abspath $(PATH_OUT_BASE)) | 
|---|
| 1032 | PATH_OUT    := $(abspath $(PATH_OUT)) | 
|---|
| 1033 | PATH_OBJ    := $(abspath $(PATH_OBJ)) | 
|---|
| 1034 | PATH_TARGET := $(abspath $(PATH_TARGET)) | 
|---|
| 1035 | PATH_INS    := $(abspath $(PATH_INS)) | 
|---|
| 1036 | PATH_BIN    := $(abspath $(PATH_BIN)) | 
|---|
| 1037 | PATH_DLL    := $(abspath $(PATH_DLL)) | 
|---|
| 1038 | PATH_SYS    := $(abspath $(PATH_SYS)) | 
|---|
| 1039 | PATH_LIB    := $(abspath $(PATH_LIB)) | 
|---|
| 1040 | PATH_DOC    := $(abspath $(PATH_DOC)) | 
|---|
| 1041 |  | 
|---|
| 1042 |  | 
|---|
| 1043 | # | 
|---|
| 1044 | # Setup the message style. The default one is inlined. | 
|---|
| 1045 | # | 
|---|
| 1046 | # See kBuild/msgstyles for more styles or use KBUILD_MSG_STYLE_PATHS | 
|---|
| 1047 | # to create your own message style. | 
|---|
| 1048 | # | 
|---|
| 1049 | KBUILD_MSG_STYLE ?= default | 
|---|
| 1050 | ifeq ($(KBUILD_MSG_STYLE),default) | 
|---|
| 1051 | # | 
|---|
| 1052 | # The 'default' style. | 
|---|
| 1053 | # | 
|---|
| 1054 |  | 
|---|
| 1055 | ## Fetch starting. | 
|---|
| 1056 | # @param 1     Target name. | 
|---|
| 1057 | MSG_FETCH    ?= $(call MSG_L1,Fetching $1...) | 
|---|
| 1058 | ## Re-fetch starting. | 
|---|
| 1059 | # @param 1     Target name. | 
|---|
| 1060 | MSG_REFETCH  ?= $(call MSG_L1,Re-fetching $1...) | 
|---|
| 1061 | ## Downloading a fetch component. | 
|---|
| 1062 | # @param 1     Target name. | 
|---|
| 1063 | # @param 2     The source URL. | 
|---|
| 1064 | # @param 3     The destination file name. | 
|---|
| 1065 | MSG_FETCH_DL ?= $(call MSG_L1,Downloading $1 - $2,=> $3) | 
|---|
| 1066 | ## Checking a fetch component. | 
|---|
| 1067 | # @param 1     Target name. | 
|---|
| 1068 | # @param 2     The source URL. | 
|---|
| 1069 | # @param 3     The destination file name. | 
|---|
| 1070 | MSG_FETCH_CHK?= $(call MSG_L1,Checking $1 - $3, ($2)) | 
|---|
| 1071 | ## Unpacking a fetch component. | 
|---|
| 1072 | # @param 1     Target name. | 
|---|
| 1073 | # @param 2     The archive file name. | 
|---|
| 1074 | # @param 3     The target directory. | 
|---|
| 1075 | MSG_FETCH_UP ?= $(call MSG_L1,Unpacking $1 - $2 => $3) | 
|---|
| 1076 | ## Fetch completed. | 
|---|
| 1077 | # @param 1     Target name. | 
|---|
| 1078 | MSG_FETCH_OK ?= $(call MSG_L1,Successfully fetched $1) | 
|---|
| 1079 | ## Unfetch a fetch target. | 
|---|
| 1080 | # @param 1     Target name. | 
|---|
| 1081 | MSG_UNFETCH  ?= $(call MSG_L1,Unfetching $1...) | 
|---|
| 1082 | ## Compiling a source file. | 
|---|
| 1083 | # @param 1     Target name. | 
|---|
| 1084 | # @param 2     The source filename. | 
|---|
| 1085 | # @param 3     The primary link output file name. | 
|---|
| 1086 | # @param 4     The source type (C,CXX,OBJC,AS,RC,++). | 
|---|
| 1087 | MSG_COMPILE  ?= $(call MSG_L1,Compiling $1 - $2,=> $3) | 
|---|
| 1088 | ## Tool | 
|---|
| 1089 | # @param 1     The tool name (bin2c,...) | 
|---|
| 1090 | # @param 2     Target name. | 
|---|
| 1091 | # @param 3     The source filename. | 
|---|
| 1092 | # @param 4     The primary output file name. | 
|---|
| 1093 | MSG_TOOL     ?= $(call MSG_L1,$1 $2 - $3,=> $4) | 
|---|
| 1094 | ## Generate a file, typically a source file. | 
|---|
| 1095 | # @param 1     Target name if applicable. | 
|---|
| 1096 | # @param 2     Output file name. | 
|---|
| 1097 | # @param 3     What it's generated from | 
|---|
| 1098 | MSG_GENERATE ?= $(call MSG_L1,Generating $(if $1,$1 - )$2,$(if $3,from $3)) | 
|---|
| 1099 | ## Linking a bldprog/dll/program/sysmod target. | 
|---|
| 1100 | # @param 1     Target name. | 
|---|
| 1101 | # @param 2     The primary link output file name. | 
|---|
| 1102 | # @param 3     The link tool operation (LINK_LIBRARY,LINK_PROGRAM,LINK_DLL,LINK_SYSMOD,++). | 
|---|
| 1103 | MSG_LINK     ?= $(call MSG_L1,Linking $1,=> $2) | 
|---|
| 1104 | ## Merging a library into the target (during library linking). | 
|---|
| 1105 | # @param 1     Target name. | 
|---|
| 1106 | # @param 2     The output library name. | 
|---|
| 1107 | # @param 3     The input library name. | 
|---|
| 1108 | MSG_AR_MERGE ?= $(call MSG_L1,Merging $3 into $1, ($2)) | 
|---|
| 1109 | ## Creating a directory (build). | 
|---|
| 1110 | # @param 1     Directory name. | 
|---|
| 1111 | MSG_MKDIR    ?= $(call MSG_L2,Creating directory $1) | 
|---|
| 1112 | ## Cleaning. | 
|---|
| 1113 | MSG_CLEAN    ?= $(call MSG_L1,Cleaning...) | 
|---|
| 1114 | ## Nothing. | 
|---|
| 1115 | MSG_NOTHING  ?= $(call MSG_L1,Did nothing in $(CURDIR)) | 
|---|
| 1116 | ## Pass | 
|---|
| 1117 | # @param 1     The pass name. | 
|---|
| 1118 | MSG_PASS     ?= $(call MSG_L1,Pass - $1) | 
|---|
| 1119 | ## Installing a bldprog/lib/dll/program/sysmod target. | 
|---|
| 1120 | # @param 1     Target name. | 
|---|
| 1121 | # @param 2     The source filename. | 
|---|
| 1122 | # @param 3     The destination file name. | 
|---|
| 1123 | MSG_INST_TRG ?= $(call MSG_L1,Installing $1 => $3) | 
|---|
| 1124 | ## Installing a file (install target). | 
|---|
| 1125 | # @param 1     The source filename. | 
|---|
| 1126 | # @param 2     The destination filename. | 
|---|
| 1127 | MSG_INST_FILE?= $(call MSG_L1,Installing $2,(<= $1)) | 
|---|
| 1128 | ## Installing a symlink. | 
|---|
| 1129 | # @param 1     Symlink | 
|---|
| 1130 | # @param 2     Link target | 
|---|
| 1131 | MSG_INST_SYM ?= $(call MSG_L1,Installing symlink $1,=> $2) | 
|---|
| 1132 | ## Installing a directory. | 
|---|
| 1133 | # @param 1     Directory name. | 
|---|
| 1134 | MSG_INST_DIR ?= $(call MSG_L1,Installing directory $1) | 
|---|
| 1135 |  | 
|---|
| 1136 | else | 
|---|
| 1137 | _KBUILD_MSG_STYLE_FILE := $(firstword $(foreach path, $(KBUILD_MSG_STYLE_PATHS) $(KBUILD_PATH)/msgstyles, $(wildcard $(path)/$(KBUILD_MSG_STYLE).kmk))) | 
|---|
| 1138 | ifneq ($(_KBUILD_MSG_STYLE_FILE),) | 
|---|
| 1139 | include $(_KBUILD_MSG_STYLE_FILE) | 
|---|
| 1140 | else | 
|---|
| 1141 | $(error kBuild: Can't find the style setup file for KBUILD_MSG_STYLE '$(KBUILD_MSG_STYLE)') | 
|---|
| 1142 | endif | 
|---|
| 1143 | endif | 
|---|
| 1144 |  | 
|---|
| 1145 |  | 
|---|
| 1146 | # | 
|---|
| 1147 | # Message macros. | 
|---|
| 1148 | # | 
|---|
| 1149 | # This is done after including Config.kmk as to allow for | 
|---|
| 1150 | # KBUILD_QUIET and KBUILD_VERBOSE to be configurable. | 
|---|
| 1151 | # | 
|---|
| 1152 | ifdef KBUILD_QUIET | 
|---|
| 1153 | # No output | 
|---|
| 1154 | QUIET := @ | 
|---|
| 1155 | QUIET2:= @ | 
|---|
| 1156 | MSG_L1 = | 
|---|
| 1157 | MSG_L2 = | 
|---|
| 1158 | else | 
|---|
| 1159 | ifndef KBUILD_VERBOSE | 
|---|
| 1160 | # Default output level. | 
|---|
| 1161 | QUIET  := @ | 
|---|
| 1162 | QUIET2 := @ | 
|---|
| 1163 | MSG_L1 ?= %@$(ECHO) "kBuild: $1" | 
|---|
| 1164 | MSG_L2  = | 
|---|
| 1165 | else ifeq ($(KBUILD_VERBOSE),1) | 
|---|
| 1166 | # A bit more output | 
|---|
| 1167 | QUIET  := @ | 
|---|
| 1168 | QUIET2 := @ | 
|---|
| 1169 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2" | 
|---|
| 1170 | MSG_L2  = | 
|---|
| 1171 | else ifeq ($(KBUILD_VERBOSE),2) | 
|---|
| 1172 | # Lot more output | 
|---|
| 1173 | QUIET  := | 
|---|
| 1174 | QUIET2 := @ | 
|---|
| 1175 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2" | 
|---|
| 1176 | MSG_L2 ?= %@$(ECHO) "kBuild: $1" | 
|---|
| 1177 | else | 
|---|
| 1178 | # maximal output. | 
|---|
| 1179 | QUIET  := | 
|---|
| 1180 | QUIET2 := | 
|---|
| 1181 | MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2" | 
|---|
| 1182 | MSG_L2 ?= %@$(ECHO) "kBuild: $1" | 
|---|
| 1183 | endif | 
|---|
| 1184 | endif | 
|---|
| 1185 |  | 
|---|
| 1186 |  | 
|---|
| 1187 | # | 
|---|
| 1188 | # Validate any KBUILD_BLD_TYPES additions and finally the KBUILD_TYPE. | 
|---|
| 1189 | # | 
|---|
| 1190 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_OSES)) | 
|---|
| 1191 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_OSES!) | 
|---|
| 1192 | endif | 
|---|
| 1193 | if1of ($(KBUILD_BLD_TYPES), $(KBUILD_ARCHES)) | 
|---|
| 1194 | $(error kBuild: found KBUILD_BLD_TYPES in KBUILD_ARCHES!) | 
|---|
| 1195 | endif | 
|---|
| 1196 | if1of ($(KBUILD_OSES), $(KBUILD_ARCHES)) | 
|---|
| 1197 | $(error kBuild: found KBUILD_OSES in KBUILD_ARCHES!) | 
|---|
| 1198 | endif | 
|---|
| 1199 | ifn1of ($(KBUILD_TYPE), $(KBUILD_BLD_TYPES)) | 
|---|
| 1200 | $(error kBuild: KBUILD_TYPE(=$(KBUILD_TYPE)) is not found in KBUILD_BLD_TYPES(=$(KBUILD_BLD_TYPES))!) | 
|---|
| 1201 | endif | 
|---|
| 1202 |  | 
|---|
| 1203 |  | 
|---|
| 1204 |  | 
|---|
| 1205 | ifdef KBUILD_PROFILE_SELF | 
|---|
| 1206 | _KBUILD_TS_HEADER_END := $(nanots ) | 
|---|
| 1207 | $(info prof: $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_HEADER_END), $(_KBUILD_TS_PREV)) - end of header.kmk) | 
|---|
| 1208 | $(info stat: $(make-stats )) | 
|---|
| 1209 | _KBUILD_TS_PREV := $(_KBUILD_TS_HEADER_END) | 
|---|
| 1210 | endif | 
|---|
| 1211 |  | 
|---|
| 1212 | # end-of-file-content | 
|---|
| 1213 | __header_kmk__ := 1 | 
|---|
| 1214 | endif # __header_kmk__ | 
|---|
| 1215 |  | 
|---|
| 1216 |  | 
|---|