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