Changeset 2531


Ignore:
Timestamp:
Aug 2, 2011, 2:07:35 PM (14 years ago)
Author:
bird
Message:

header.kmk,footer*.kmk: Made sure that paths are absolute (KB_FN_ASSERT_ABSPATH w/ KBUILD_INTERNAL_STRICT=1). This may break dependencies on installed files.

Location:
trunk/kBuild
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer-pass2-compiling-targets.kmk

    r2523 r2531  
    134134# @param    $($(target)_CMDS_PREV_) The link commands from the previous run.
    135135define def_link_rule
     136$$(call KB_FN_ASSERT_ABSPATH,out)
    136137ifndef NO_LINK_CMDS_DEPS
    137138$(out): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $$@),FORCE)
     
    170171#                      pre_install_cmds, post_install_cmds
    171172define def_link_install_rule
     173$$(call KB_FN_ASSERT_ABSPATH,$(target)_1_INST_TARGET)
    172174$($(target)_1_INST_TARGET): $(out) | $$$$(dir $$$$@)
    173175        %$$(call MSG_INST_TRG,$(target),$(out),$$@)
     
    184186#                      pre_install_cmds, post_install_cmds
    185187define def_link_stage_rule
     188$$(call KB_FN_ASSERT_ABSPATH,$(target)_1_STAGE_TARGET)
    186189$($(target)_1_STAGE_TARGET): $(out) | $$$$(dir $$$$@)
    187190        %$$(call MSG_INST_TRG,$(target),$(out),$$@)
     
    388391define def_link_install_debug_dir_rule
    389392local dir := $(debug_inst_path)/$(debug_inst)$(debug_dir)
     393$$(call KB_FN_ASSERT_ABSPATH,dir)
    390394$$(dir): | $$$$(dir $$$$(patsubst %/,%,$$$$@))
    391395        %$$(call MSG_INST_DIR,$$@)
     
    395399
    396400##
    397 # Install a debug file. 
     401# Install a debug file.
    398402# @param    debug_file          Src=>Dst file pair.
    399403define def_link_install_debug_file_rule
    400404local dst := $(debug_inst_path)/$(debug_inst)$(word 2, $(subst =>,$(SP),$(debug_file)))
    401 $$(dst): $(word 1, $(subst =>,$(SP),$(debug_file))) | $$$$(dir $$$$@)
     405$$(call KB_FN_ASSERT_ABSPATH,dst)
     406local src := $(word 1, $(subst =>,$(SP),$(debug_file)))
     407$$(call KB_FN_ASSERT_ABSPATH,src)
     408$$(dst): $$(src) | $$$$(dir $$$$@)
    402409        %$$(call MSG_INST_FILE,$$@,$$<)
    403410        $$(QUIET)$(debug_install_cmd) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $$< $$@
     
    406413
    407414##
    408 # Install debug info to $(debug_inst), where debug_inst can be a directory or 
     415# Install debug info to $(debug_inst), where debug_inst can be a directory or
    409416# file (just like $(inst) and $(stage).  Used for both staging and installing.
    410417define def_target_install_only_debug
    411418if "$(substr $(debug_inst),-1,1)" == "/"
    412419 if "$(debug_inst)" == "./"
    413   local debug_inst := 
     420  local debug_inst :=
    414421 endif
    415422 local debug_dirs  := $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_DIRS))
  • trunk/kBuild/footer-pass2-installs.kmk

    r2530 r2531  
    4141#
    4242define def_install_src_rule_staging
     43$$(call KB_FN_ASSERT_ABSPATH, stagedst)
     44$$(call KB_FN_ASSERT_ABSPATH, srcsrc)
    4345$(stagedst) : $(srcsrc) | $(dir $(stagedst))
    4446        %$$(call MSG_INST_FILE,$(srcsrc),$(stagedst))
     
    4850
    4951define def_install_src_rule_installing
     52$$(call KB_FN_ASSERT_ABSPATH, instdst)
     53$$(call KB_FN_ASSERT_ABSPATH, srcsrc)
    5054$(instdst) : $(srcsrc) | $(dir $(instdst))
    5155        %$$(call MSG_INST_FILE,$(srcsrc),$(instdst))
     
    7276local srcsrc    := $(firstword $(srcdst))
    7377local srcdstdir := $(dir $(word 2,$(srcdst)))
     78ifeq ($(srcdstdir),./)
     79 local srcdstdir:=
     80endif
    7481local srcdst    := $(word $(words $(srcdst)),$(srcdst))
    7582
     
    234241#
    235242define def_install_symlink_rule_staging
     243$$(call KB_FN_ASSERT_ABSPATH, stagedst)
    236244$(stagedst) : | $(dir $(stagedst))
    237245        %$$(call MSG_INST_SYM,$(stagedst),$(symdst))
     
    242250
    243251define def_install_symlink_rule_installing
     252$$(call KB_FN_ASSERT_ABSPATH, instdst)
    244253$(instdst) : | $(dir $(instdst))
    245254        %$$(call MSG_INST_SYM,$(instdst),$(symdst))
     
    319328#
    320329define def_install_directory_rule
    321 # the install rule
     330$$(call KB_FN_ASSERT_ABSPATH, insdst)
    322331$(insdst):
    323332        %$$(call MSG_INST_DIR,$(insdst))
  • trunk/kBuild/header.kmk

    r2528 r2531  
    847847else
    848848 KB_FN_ASSIGN_DEPRECATED = $(eval $(subst :,$$(COLON),$1) = $2$$(warning $1 is deprecated, use $3 instead))
     849endif
     850
     851##
     852# Throw an error if the given path $1 isn't absolute and assertions are enabled.
     853#
     854# @param   $1   The name of the path variable to check.
     855#
     856ifdef KBUILD_INTERNAL_STRICT
     857 KB_FN_ASSERT_ABSPATH = $(if-expr "$(abspath $($(strip $1)))" != "$(strip $($(strip $1)))",\
     858        $(error kBuild abspath assertion failed: target=$(target) $1=$($(strip $1))))
     859else
     860 KB_FN_ASSERT_ABSPATH :=
    849861endif
    850862
Note: See TracChangeset for help on using the changeset viewer.