| [69] | 1 | # $Id: header.kmk 299 2005-06-17 05:56:38Z 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
|
|---|
| [95] | 119 | BUILD_PLATFORM_ARCH := x86
|
|---|
| 120 | BUILD_PLATFORM_CPU := i586
|
|---|
| [72] | 121 |
|
|---|
| 122 |
|
|---|
| [70] | 123 | #
|
|---|
| [72] | 124 | # Assert target platform.
|
|---|
| 125 | #
|
|---|
| 126 | ifndef BUILD_TARGET
|
|---|
| 127 | # not defined, set to the same as build platform
|
|---|
| 128 | BUILD_TARGET := $(BUILD_PLATFORM)
|
|---|
| 129 | else
|
|---|
| 130 | _BUILD_TARGET_OK := 0
|
|---|
| 131 | # OS/2
|
|---|
| 132 | ifeq ($(BUILD_TARGET),OS2)
|
|---|
| [88] | 133 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
|---|
| [72] | 134 | endif
|
|---|
| 135 | ifeq ($(BUILD_TARGET),os2)
|
|---|
| 136 | _BUILD_TARGET_OK := 1
|
|---|
| 137 | endif
|
|---|
| 138 |
|
|---|
| 139 | # Linux
|
|---|
| 140 | ifeq ($(BUILD_TARGET),LINUX)
|
|---|
| [88] | 141 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
|---|
| [72] | 142 | endif
|
|---|
| 143 | ifeq ($(BUILD_TARGET),linux)
|
|---|
| 144 | _BUILD_TARGET_OK := 1
|
|---|
| 145 | endif
|
|---|
| 146 |
|
|---|
| 147 | # Win32
|
|---|
| 148 | ifeq ($(BUILD_TARGET),WIN32)
|
|---|
| [88] | 149 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
|---|
| [72] | 150 | endif
|
|---|
| [77] | 151 | ifeq ($(BUILD_TARGET),win32)
|
|---|
| [72] | 152 | _BUILD_TARGET_OK := 1
|
|---|
| 153 | endif
|
|---|
| 154 |
|
|---|
| [292] | 155 | # L4
|
|---|
| 156 | ifeq ($(BUILD_TARGET),L4)
|
|---|
| 157 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
|---|
| 158 | endif
|
|---|
| 159 | ifeq ($(BUILD_TARGET),l4)
|
|---|
| 160 | _BUILD_TARGET_OK := 1
|
|---|
| 161 | endif
|
|---|
| 162 |
|
|---|
| [299] | 163 | # FreeBSD
|
|---|
| 164 | ifeq ($(BUILD_TARGET),FreeBSD)
|
|---|
| 165 | $(error kBuild: BUILD_TARGET must be all lowercase!)
|
|---|
| 166 | endif
|
|---|
| 167 | ifeq ($(BUILD_TARGET),freebsd)
|
|---|
| 168 | _BUILD_TARGET_OK := 1
|
|---|
| 169 | endif
|
|---|
| 170 |
|
|---|
| [72] | 171 | ifeq ($(_BUILD_TARGET_OK),0)
|
|---|
| 172 | $(error kBuild: BUILD_TARGET value '$(BUILD_TARGET)' was not recongized!)
|
|---|
| 173 | endif
|
|---|
| 174 | endif
|
|---|
| [78] | 175 | BUILD_TARGET_ARCH := x86
|
|---|
| 176 | BUILD_TARGET_CPU := i586
|
|---|
| [72] | 177 |
|
|---|
| [266] | 178 | # Adjust the DEPTH definition first
|
|---|
| 179 | ifeq ($(strip $(DEPTH)),)
|
|---|
| 180 | DEPTH := .
|
|---|
| 181 | endif
|
|---|
| [72] | 182 |
|
|---|
| 183 | #
|
|---|
| [69] | 184 | # Common definitions.
|
|---|
| 185 | #
|
|---|
| 186 | PATH_CURRENT := $(CURDIR)
|
|---|
| [70] | 187 | # Get the real root path.
|
|---|
| [85] | 188 | PATH_ROOT := $(PATH_CURRENT)
|
|---|
| [70] | 189 | ifneq ($(DEPTH),.)
|
|---|
| 190 | $(foreach d,$(subst /, ,$(DEPTH)), $(eval PATH_ROOT := $(patsubst %/,%,$(dir $(PATH_ROOT)))) )
|
|---|
| [69] | 191 | endif
|
|---|
| [70] | 192 | # Subdirectory relative to the root.
|
|---|
| [266] | 193 | ifneq ($(DEPTH),.)
|
|---|
| [72] | 194 | CURSUBDIR := $(patsubst $(PATH_ROOT)/%,%,$(CURDIR))
|
|---|
| [266] | 195 | else
|
|---|
| 196 | CURSUBDIR := .
|
|---|
| 197 | endif
|
|---|
| [70] | 198 | # Output directories.
|
|---|
| [242] | 199 | ifndef PATH_OUT_BASE
|
|---|
| 200 | PATH_OUT_BASE := $(PATH_ROOT)/out
|
|---|
| 201 | endif
|
|---|
| [240] | 202 | ifndef PATH_OUT
|
|---|
| [245] | 203 | ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
|
|---|
| 204 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
|
|---|
| 205 | else
|
|---|
| [242] | 206 | PATH_OUT := $(PATH_OUT_BASE)/$(BUILD_TARGET)/$(BUILD_TYPE)
|
|---|
| [240] | 207 | endif
|
|---|
| [245] | 208 | endif
|
|---|
| [69] | 209 | PATH_OBJ := $(PATH_OUT)/obj
|
|---|
| [271] | 210 | PATH_TARGET := $(PATH_OBJ)/$(CURSUBDIR)
|
|---|
| 211 | ifndef KBUILD_NEW_STUFF
|
|---|
| [69] | 212 | PATH_BIN := $(PATH_OUT)/bin
|
|---|
| 213 | PATH_LIB := $(PATH_OUT)/lib
|
|---|
| 214 | PATH_DOC := $(PATH_ROOT)/out/doc
|
|---|
| [271] | 215 | else
|
|---|
| 216 | PATH_INS := $(PATH_OUT)
|
|---|
| 217 | PATH_BIN := $(PATH_INS)/bin
|
|---|
| 218 | PATH_DLL := $(PATH_INS)/bin
|
|---|
| 219 | PATH_LIB := $(PATH_INS)/lib
|
|---|
| 220 | PATH_DOC := $(PATH_INS)/doc
|
|---|
| 221 | endif
|
|---|
| [70] | 222 |
|
|---|
| 223 | # Usually kBuild is external to the source tree.
|
|---|
| 224 | ifndef PATH_KBUILD
|
|---|
| 225 | PATH_KBUILD := $(PATH_ROOT)/kBuild
|
|---|
| 226 | endif
|
|---|
| 227 | # kBuild tools
|
|---|
| [69] | 228 | PATH_TOOLS_W32 := $(PATH_KBUILD)/bin/x86.win32
|
|---|
| 229 | PATH_TOOLS_LNX := $(PATH_KBUILD)/bin/x86.linux
|
|---|
| 230 | PATH_TOOLS_OS2 := $(PATH_KBUILD)/bin/x86.os2
|
|---|
| [299] | 231 | PATH_TOOLS_FREEBSD := $(PATH_KBUILD)/bin/amd64.freebsd
|
|---|
| [69] | 232 | # kBuild files which might be of interest.
|
|---|
| 233 | FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
|
|---|
| 234 | FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
|
|---|
| 235 | FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
|
|---|
| 236 |
|
|---|
| [72] | 237 | SUFF_DEP := .dep
|
|---|
| [204] | 238 | MAKEFILE := $(firstword $(MAKEFILE_LIST))
|
|---|
| [69] | 239 |
|
|---|
| [72] | 240 |
|
|---|
| [69] | 241 | #
|
|---|
| 242 | # Get rid of the GNU Make default stuff
|
|---|
| 243 | #
|
|---|
| [230] | 244 | ifndef KMK_VERSION
|
|---|
| [69] | 245 | include $(PATH_KBUILD)/StampOutPredefines.kmk
|
|---|
| [216] | 246 | endif
|
|---|
| [69] | 247 |
|
|---|
| 248 | #
|
|---|
| [72] | 249 | # Build platform setup.
|
|---|
| [69] | 250 | #
|
|---|
| 251 | # OS/2
|
|---|
| [72] | 252 | ifeq ($(BUILD_PLATFORM),os2)
|
|---|
| [69] | 253 | PATH_TOOLS := $(PATH_TOOLS_OS2)
|
|---|
| [83] | 254 | EXEC_X86_WIN32 := innopec.exe
|
|---|
| [69] | 255 | HOSTSUFF_EXE := .exe
|
|---|
| 256 | endif
|
|---|
| 257 |
|
|---|
| 258 | # Linux
|
|---|
| [72] | 259 | ifeq ($(BUILD_PLATFORM),linux)
|
|---|
| [69] | 260 | PATH_TOOLS := $(PATH_TOOLS_LNX)
|
|---|
| [135] | 261 | EXEC_X86_WIN32 := wine
|
|---|
| [69] | 262 | HOSTSUFF_EXE :=
|
|---|
| 263 | endif
|
|---|
| [70] | 264 |
|
|---|
| [69] | 265 | # Win32
|
|---|
| [72] | 266 | ifeq ($(BUILD_PLATFORM),win32)
|
|---|
| [69] | 267 | PATH_TOOLS := $(PATH_TOOLS_W32)
|
|---|
| 268 | EXEC_X86_WIN32 :=
|
|---|
| 269 | HOSTSUFF_EXE := .exe
|
|---|
| 270 | endif
|
|---|
| 271 |
|
|---|
| [299] | 272 | # FreeBSD
|
|---|
| 273 | ifeq ($(BUILD_PLATFORM),freebsd)
|
|---|
| 274 | PATH_TOOLS := $(PATH_TOOLS_FREEBSD)
|
|---|
| 275 | EXEC_X86_WIN32 := wine
|
|---|
| 276 | HOSTSUFF_EXE :=
|
|---|
| 277 | endif
|
|---|
| [125] | 278 |
|
|---|
| [299] | 279 |
|
|---|
| [73] | 280 | #
|
|---|
| 281 | # Build target setup.
|
|---|
| 282 | #
|
|---|
| 283 | ifeq ($(BUILD_TARGET),os2)
|
|---|
| 284 | SUFF_OBJ := .obj
|
|---|
| 285 | SUFF_LIB := .lib
|
|---|
| 286 | SUFF_DLL := .dll
|
|---|
| 287 | SUFF_EXE := .exe
|
|---|
| [86] | 288 | SUFF_SYS := .sys
|
|---|
| [73] | 289 | SUFF_RES := .res
|
|---|
| 290 | endif
|
|---|
| 291 | ifeq ($(BUILD_TARGET),win32)
|
|---|
| 292 | SUFF_OBJ := .obj
|
|---|
| 293 | SUFF_LIB := .lib
|
|---|
| 294 | SUFF_DLL := .dll
|
|---|
| 295 | SUFF_EXE := .exe
|
|---|
| [86] | 296 | SUFF_SYS := .sys
|
|---|
| [73] | 297 | SUFF_RES := .res
|
|---|
| 298 | endif
|
|---|
| 299 | ifeq ($(BUILD_TARGET),linux)
|
|---|
| 300 | SUFF_OBJ := .o
|
|---|
| 301 | SUFF_LIB := .a
|
|---|
| 302 | SUFF_DLL := .so
|
|---|
| 303 | SUFF_EXE :=
|
|---|
| [86] | 304 | SUFF_SYS := .a
|
|---|
| [73] | 305 | SUFF_RES :=
|
|---|
| 306 | endif
|
|---|
| [296] | 307 | ifeq ($(BUILD_TARGET),l4)
|
|---|
| 308 | SUFF_OBJ := .o
|
|---|
| 309 | SUFF_LIB := .a
|
|---|
| 310 | SUFF_DLL := .s.so
|
|---|
| 311 | SUFF_EXE :=
|
|---|
| 312 | SUFF_SYS := .a
|
|---|
| 313 | SUFF_RES :=
|
|---|
| 314 | endif
|
|---|
| [69] | 315 |
|
|---|
| 316 | #
|
|---|
| 317 | # Standard kBuild tools.
|
|---|
| 318 | #
|
|---|
| 319 | DEP := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE)
|
|---|
| [262] | 320 | DEP_PRE := $(PATH_TOOLS)/kDepPre$(HOSTSUFF_EXE)
|
|---|
| [233] | 321 | ifeq ($(MAKE),kmk)
|
|---|
| 322 | MAKE := $(PATH_TOOLS)/kmk$(HOSTSUFF_EXE)
|
|---|
| 323 | endif
|
|---|
| 324 |
|
|---|
| [69] | 325 | # Standard Unix shell utils.
|
|---|
| [230] | 326 | ifdef KMK_BUILTIN
|
|---|
| 327 | ECHO := kmk_builtin_echo
|
|---|
| 328 | MKDIR := kmk_builtin_mkdir
|
|---|
| 329 | RM := kmk_builtin_rm
|
|---|
| 330 | CP := kmk_builtin_cp
|
|---|
| 331 | else
|
|---|
| 332 | ECHO := echo
|
|---|
| [69] | 333 | MKDIR := $(PATH_TOOLS)/mkdir$(HOSTSUFF_EXE)
|
|---|
| 334 | RM := $(PATH_TOOLS)/rm$(HOSTSUFF_EXE)
|
|---|
| [87] | 335 | CP := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE)
|
|---|
| [230] | 336 | endif
|
|---|
| [237] | 337 | CP_EXT := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE)
|
|---|
| [87] | 338 | MV := $(PATH_TOOLS)/mv$(HOSTSUFF_EXE)
|
|---|
| [69] | 339 | SED := $(PATH_TOOLS)/sed$(HOSTSUFF_EXE)
|
|---|
| 340 | CAT := $(PATH_TOOLS)/cat$(HOSTSUFF_EXE)
|
|---|
| 341 | # Bourn shell clone.
|
|---|
| 342 | MAKESHELL := $(PATH_TOOLS)/ash$(HOSTSUFF_EXE)
|
|---|
| 343 | SHELL := $(MAKESHELL)
|
|---|
| 344 | export SHELL MAKESHELL
|
|---|
| 345 |
|
|---|
| 346 |
|
|---|
| 347 | #
|
|---|
| [73] | 348 | # Message macros.
|
|---|
| [204] | 349 | #
|
|---|
| 350 |
|
|---|
| [73] | 351 | ifndef BUILD_QUIET
|
|---|
| [75] | 352 | ifdef BUILD_DEBUG
|
|---|
| 353 | BUILD_VERBOSE := 9
|
|---|
| 354 | endif
|
|---|
| [230] | 355 | MSG_L1 = @$(ECHO) "kBuild: $1"
|
|---|
| [73] | 356 | ifdef BUILD_VERBOSE
|
|---|
| [230] | 357 | MSG_L2 = @$(ECHO) "kBuild: $1"
|
|---|
| [75] | 358 | QUIET :=
|
|---|
| [73] | 359 | else
|
|---|
| [75] | 360 | QUIET := @
|
|---|
| [73] | 361 | MSG_L2 =
|
|---|
| 362 | endif
|
|---|
| 363 | ifdef BUILD_DEBUG
|
|---|
| [230] | 364 | MSG_L3 = @$(ECHO) "kBuild: $1"
|
|---|
| [73] | 365 | else
|
|---|
| 366 | MSG_L3 =
|
|---|
| 367 | endif
|
|---|
| 368 | else
|
|---|
| [75] | 369 | QUIET :=
|
|---|
| [73] | 370 | MSG_L1 =
|
|---|
| 371 | MSG_L2 =
|
|---|
| 372 | MSG_L3 =
|
|---|
| 373 | endif
|
|---|
| 374 |
|
|---|
| [130] | 375 | ## ABSPATH - make paths absolute.
|
|---|
| [129] | 376 | # This implementation is clumsy and doesn't resolve '..' and '.' components.
|
|---|
| [73] | 377 | #
|
|---|
| [129] | 378 | # @param $1 The paths to make absolute.
|
|---|
| 379 | ABSPATH = $(foreach path,$(1)\
|
|---|
| 380 | ,$(strip $(if $(subst <,,$(firstword $(subst /, ,<$(path)))),\
|
|---|
| 381 | $(if $(patsubst %:,,$(firstword $(subst :,: ,$(path)))),$(PATH_CURRENT)/$(path),$(path)),\
|
|---|
| 382 | $(path))))
|
|---|
| [130] | 383 | ## DIRDEP - make create directory dependencies.
|
|---|
| 384 | #
|
|---|
| 385 | # @param $1 The paths to the directories which must be created.
|
|---|
| 386 | DIRDEP = $(foreach path,$(1),$(path)/.dir_created)
|
|---|
| [129] | 387 |
|
|---|
| [204] | 388 |
|
|---|
| [129] | 389 | ## Cygwin kludge.
|
|---|
| 390 | # This converts /cygdrive/x/% to x:%.
|
|---|
| 391 | #
|
|---|
| 392 | # @param $1 The paths to make native.
|
|---|
| 393 | # @remark This macro is pretty much obsolete since we don't use cygwin base make.
|
|---|
| 394 | ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
|
|---|
| 395 | CYGPATHMIXED = $(foreach path,$(1)\
|
|---|
| 396 | ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
|
|---|
| 397 | else
|
|---|
| 398 | CYGPATHMIXED = $(1)
|
|---|
| 399 | endif
|
|---|
| 400 |
|
|---|
| 401 | #
|
|---|
| [69] | 402 | # This is how we find the closest config.kmk.
|
|---|
| 403 | # It's a little hacky but I think it works fine.
|
|---|
| [70] | 404 | #
|
|---|
| 405 | _CFGDIR := .
|
|---|
| [78] | 406 | _CFGFILES := ./Config.kmk ./config.kmk
|
|---|
| [69] | 407 | define def_include_config
|
|---|
| [78] | 408 | $(eval _CFGDIR := $(_CFGDIR)/$(dir))
|
|---|
| 409 | _CFGFILES += $(_CFGDIR)/Config.kmk $(_CFGDIR)/config.kmk
|
|---|
| [69] | 410 | endef
|
|---|
| 411 | # walk down the _RELATIVE_ path specified by DEPTH.
|
|---|
| [78] | 412 | $(foreach dir,$(subst /, ,$(DEPTH)), $(eval $(def_include_config)) )
|
|---|
| [69] | 413 | # add the default config file.
|
|---|
| [78] | 414 | _CFGFILE := $(firstword $(wildcard $(_CFGFILES) $(FILE_KBUILD_CONFIG)))
|
|---|
| [69] | 415 | _CFGFILES :=
|
|---|
| 416 | _CFGDIR :=
|
|---|
| 417 |
|
|---|
| 418 | # Include the config.kmk we found file (or the default one).
|
|---|
| 419 | include $(_CFGFILE)
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 | # end-of-file-content
|
|---|
| [72] | 423 | __header_kmk__ := 1
|
|---|
| [69] | 424 | endif # __header_kmk__
|
|---|