[69] | 1 | # $Id: header.kmk 329 2005-10-28 23:36:23Z bird $
|
---|
| 2 | ## @file
|
---|
| 3 | #
|
---|
| 4 | # kBuild - File included at top of makefile.
|
---|
| 5 | #
|
---|
| 6 | # Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
|
---|
| 7 | #
|
---|
| 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 |
|
---|
| 27 | ifndef __header_kmk__
|
---|
| 28 | # start-of-file-content
|
---|
| 29 |
|
---|
| 30 | #
|
---|
| 31 | # default rule
|
---|
| 32 | #
|
---|
| 33 | all: all_recursive
|
---|
| 34 |
|
---|
| 35 | #
|
---|
| 36 | # Try avoid inference rules.
|
---|
| 37 | #
|
---|
| 38 | .SUFFIXES:
|
---|
| 39 | SUFFIXES :=
|
---|
| 40 |
|
---|
[72] | 41 |
|
---|
[69] | 42 | #
|
---|
[95] | 43 | # General purpose macros.
|
---|
| 44 | #
|
---|
[204] | 45 |
|
---|
[95] | 46 | ## get last word in a list.
|
---|
| 47 | # @returns last word in $1.
|
---|
| 48 | # @param $1 Word list.
|
---|
| 49 | lastword = $(word $(words $(1)), $(1))
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 | #
|
---|
[72] | 53 | # Assert build type.
|
---|
[69] | 54 | #
|
---|
| 55 | ifndef BUILD_TYPE
|
---|
| 56 | ifndef BUILD_MODE
|
---|
[72] | 57 | $(error kBuild: You must define BUILD_TYPE!)
|
---|
[69] | 58 | endif
|
---|
| 59 | BUILD_TYPE := $(BUILD_MODE)
|
---|
| 60 | endif
|
---|
[72] | 61 | ifeq ($(BUILD_TYPE),DEBUG)
|
---|
| 62 | BUILD_TYPE := debug
|
---|
| 63 | endif
|
---|
| 64 | ifeq ($(BUILD_TYPE),RELEASE)
|
---|
| 65 | BUILD_TYPE := release
|
---|
| 66 | endif
|
---|
| 67 | ifeq ($(BUILD_TYPE),PROFILE)
|
---|
| 68 | BUILD_TYPE := profile
|
---|
| 69 | endif
|
---|
[69] | 70 |
|
---|
| 71 |
|
---|
| 72 | #
|
---|
[72] | 73 | # Assert build platform.
|
---|
[70] | 74 | #
|
---|
[72] | 75 | _BUILD_PLATFORM_OK := 0
|
---|
[271] | 76 | # OS/2 (have uppercase legacy)
|
---|
[72] | 77 | ifeq ($(BUILD_PLATFORM),OS2)
|
---|
[271] | 78 | override BUILD_PLATFORM := os2
|
---|
[72] | 79 | endif
|
---|
| 80 | ifeq ($(BUILD_PLATFORM),os2)
|
---|
| 81 | _BUILD_PLATFORM_OK := 1
|
---|
| 82 | endif
|
---|
[70] | 83 |
|
---|
[72] | 84 | # Linux
|
---|
| 85 | ifeq ($(BUILD_PLATFORM),LINUX)
|
---|
[88] | 86 | $(error kBuild: BUILD_PLATFORM must be all lowercase!)
|
---|
[72] | 87 | endif
|
---|
| 88 | ifeq ($(BUILD_PLATFORM),linux)
|
---|
| 89 | _BUILD_PLATFORM_OK := 1
|
---|
| 90 | endif
|
---|
| 91 |
|
---|
| 92 | # Win32
|
---|
| 93 | ifeq ($(BUILD_PLATFORM),WIN32)
|
---|
[88] | 94 | $(error kBuild: BUILD_PLATFORM must be all lowercase!)
|
---|
[72] | 95 | endif
|
---|
[83] | 96 | ifeq ($(BUILD_PLATFORM),win32)
|
---|
[72] | 97 | _BUILD_PLATFORM_OK := 1
|
---|
| 98 | endif
|
---|
| 99 |
|
---|
[292] | 100 | # L4
|
---|
| 101 | ifeq ($(BUILD_PLATFORM),L4)
|
---|
| 102 | $(error kBuild: BUILD_PLATFORM must be all lowercase!)
|
---|
| 103 | endif
|
---|
| 104 | ifeq ($(BUILD_PLATFORM),l4)
|
---|
| 105 | _BUILD_PLATFORM_OK := 1
|
---|
| 106 | endif
|
---|
| 107 |
|
---|
[299] | 108 | # FreeBSD
|
---|
| 109 | ifeq ($(BUILD_PLATFORM),FreeBSD)
|
---|
| 110 | $(error kBuild: BUILD_PLATFORM must be all lowercase!)
|
---|
| 111 | endif
|
---|
| 112 | ifeq ($(BUILD_PLATFORM),freebsd)
|
---|
| 113 | _BUILD_PLATFORM_OK := 1
|
---|
| 114 | endif
|
---|
| 115 |
|
---|
[72] | 116 | ifeq ($(_BUILD_PLATFORM_OK),0)
|
---|
| 117 | $(error kBuild: BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recongized!)
|
---|
| 118 | endif
|
---|
[329] | 119 |
|
---|
| 120 | # Fill in defaults if needed.
|
---|
| 121 | ifndef BUILD_PLATFORM_ARCH
|
---|
[95] | 122 | BUILD_PLATFORM_ARCH := x86
|
---|
[329] | 123 | endif
|
---|
| 124 | ifndef BUILD_PLATFORM_CPU
|
---|
[95] | 125 | BUILD_PLATFORM_CPU := i586
|
---|
[329] | 126 | endif
|
---|
[72] | 127 |
|
---|
| 128 |
|
---|
[70] | 129 | #
|
---|
[72] | 130 | # Assert target platform.
|
---|
| 131 | #
|
---|
| 132 | ifndef BUILD_TARGET
|
---|
| 133 | # not defined, set to the same as build platform
|
---|
| 134 | BUILD_TARGET := $(BUILD_PLATFORM)
|
---|
| 135 | else
|
---|
| 136 | _BUILD_TARGET_OK := 0
|
---|
| 137 | # OS/2
|
---|
| 138 | ifeq ($(BUILD_TARGET),OS2)
|
---|
[88] | 139 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
[72] | 140 | endif
|
---|
| 141 | ifeq ($(BUILD_TARGET),os2)
|
---|
| 142 | _BUILD_TARGET_OK := 1
|
---|
| 143 | endif
|
---|
| 144 |
|
---|
| 145 | # Linux
|
---|
| 146 | ifeq ($(BUILD_TARGET),LINUX)
|
---|
[88] | 147 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
[72] | 148 | endif
|
---|
| 149 | ifeq ($(BUILD_TARGET),linux)
|
---|
| 150 | _BUILD_TARGET_OK := 1
|
---|
| 151 | endif
|
---|
| 152 |
|
---|
| 153 | # Win32
|
---|
| 154 | ifeq ($(BUILD_TARGET),WIN32)
|
---|
[88] | 155 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
[72] | 156 | endif
|
---|
[77] | 157 | ifeq ($(BUILD_TARGET),win32)
|
---|
[72] | 158 | _BUILD_TARGET_OK := 1
|
---|
| 159 | endif
|
---|
| 160 |
|
---|
[292] | 161 | # L4
|
---|
| 162 | ifeq ($(BUILD_TARGET),L4)
|
---|
| 163 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
| 164 | endif
|
---|
| 165 | ifeq ($(BUILD_TARGET),l4)
|
---|
| 166 | _BUILD_TARGET_OK := 1
|
---|
| 167 | endif
|
---|
| 168 |
|
---|
[299] | 169 | # FreeBSD
|
---|
| 170 | ifeq ($(BUILD_TARGET),FreeBSD)
|
---|
| 171 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
---|
| 172 | endif
|
---|
| 173 | ifeq ($(BUILD_TARGET),freebsd)
|
---|
| 174 | _BUILD_TARGET_OK := 1
|
---|
| 175 | endif
|
---|
| 176 |
|
---|
[72] | 177 | ifeq ($(_BUILD_TARGET_OK),0)
|
---|
| 178 | $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recongized!)
|
---|
| 179 | endif
|
---|
| 180 | endif
|
---|
[329] | 181 |
|
---|
| 182 | # Fill in defaults if needed.
|
---|
| 183 | ifndef BUILD_TARGET_ARCH
|
---|
[78] | 184 | BUILD_TARGET_ARCH := x86
|
---|
[329] | 185 | endif
|
---|
| 186 | ifndef BUILD_TARGET_CPU
|
---|
[78] | 187 | BUILD_TARGET_CPU := i586
|
---|
[329] | 188 | endif
|
---|
[72] | 189 |
|
---|
[266] | 190 | # Adjust the DEPTH definition first
|
---|
| 191 | ifeq ($(strip $(DEPTH)),)
|
---|
| 192 | DEPTH := .
|
---|
| 193 | endif
|
---|
[72] | 194 |
|
---|
| 195 | #
|
---|
[69] | 196 | # Common definitions.
|
---|
| 197 | #
|
---|
[306] | 198 | ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
|
---|
| 199 | PATH_CURRENT := $(abspath $(CURDIR))
|
---|
| 200 | PATH_ROOT := $(abspath $(PATH_CURRENT)/$(DEPTH))
|
---|
| 201 |
|
---|
| 202 | else
|
---|
| 203 |
|
---|
[69] | 204 | PATH_CURRENT := $(CURDIR)
|
---|
[70] | 205 | # Get the real root path.
|
---|
[85] | 206 | PATH_ROOT := $(PATH_CURRENT)
|
---|
[70] | 207 | ifneq ($(DEPTH),.)
|
---|
| 208 | $(foreach d,$(subst /, ,$(DEPTH)), $(eval PATH_ROOT := $(patsubst %/,%,$(dir $(PATH_ROOT)))) )
|
---|
[69] | 209 | endif
|
---|
[306] | 210 |
|
---|
| 211 | endif
|
---|
[70] | 212 | # Subdirectory relative to the root.
|
---|
[306] | 213 | ifneq ($(PATH_ROOT),$(PATH_CURRENT))
|
---|
| 214 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(PATH_CURRENT))
|
---|
[266] | 215 | else
|
---|
| 216 | CURSUBDIR := .
|
---|
| 217 | endif
|
---|
[306] | 218 |
|
---|
[70] | 219 | # Output directories.
|
---|
[242] | 220 | ifndef PATH_OUT_BASE
|
---|
| 221 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
---|
| 222 | endif
|
---|
[240] | 223 | ifndef PATH_OUT
|
---|
[329] | 224 | ifeq ($(BUILD_PLATFORM_ARCH),x86)
|
---|
[245] | 225 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
|
---|
| 226 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
|
---|
| 227 | else
|
---|
[242] | 228 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TYPE)
|
---|
[240] | 229 | endif
|
---|
[329] | 230 | else # !x86
|
---|
| 231 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
|
---|
| 232 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TARGET_ARCH)/$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
|
---|
| 233 | else
|
---|
| 234 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
|
---|
[245] | 235 | endif
|
---|
[329] | 236 | endif # !x86
|
---|
| 237 | endif # !define PATH_OUT
|
---|
[69] | 238 | PATH_OBJ := $(PATH_OUT)/obj
|
---|
[271] | 239 | PATH_TARGET := $(PATH_OBJ)/$(CURSUBDIR)
|
---|
| 240 | ifndef KBUILD_NEW_STUFF
|
---|
[69] | 241 | PATH_BIN := $(PATH_OUT)/bin
|
---|
| 242 | PATH_LIB := $(PATH_OUT)/lib
|
---|
| 243 | PATH_DOC := $(PATH_ROOT)/out/doc
|
---|
[271] | 244 | else
|
---|
| 245 | PATH_INS := $(PATH_OUT)
|
---|
| 246 | PATH_BIN := $(PATH_INS)/bin
|
---|
| 247 | PATH_DLL := $(PATH_INS)/bin
|
---|
| 248 | PATH_LIB := $(PATH_INS)/lib
|
---|
| 249 | PATH_DOC := $(PATH_INS)/doc
|
---|
| 250 | endif
|
---|
[70] | 251 |
|
---|
| 252 | # Usually kBuild is external to the source tree.
|
---|
| 253 | ifndef PATH_KBUILD
|
---|
| 254 | PATH_KBUILD := $(PATH_ROOT)/kBuild
|
---|
| 255 | endif
|
---|
[306] | 256 | ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
|
---|
| 257 | PATH_KBUILD := $(abspath $(PATH_KBUILD))
|
---|
| 258 | endif
|
---|
[69] | 259 | # kBuild files which might be of interest.
|
---|
| 260 | FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
|
---|
| 261 | FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
|
---|
| 262 | FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
|
---|
| 263 |
|
---|
[72] | 264 | SUFF_DEP := .dep
|
---|
[204] | 265 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
---|
[69] | 266 |
|
---|
[72] | 267 |
|
---|
[69] | 268 | #
|
---|
| 269 | # Get rid of the GNU Make default stuff
|
---|
| 270 | #
|
---|
[230] | 271 | ifndef KMK_VERSION
|
---|
[69] | 272 | include $(PATH_KBUILD)/StampOutPredefines.kmk
|
---|
[216] | 273 | endif
|
---|
[69] | 274 |
|
---|
| 275 | #
|
---|
[72] | 276 | # Build platform setup.
|
---|
[69] | 277 | #
|
---|
[329] | 278 | PATH_TOOLS := $(PATH_KBUILD)/bin/$(BUILD_PLATFORM_ARCH).$(BUILD_PLATFORM)
|
---|
| 279 |
|
---|
[69] | 280 | # OS/2
|
---|
[72] | 281 | ifeq ($(BUILD_PLATFORM),os2)
|
---|
[83] | 282 | EXEC_X86_WIN32 := innopec.exe
|
---|
[69] | 283 | HOSTSUFF_EXE := .exe
|
---|
| 284 | endif
|
---|
| 285 |
|
---|
| 286 | # Linux
|
---|
[72] | 287 | ifeq ($(BUILD_PLATFORM),linux)
|
---|
[135] | 288 | EXEC_X86_WIN32 := wine
|
---|
[69] | 289 | HOSTSUFF_EXE :=
|
---|
| 290 | endif
|
---|
[70] | 291 |
|
---|
[69] | 292 | # Win32
|
---|
[72] | 293 | ifeq ($(BUILD_PLATFORM),win32)
|
---|
[69] | 294 | EXEC_X86_WIN32 :=
|
---|
| 295 | HOSTSUFF_EXE := .exe
|
---|
| 296 | endif
|
---|
| 297 |
|
---|
[299] | 298 | # FreeBSD
|
---|
| 299 | ifeq ($(BUILD_PLATFORM),freebsd)
|
---|
| 300 | EXEC_X86_WIN32 := wine
|
---|
| 301 | HOSTSUFF_EXE :=
|
---|
| 302 | endif
|
---|
[125] | 303 |
|
---|
[299] | 304 |
|
---|
[73] | 305 | #
|
---|
| 306 | # Build target setup.
|
---|
| 307 | #
|
---|
| 308 | ifeq ($(BUILD_TARGET),os2)
|
---|
| 309 | SUFF_OBJ := .obj
|
---|
| 310 | SUFF_LIB := .lib
|
---|
| 311 | SUFF_DLL := .dll
|
---|
| 312 | SUFF_EXE := .exe
|
---|
[86] | 313 | SUFF_SYS := .sys
|
---|
[73] | 314 | SUFF_RES := .res
|
---|
| 315 | endif
|
---|
| 316 | ifeq ($(BUILD_TARGET),win32)
|
---|
| 317 | SUFF_OBJ := .obj
|
---|
| 318 | SUFF_LIB := .lib
|
---|
| 319 | SUFF_DLL := .dll
|
---|
| 320 | SUFF_EXE := .exe
|
---|
[86] | 321 | SUFF_SYS := .sys
|
---|
[73] | 322 | SUFF_RES := .res
|
---|
| 323 | endif
|
---|
| 324 | ifeq ($(BUILD_TARGET),linux)
|
---|
| 325 | SUFF_OBJ := .o
|
---|
| 326 | SUFF_LIB := .a
|
---|
| 327 | SUFF_DLL := .so
|
---|
| 328 | SUFF_EXE :=
|
---|
[86] | 329 | SUFF_SYS := .a
|
---|
[73] | 330 | SUFF_RES :=
|
---|
| 331 | endif
|
---|
[296] | 332 | ifeq ($(BUILD_TARGET),l4)
|
---|
| 333 | SUFF_OBJ := .o
|
---|
| 334 | SUFF_LIB := .a
|
---|
| 335 | SUFF_DLL := .s.so
|
---|
| 336 | SUFF_EXE :=
|
---|
| 337 | SUFF_SYS := .a
|
---|
| 338 | SUFF_RES :=
|
---|
| 339 | endif
|
---|
[69] | 340 |
|
---|
| 341 | #
|
---|
| 342 | # Standard kBuild tools.
|
---|
| 343 | #
|
---|
| 344 | DEP := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE)
|
---|
[262] | 345 | DEP_PRE := $(PATH_TOOLS)/kDepPre$(HOSTSUFF_EXE)
|
---|
[233] | 346 | ifeq ($(MAKE),kmk)
|
---|
| 347 | MAKE := $(PATH_TOOLS)/kmk$(HOSTSUFF_EXE)
|
---|
| 348 | endif
|
---|
| 349 |
|
---|
[69] | 350 | # Standard Unix shell utils.
|
---|
[230] | 351 | ifdef KMK_BUILTIN
|
---|
| 352 | ECHO := kmk_builtin_echo
|
---|
| 353 | MKDIR := kmk_builtin_mkdir
|
---|
| 354 | RM := kmk_builtin_rm
|
---|
| 355 | CP := kmk_builtin_cp
|
---|
| 356 | else
|
---|
| 357 | ECHO := echo
|
---|
[69] | 358 | MKDIR := $(PATH_TOOLS)/mkdir$(HOSTSUFF_EXE)
|
---|
| 359 | RM := $(PATH_TOOLS)/rm$(HOSTSUFF_EXE)
|
---|
[87] | 360 | CP := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE)
|
---|
[230] | 361 | endif
|
---|
[237] | 362 | CP_EXT := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE)
|
---|
[87] | 363 | MV := $(PATH_TOOLS)/mv$(HOSTSUFF_EXE)
|
---|
[69] | 364 | SED := $(PATH_TOOLS)/sed$(HOSTSUFF_EXE)
|
---|
| 365 | CAT := $(PATH_TOOLS)/cat$(HOSTSUFF_EXE)
|
---|
| 366 | # Bourn shell clone.
|
---|
| 367 | MAKESHELL := $(PATH_TOOLS)/ash$(HOSTSUFF_EXE)
|
---|
| 368 | SHELL := $(MAKESHELL)
|
---|
| 369 | export SHELL MAKESHELL
|
---|
| 370 |
|
---|
| 371 |
|
---|
| 372 | #
|
---|
[73] | 373 | # Message macros.
|
---|
[204] | 374 | #
|
---|
| 375 |
|
---|
[73] | 376 | ifndef BUILD_QUIET
|
---|
[75] | 377 | ifdef BUILD_DEBUG
|
---|
| 378 | BUILD_VERBOSE := 9
|
---|
| 379 | endif
|
---|
[230] | 380 | MSG_L1 = @$(ECHO) "kBuild: $1"
|
---|
[73] | 381 | ifdef BUILD_VERBOSE
|
---|
[230] | 382 | MSG_L2 = @$(ECHO) "kBuild: $1"
|
---|
[75] | 383 | QUIET :=
|
---|
[73] | 384 | else
|
---|
[75] | 385 | QUIET := @
|
---|
[73] | 386 | MSG_L2 =
|
---|
| 387 | endif
|
---|
| 388 | ifdef BUILD_DEBUG
|
---|
[230] | 389 | MSG_L3 = @$(ECHO) "kBuild: $1"
|
---|
[73] | 390 | else
|
---|
| 391 | MSG_L3 =
|
---|
| 392 | endif
|
---|
| 393 | else
|
---|
[75] | 394 | QUIET :=
|
---|
[73] | 395 | MSG_L1 =
|
---|
| 396 | MSG_L2 =
|
---|
| 397 | MSG_L3 =
|
---|
| 398 | endif
|
---|
| 399 |
|
---|
[130] | 400 | ## ABSPATH - make paths absolute.
|
---|
[129] | 401 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
---|
[73] | 402 | #
|
---|
[129] | 403 | # @param $1 The paths to make absolute.
|
---|
[306] | 404 | ifeq ($(filter abspath,$(KMK_FEATURES)),abspath)
|
---|
| 405 | ABSPATH = $(abspath $(1))
|
---|
| 406 | else
|
---|
[129] | 407 | ABSPATH = $(foreach path,$(1)\
|
---|
| 408 | ,$(strip $(if $(subst <,,$(firstword $(subst /, ,<$(path)))),\
|
---|
| 409 | $(if $(patsubst %:,,$(firstword $(subst :,: ,$(path)))),$(PATH_CURRENT)/$(path),$(path)),\
|
---|
| 410 | $(path))))
|
---|
[306] | 411 | endif
|
---|
| 412 |
|
---|
[130] | 413 | ## DIRDEP - make create directory dependencies.
|
---|
| 414 | #
|
---|
| 415 | # @param $1 The paths to the directories which must be created.
|
---|
| 416 | DIRDEP = $(foreach path,$(1),$(path)/.dir_created)
|
---|
[129] | 417 |
|
---|
[204] | 418 |
|
---|
[129] | 419 | ## Cygwin kludge.
|
---|
| 420 | # This converts /cygdrive/x/% to x:%.
|
---|
| 421 | #
|
---|
| 422 | # @param $1 The paths to make native.
|
---|
| 423 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
---|
| 424 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
---|
| 425 | CYGPATHMIXED = $(foreach path,$(1)\
|
---|
| 426 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
---|
| 427 | else
|
---|
| 428 | CYGPATHMIXED = $(1)
|
---|
| 429 | endif
|
---|
| 430 |
|
---|
| 431 | #
|
---|
[69] | 432 | # This is how we find the closest config.kmk.
|
---|
| 433 | # It's a little hacky but I think it works fine.
|
---|
[70] | 434 | #
|
---|
| 435 | _CFGDIR := .
|
---|
[78] | 436 | _CFGFILES := ./Config.kmk ./config.kmk
|
---|
[69] | 437 | define def_include_config
|
---|
[78] | 438 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
---|
| 439 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
---|
[69] | 440 | endef
|
---|
| 441 | # walk down the _RELATIVE_ path specified by DEPTH.
|
---|
[78] | 442 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
---|
[69] | 443 | # add the default config file.
|
---|
[78] | 444 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
---|
[69] | 445 | _CFGFILES :=
|
---|
| 446 | _CFGDIR :=
|
---|
| 447 |
|
---|
| 448 | # Include the config.kmk we found file (or the default one).
|
---|
| 449 | include $(_CFGFILE)
|
---|
| 450 |
|
---|
| 451 |
|
---|
| 452 | # end-of-file-content
|
---|
[72] | 453 | __header_kmk__ := 1
|
---|
[69] | 454 | endif # __header_kmk__
|
---|