Ignore:
Timestamp:
Dec 17, 2006, 9:12:30 AM (19 years ago)
Author:
bird
Message:

set PATH_target early (i.e. in subheader/subfooter).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/header.kmk

    r742 r743  
    441441LN_SYMLINK  := $(LN) -s
    442442
     443
     444#
     445# Some Functions.
     446# The lower cased ones are either fallbacks or candidates for functions.c.
     447#
     448
    443449## ABSPATH - make paths absolute.
    444450# This implementation is clumsy and doesn't resolve '..' and '.' components.
     
    453459DIRDEP = $(foreach path,$(patsubst %/,%,$(1)),$(path)/)
    454460
    455 
    456461## Cygwin kludge.
    457462# This converts /cygdrive/x/% to x:%.
     
    460465# @remark       This macro is pretty much obsolete since we don't use cygwin base make.
    461466ifneq ($(patsubst /cygdrive/%,%,$(CURDIR)),$(CURDIR))
    462 CYGPATHMIXED = $(foreach path,$(1)\
     467 CYGPATHMIXED = $(foreach path,$(1)\
    463468   ,$(if $(patsubst /cygdrive/%,,$(path)),$(path),$(patsubst $(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path)))))/%,$(strip $(firstword $(subst /, ,$(patsubst /cygdrive/%,%,$(path))))):/%,$(patsubst /cygdrive/%,%,$(path)))))
    464469else
    465 CYGPATHMIXED = $(1)
    466 endif
    467 
    468 
    469 ifneq ($(filter stack,$(KMK_FEATURES)),stack) ## @todo retire this to gnumake-header.kmk when all the programs have been recompiled.
    470 ##
    471 # Pushes an item onto a 'stack' variable.
    472 # @param    $1   The stack variable name
    473 # @param    $2   What to push.
    474 stack-push = $(eval $1 +=$2)
    475 
    476 ##
    477 # Removes the top element from a 'stack' variable.
    478 # @returns  The popped element
    479 # @param    $1   The stack variable name
    480 stack-pop  = $(call stack-top,$1)$(call stack-popv,$1)
    481 
    482 ##
    483 # Removes the top element from a 'stack' variable.
    484 # This does *NOT* return the top element, use
    485 # @param    $1   The stack variable name
    486 # @remark This ain't very fast (that's why it's implemented in functions.c in kmk).
    487 stack-popv = $(eval $1:=$(wordlist 1,$(words $(wordlist 2,9999,$($1))),$($1)))
    488 
    489 ##
    490 # Retrieves the top element from the 'stack' variable.
    491 # @param    $1   The stack variable name
    492 stack-top  = $(lastword $($1))
    493 endif
     470 CYGPATHMIXED = $(1)
     471endif
     472
     473ifneq ($(filter abspathex,$(KMK_FEATURES)),abspathex) ## @todo Retire this to gnumake-header.kmk when it has been implemented.
     474## Converts an relative path to an absolute path using the given CWD.
     475# @returns absolute path.
     476# @param    $1      The path to fixup.
     477# @param    $2      The CWD to use.
     478abspathex = $(foreach _fix_path,$1\
     479,$(if $(subst :$(call no-root-slash,$(call no-drive,$(_fix_path))):,,:$(_fix_path):),$(_fix_path),$(abspath $2/$(_fix_path))))
     480endif
     481
     482## Removes the drive letter from a path (if it has one)
     483# @param        $1              the path
     484no-drive    = $(word $(words $(subst :, ,$(1))),$(subst :, ,$(1)))
     485
     486## Removes the root slash from a path (if it has one)
     487# @param        $1              the path
     488no-root-slash = $(patsubst /%,%,$(1))
     489
     490## Figure out where to put object files.
     491# @param    $1      real target name.
     492# @param    $2      normalized main target
     493TARGET_BASE = $(PATH_TARGET)/$(2)/$(call no-root-slash,$(call no-drive,$(basename $(1))))
     494
     495## Figure out where to put object files.
     496# @param    $1      normalized main target
     497TARGET_PATH = $(PATH_TARGET)/$(1)
    494498
    495499
Note: See TracChangeset for help on using the changeset viewer.