VirtualBox

Changeset 2523 in kBuild


Ignore:
Timestamp:
Jul 31, 2011 11:45:20 PM (13 years ago)
Author:
bird
Message:

kBuild: debug info installation support, core hacking + mac os x.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r2506 r2523  
    327327 endif
    328328endif
     329if1of ($(KBUILD_TARGET), darwin win)
     330 TEMPLATE_BIN_LD_DEBUG = split
     331endif
    329332
    330333#
  • trunk/kBuild/footer-misc.kmk

    r2521 r2523  
    6868# DIRECTORIES
    6969#
    70 _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES) $(_STAGE_FILES)))
    71 $(foreach directory,$(_INSTALLS_DIRS) $(_STAGE_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
     70_DIR_ALL := $(sort \
     71    $(addsuffix /,$(patsubst %/,%,$(_DIRS) )) \
     72    $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES) $(_DEBUG_INSTALL_FILES) $(_STAGE_FILES) $(_DEBUG_STAGE_FILES) ) \
     73    $(foreach path, $(KBUILD_INST_PATHS), $(PATH_INS)/$(INST_$(path)) $(PATH_STAGE)/$(STAGE_$(path)) ) \
     74    $(dir $(patsubst %/,%, $(_INSTALLS_DIRS) $(_STAGE_DIRS) $(_DEBUG_INSTALL_DIRS) $(_DEBUG_STAGE_DIRS)) ) \
     75    )
     76$(foreach directory, \
     77    $(_INSTALLS_DIRS) \
     78    $(_STAGE_DIRS) \
     79    $(_DEBUG_INSTALL_DIRS) \
     80    $(_DEBUG_STAGE_DIRS) \
     81    , $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))) )
    7282
    7383
  • trunk/kBuild/footer-pass1.kmk

    r2521 r2523  
    8585# Staging and install directory target variables.
    8686local insttype := $(firstword \
    87         $($(target)_INSTTYPE) \
    88         $($(target)_INSTTYPE.$(bld_trg)) \
     87        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
    8988        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
    90         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     89        $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
    9190        $($(target)_INSTTYPE.$(bld_trg_arch)) \
    9291        $($(target)_INSTTYPE.$(bld_trg_cpu)) \
     92        $($(target)_INSTTYPE.$(bld_trg)) \
    9393        $($(target)_INSTTYPE.$(bld_type)) \
     94        $($(target)_INSTTYPE) \
    9495        )
    9596ifeq ($(insttype),)
     
    113114
    114115if1of ($(insttype), stage both)
     116 local inst := $(strip $(firstdefined \
     117        $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
     118        $(target)_INST.$(bld_trg).$(bld_trg_arch) \
     119        $(target)_INST.$(bld_trg).$(bld_type) \
     120        $(target)_INST.$(bld_trg_arch) \
     121        $(target)_INST.$(bld_trg_cpu) \
     122        $(target)_INST.$(bld_trg) \
     123        $(target)_INST.$(bld_type) \
     124        $(target)_INST \
     125        definst \
     126        ,value))
    115127 local stage := $(strip $(firstdefined \
    116128        $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
    117         $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
    118129        $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
    119         $(target)_INST.$(bld_trg).$(bld_trg_arch) \
    120130        $(target)_STAGE.$(bld_trg).$(bld_type) \
    121         $(target)_INST.$(bld_trg).$(bld_type) \
    122131        $(target)_STAGE.$(bld_trg_arch) \
    123         $(target)_INST.$(bld_trg_arch) \
     132        $(target)_STAGE.$(bld_trg_cpu) \
    124133        $(target)_STAGE.$(bld_trg) \
    125         $(target)_INST.$(bld_trg) \
    126134        $(target)_STAGE.$(bld_type) \
    127         $(target)_INST.$(bld_type) \
    128135        $(target)_STAGE \
    129         $(target)_INST \
    130         definst \
     136        inst \
    131137        ,value))
    132138 $(target)_1_STAGE := $(stage)
     
    145151
    146152if1of ($(insttype), both)
    147  local inst := $(strip $(firstdefined \
    148         $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
    149         $(target)_INST.$(bld_trg).$(bld_trg_arch) \
    150         $(target)_INST.$(bld_trg).$(bld_type) \
    151         $(target)_INST.$(bld_trg_arch) \
    152         $(target)_INST.$(bld_trg) \
    153         $(target)_INST.$(bld_type) \
    154         $(target)_INST \
    155         definst \
    156         ,value))
    157153 $(target)_1_INST := $(inst)
    158154 if "$(substr $(inst),-1,1)" == "/" # Multicast support requires addprefix/suffix.
     
    167163 $(target)_1_INST_TARGET :=
    168164endif
     165
     166# Debug info related stuff.
     167local debug_insttype := $(firstword \
     168        $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     169        $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
     170        $($(target)_DEBUG_INSTTYPE.$(bld_trg).$(bld_type)) \
     171        $($(target)_DEBUG_INSTTYPE.$(bld_trg_arch)) \
     172        $($(target)_DEBUG_INSTTYPE.$(bld_trg_cpu)) \
     173        $($(target)_DEBUG_INSTTYPE.$(bld_trg)) \
     174        $($(target)_DEBUG_INSTTYPE.$(bld_type)) \
     175        $($(target)_DEBUG_INSTTYPE) \
     176        $(insttype) )
     177ifn1of ($(debug_insttype), none both stage)
     178 $(error kBuild: Unknown value '$(debug_insttype)' for '$(target)_DEBUG_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
     179endif
     180$(target)_1_DEBUG_INSTTYPE := $(debug_insttype)
     181
     182if1of ($(debug_insttype), stage both)
     183 ifn1of ($(insttype), stage both)
     184  $(error kBuild: DEBUG_INSTTYPE=$(debug_insttype) and INSTTYPE=$(insttype) for target '$(target)' are not compatible)
     185 endif
     186 local debug_stage := $(firstdefined \
     187        $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
     188        $(target)_DEBUG_STAGE.$(bld_trg).$(bld_trg_arch) \
     189        $(target)_DEBUG_STAGE.$(bld_trg).$(bld_type) \
     190        $(target)_DEBUG_STAGE.$(bld_trg_arch) \
     191        $(target)_DEBUG_STAGE.$(bld_trg_cpu) \
     192        $(target)_DEBUG_STAGE.$(bld_trg) \
     193        $(target)_DEBUG_STAGE.$(bld_type) \
     194        $(target)_DEBUG_STAGE \
     195        $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
     196        $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
     197        $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
     198        $(target)_DEBUG_INST.$(bld_trg_arch) \
     199        $(target)_DEBUG_INST.$(bld_trg_cpu) \
     200        $(target)_DEBUG_INST.$(bld_trg) \
     201        $(target)_DEBUG_INST.$(bld_type) \
     202        $(target)_DEBUG_INST)
     203 ifneq ($(debug_stage),)
     204  $(target)_1_DEBUG_STAGE := $($(debug_stage))
     205 else
     206  $(target)_1_DEBUG_STAGE := $(addprefix $(STAGE_DEBUG),$(stage))
     207 endif
     208 ifndef $(target)_1_DEBUG_STAGE
     209  $(target)_1_DEBUG_STAGE := ./
     210 endif
     211else
     212 $(target)_1_DEBUG_STAGE :=
     213endif
     214
     215if1of ($(debug_insttype), both)
     216 ifn1of ($(insttype), both)
     217  $(error kBuild: DEBUG_INSTTYPE=$(debug_insttype) and INSTTYPE=$(insttype) for target '$(target)' are not compatible)
     218 endif
     219 local debug_inst := $(firstdefined \
     220        $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
     221        $(target)_DEBUG_INST.$(bld_trg).$(bld_trg_arch) \
     222        $(target)_DEBUG_INST.$(bld_trg).$(bld_type) \
     223        $(target)_DEBUG_INST.$(bld_trg_arch) \
     224        $(target)_DEBUG_INST.$(bld_trg_cpu) \
     225        $(target)_DEBUG_INST.$(bld_trg) \
     226        $(target)_DEBUG_INST.$(bld_type) \
     227        $(target)_DEBUG_INST)
     228 ifneq ($(debug_inst),)
     229  $(target)_1_DEBUG_INST := $($(debug_inst))
     230 else
     231  $(target)_1_DEBUG_INST := $(addprefix $(INST_DEBUG),$(inst))
     232 endif
     233 ifndef $(target)_1_DEBUG_INST
     234  $(target)_1_DEBUG_INST := ./
     235 endif
     236else
     237 $(target)_1_DEBUG_INST :=
     238endif
     239#$(warning $(NLTAB)$(target)_1_DEBUG_INST=$($(target)_1_DEBUG_INST)$(NLTAB)$(target)_1_DEBUG_STAGE=$($(target)_1_DEBUG_STAGE)$(NLTAB)insttype=$(insttype)$(NLTAB)debug_insttype=$(debug_insttype))
    169240
    170241endef # def_pass1_link_common
     
    292363# Determine and set 1_INSTTYPE.
    293364local insttype := $(firstword \
    294         $($(target)_INSTTYPE) \
    295         $($(target)_INSTTYPE.$(bld_trg)) \
     365        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
    296366        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
    297         $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     367        $($(target)_INSTTYPE.$(bld_trg).$(bld_type)) \
    298368        $($(target)_INSTTYPE.$(bld_trg_arch)) \
    299369        $($(target)_INSTTYPE.$(bld_trg_cpu)) \
     370        $($(target)_INSTTYPE.$(bld_trg)) \
    300371        $($(target)_INSTTYPE.$(bld_type)) \
     372        $($(target)_INSTTYPE) \
    301373        )
    302374ifeq ($(insttype),)
     
    323395 local stage := $(strip $(firstdefined \
    324396        $(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type) \
     397        $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
     398        $(target)_STAGE.$(bld_trg).$(bld_type) \
     399        $(target)_STAGE.$(bld_trg_arch) \
     400        $(target)_STAGE.$(bld_trg_cpu) \
     401        $(target)_STAGE.$(bld_trg) \
     402        $(target)_STAGE.$(bld_type) \
     403        $(target)_STAGE \
    325404        $(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type) \
    326         $(target)_STAGE.$(bld_trg).$(bld_trg_arch) \
    327405        $(target)_INST.$(bld_trg).$(bld_trg_arch) \
    328         $(target)_STAGE.$(bld_trg).$(bld_type) \
    329406        $(target)_INST.$(bld_trg).$(bld_type) \
    330         $(target)_STAGE.$(bld_trg_arch) \
    331407        $(target)_INST.$(bld_trg_arch) \
    332         $(target)_STAGE.$(bld_trg) \
     408        $(target)_INST.$(bld_trg_cpu) \
    333409        $(target)_INST.$(bld_trg) \
    334         $(target)_STAGE.$(bld_type) \
    335410        $(target)_INST.$(bld_type) \
    336         $(target)_STAGE \
    337411        $(target)_INST \
    338412        definst \
     
    353427        $(target)_INST.$(bld_trg).$(bld_type) \
    354428        $(target)_INST.$(bld_trg_arch) \
     429        $(target)_INST.$(bld_trg_cpu) \
    355430        $(target)_INST.$(bld_trg) \
    356431        $(target)_INST.$(bld_type) \
  • trunk/kBuild/footer-pass2-compiling-targets.kmk

    r2521 r2523  
    137137$(out): .MUST_MAKE = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $$@),FORCE)
    138138endif
    139 $(out) + $($(target)_2_OUTPUT) +| $($(target)_2_OUTPUT_MAYBE) : \
     139$(out) \
     140+ $($(target)_2_OUTPUT) \
     141+ $($(target)_2_OUTPUT_DEBUG_FILES) \
     142+ $($(target)_2_OUTPUT_DEBUG_DIRS) \
     143+| $($(target)_2_OUTPUT_MAYBE) : \
    140144                $$$$($(target)_2_DEPEND) \
    141145                $(value _DEP_LINK_CMDS) \
     
    143147                $$$$($(target)_2_DEPORD)
    144148        %$$(call MSG_LINK,$(target),$$@,$(tool_do))
    145         $$(QUIET)$$(RM) -f -- $(dep) $(out) $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE)
     149        $$(QUIET)$$(RM) -f -- $(dep) $(out) $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $($(target)_2_OUTPUT_DEBUG_FILES)
     150ifdef $(target)_2_OUTPUT_DEBUG_DIRS
     151        $$(QUIET)$$(RM) -Rf -- $($(target)_2_OUTPUT_DEBUG_DIRS)
     152endif
    146153
    147154$(cmds)
     
    281288#
    282289# @param   1            The property name.
     290# @param   2            The default property name, empty if none.
     291# @param   3            What to return if all variables are empty. (optional)
    283292# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
    284293# @returns Expanded property value.
    285294#
    286 ## @todo bld_trg_cpu is missing here.
    287295define def_fn_prop_get_first_defined
    288 ifdef $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)
    289  local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
    290 else ifdef $(target)_$(1).$(bld_trg).$(bld_trg_arch)
    291  local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_trg_arch))
    292 else ifdef $(target)_$(1).$(bld_trg).$(bld_type)
    293  local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_type))
    294 else ifdef $(target)_$(1).$(bld_trg_arch)
    295  local .RETURN := $($(target)_$(1).$(bld_trg_arch))
    296 else ifdef $(target)_$(1).$(bld_trg)
    297  local .RETURN := $($(target)_$(1).$(bld_trg))
    298 else ifdef $(target)_$(1).$(bld_type)
    299  local .RETURN := $($(target)_$(1).$(bld_type))
    300 else ifdef $(target)_$(1)
    301  local .RETURN := $($(target)_$(1))
    302 else ifdef $(1).$(bld_trg).$(bld_trg_arch).$(bld_type)
    303  local .RETURN := $($(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
    304 else ifdef $(1).$(bld_trg).$(bld_trg_arch)
    305  local .RETURN := $($(1).$(bld_trg).$(bld_trg_arch))
    306 else ifdef $(1).$(bld_trg).$(bld_type)
    307  local .RETURN := $($(1).$(bld_trg).$(bld_type))
    308 else ifdef $(1).$(bld_trg_arch)
    309  local .RETURN := $($(1).$(bld_trg_arch))
    310 else ifdef $(1).$(bld_trg)
    311  local .RETURN := $($(1).$(bld_trg))
    312 else ifdef $(1).$(bld_type)
    313  local .RETURN := $($(1).$(bld_type))
     296local .RETURN := $(firstdefined \
     297    $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
     298    $(target)_$(1).$(bld_trg).$(bld_trg_arch) \
     299    $(target)_$(1).$(bld_trg).$(bld_type) \
     300    $(target)_$(1).$(bld_trg_cpu) \
     301    $(target)_$(1).$(bld_trg_arch) \
     302    $(target)_$(1).$(bld_trg) \
     303    $(target)_$(1).$(bld_type) \
     304    $(target)_$(1) \
     305)
     306ifeq ($(.RETURN),)
     307 ifneq ($(2),)
     308  local .RETURN := $(firstdefined \
     309    $(2).$(bld_trg).$(bld_trg_arch).$(bld_type) \
     310    $(2).$(bld_trg).$(bld_trg_arch) \
     311    $(2).$(bld_trg).$(bld_type) \
     312    $(2).$(bld_trg_cpu) \
     313    $(2).$(bld_trg_arch) \
     314    $(2).$(bld_trg) \
     315    $(2).$(bld_type) \
     316    $(2) \
     317    3 \
     318  )
     319 else
     320  local .RETURN := $(firstdefined \
     321    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
     322    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch) \
     323    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type) \
     324    kBuildGlobalDefaults_$(1).$(bld_trg_cpu) \
     325    kBuildGlobalDefaults_$(1).$(bld_trg_arch) \
     326    kBuildGlobalDefaults_$(1).$(bld_trg) \
     327    kBuildGlobalDefaults_$(1).$(bld_type) \
     328    kBuildGlobalDefaults_$(1) \
     329    3 \
     330  )
     331 endif
     332endif
     333local .RETURN := $(strip $($(.RETURN)))
     334endef # def_fn_prop_get_first_defined
     335
     336##
     337# Function for getting the first property value (ignoring empty defines).
     338#
     339# @param   1            The property name.
     340# @param   2            The default property name, empty if none.
     341# @param   3            What to return if all variables are empty. (optional)
     342# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
     343# @returns First word.
     344#
     345define def_fn_prop_get_first_word
     346local .RETURN := $(firstword \
     347    $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     348    $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
     349    $($(target)_$(1).$(bld_trg).$(bld_type)) \
     350    $($(target)_$(1).$(bld_trg_cpu)) \
     351    $($(target)_$(1).$(bld_trg_arch)) \
     352    $($(target)_$(1).$(bld_trg)) \
     353    $($(target)_$(1).$(bld_type)) \
     354    $($(target)_$(1)) \
     355)
     356ifeq ($(.RETURN),)
     357 ifneq ($(2),)
     358  local .RETURN := $(firstword \
     359    $($(2).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     360    $($(2).$(bld_trg).$(bld_trg_arch)) \
     361    $($(2).$(bld_trg).$(bld_type)) \
     362    $($(2).$(bld_trg_cpu)) \
     363    $($(2).$(bld_trg_arch)) \
     364    $($(2).$(bld_trg)) \
     365    $($(2).$(bld_type)) \
     366    $($(2)) \
     367    $(3) \
     368  )
     369 else
     370  local .RETURN := $(firstword \
     371    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     372    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch)) \
     373    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type)) \
     374    $(kBuildGlobalDefaults_$(1).$(bld_trg_cpu)) \
     375    $(kBuildGlobalDefaults_$(1).$(bld_trg_arch)) \
     376    $(kBuildGlobalDefaults_$(1).$(bld_trg)) \
     377    $(kBuildGlobalDefaults_$(1).$(bld_type)) \
     378    $(kBuildGlobalDefaults_$(1)) \
     379    $(3) \
     380  )
     381 endif
     382endif
     383endef # def_fn_prop_get_first_word
     384
     385##
     386# Install a debug directory.
     387# @param    debug_dir           The directory name.
     388define def_link_install_debug_dir_rule
     389local dir := $(debug_inst_path)/$(debug_inst)$(debug_dir)
     390$$(dir): | $$$$(dir $$$$(patsubst %/,%,$$$$@))
     391        %$$(call MSG_INST_DIR,$$@)
     392        $$(QUIET)$$(MKDIR) -p -- $$@
     393$(target)_2_DEBUG_$(debug_var)_TARGET_DIRS += $$(dir)
     394endef # def_link_install_debug_dir_rule
     395
     396##
     397# Install a debug file.
     398# @param    debug_file          Src=>Dst file pair.
     399define def_link_install_debug_file_rule
     400local dst := $(debug_inst_path)/$(debug_inst)$(word 2, $(subst =>,$(SP),$(debug_file)))
     401$$(dst): $(word 1, $(subst =>,$(SP),$(debug_file))) | $$$$(dir $$$$@)
     402        %$$(call MSG_INST_FILE,$$@,$$<)
     403        $$(QUIET)$(debug_install_cmd) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $$< $$@
     404$(target)_2_DEBUG_$(debug_var)_TARGET_FILES += $$(dst)
     405endef # def_link_install_debug_file_rule
     406
     407##
     408# Install debug info to $(debug_inst), where debug_inst can be a directory or
     409# file (just like $(inst) and $(stage).  Used for both staging and installing.
     410define def_target_install_only_debug
     411if "$(substr $(debug_inst),-1,1)" == "/"
     412 if "$(debug_inst)" == "./"
     413  local debug_inst :=
     414 endif
     415 local debug_dirs  := $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_DIRS))
     416 ifneq ($(strip $(root $(debug_dirs))),)
     417  $(error kBuild: Bad tool? debug_dirs='$(debug_dirs)', expected all to be under '$(outbase)')
     418 endif
     419 local debug_files := $(foreach file, $(patsubst $($(target)_0_OUTDIR)/%,%,$($(target)_2_OUTPUT_DEBUG_FILES)) \
     420                        ,$($(target)_0_OUTDIR)/$(file)=>$(file))
    314421else
    315  local .RETURN := $($(1))
    316 endif
    317 endef # def_fn_prop_get_first_defined
     422 local debug_files := $(call TOOL_$(tool)_$(tool_do)_DEBUG_INSTALL_FN,$(out),$(outbase),$(debug_inst))
     423 local debug_dirs  := $(filter     %/,$(debug_files))
     424 local debug_files := $(filter-out %/,$(debug_files))
     425endif
     426$(foreach debug_dir, $(debug_dirs), $(eval $(def_link_install_debug_dir_rule)))
     427$(foreach debug_file, $(debug_files), $(eval $(def_link_install_debug_file_rule)))
     428endef
    318429
    319430
     
    365476 $(typevar) += $(out)
    366477endif # INSTTYPE == none
     478
     479# Install debug info.
     480$(target)_2_DEBUG_STAGE_TARGET_DIRS :=
     481$(target)_2_DEBUG_STAGE_TARGET_FILES :=
     482$(target)_2_DEBUG_INSTALL_TARGET_DIRS :=
     483$(target)_2_DEBUG_INSTALL_TARGET_FILES :=
     484
     485if  (   defined($(target)_2_OUTPUT_DEBUG_DIRS) \
     486     || defined($(target)_2_OUTPUT_DEBUG_FILES) ) \
     487 && "$($(target)_1_DEBUG_INSTTYPE)" != "none"
     488 local mode := $(if $(mode),$(mode)$(COMMA)a-x,0644)
     489
     490 ifeq ($($(target)_1_DEBUG_INSTTYPE),both)
     491  local debug_inst_path   := $(PATH_INS)
     492  local debug_install_cmd := $(INSTALL)
     493  local debug_var         := INSTALL
     494  $(foreach debug_inst, $($(target)_1_DEBUG_INST), $(evalval def_target_install_only_debug))
     495 endif
     496
     497 local debug_inst_path    := $(PATH_STAGE)
     498 local debug_install_cmd  := $(INSTALL_STAGING)
     499 local debug_var          := STAGE
     500 if1of ($($(target)_1_DEBUG_INSTTYPE), stage both)
     501  $(foreach debug_inst, $($(target)_1_DEBUG_STAGE), $(evalval def_target_install_only_debug))
     502 endif
     503 if1of ($($(target)_1_INSTTYPE), stage both)
     504  ifndef debug_nostage
     505   $(foreach debug_inst,$($(target)_1_STAGE), $(evalval def_target_install_only_debug))
     506  endif
     507 endif
     508
     509 _DEBUG_STAGE_DIRS    += $($(target)_2_DEBUG_STAGE_TARGET_DIRS)
     510 _DEBUG_STAGE_FILES   += $($(target)_2_DEBUG_STAGE_TARGET_FILES)
     511 _DEBUG_INSTALL_DIRS  += $($(target)_2_DEBUG_INSTALL_TARGET_DIRS)
     512 _DEBUG_INSTALL_FILES += $($(target)_2_DEBUG_INSTALL_TARGET_FILES)
     513
     514 $(basename $(notdir $(out))):: $($(target)_2_DEBUG_STAGE_TARGET_DIRS) $($(target)_2_DEBUG_STAGE_TARGET_FILES)
     515endif
    367516
    368517endef # def_target_install_only
     
    534683
    535684# call the tool
    536 local cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
     685local  cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
    537686ifneq ($(pre_cmds),)
    538687 local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
    539688endif
    540689ifneq ($(post_cmds),)
    541  local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
     690 local cmds := $(cmds)$(NL)$(TAB)$(post_cmds)
    542691endif
    543692$(target)_2_OUTPUT := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
     
    813962endif
    814963
     964# Debug info.
     965local ld_debug      := $(evalcall def_fn_prop_get_first_defined,LD_DEBUG)
     966local debug_inst    := $(evalcall def_fn_prop_get_first_defined,DEBUG_INST)
     967local debug_stage   := $(evalcall def_fn_prop_get_first_defined,DEBUG_STAGE)
     968local debug_nostage := $(evalcall def_fn_prop_get_first_word,DEBUG_NOSTAGE)
     969
    815970# Custom pre/post-link actions.
    816 local pre_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
    817 local post_cmds := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
     971local pre_cmds      := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
     972local post_cmds     := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
    818973
    819974# eliminate this guy?
    820975local objs = $($(target)_2_OBJS)
    821 
    822 # installation targets
    823 local target_type_mode :=
    824 $(evalval def_target_install_only)
    825976
    826977# dependency file
     
    8611012 local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
    8621013endif
    863 $(target)_2_OUTPUT := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
    864 $(target)_2_OUTPUT_MAYBE := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
    865 $(target)_2_DEPEND := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
    866 $(target)_2_DEPORD := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
     1014$(target)_2_OUTPUT              := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
     1015$(target)_2_OUTPUT_MAYBE        := $(TOOL_$(tool)_$(tool_do)_OUTPUT_MAYBE)
     1016if1of ($(ld_debug), split)
     1017 $(target)_2_OUTPUT_DEBUG_FILES := $(filter-out %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
     1018 $(target)_2_OUTPUT_DEBUG_DIRS  := $(filter     %/,$(TOOL_$(tool)_$(tool_do)_OUTPUT_DEBUG))
     1019else
     1020 $(target)_2_OUTPUT_DEBUG_FILES :=
     1021 $(target)_2_OUTPUT_DEBUG_DIRS  :=
     1022endif
     1023$(target)_2_DEPEND              := $(TOOL_$(tool)_$(tool_do)_DEPEND) $(deps) $($(target)_2_OBJS)
     1024$(target)_2_DEPORD              := $(TOOL_$(tool)_$(tool_do)_DEPORD) $(dirdep) $(orderdeps)
    8671025
    8681026# generate the link rule.
    8691027$(eval $(def_link_rule))
    8701028
     1029# installation targets
     1030local target_type_mode :=
     1031$(evalval def_target_install_only)
    8711032
    8721033# Update globals.
  • trunk/kBuild/footer.kmk

    r2522 r2523  
    126126_INSTALLS_FILES :=
    127127_INSTALLS_DIRS :=
     128_DEBUG_STAGE_FILES :=
     129_DEBUG_STAGE_DIRS :=
     130_DEBUG_INSTALL_FILES :=
     131_DEBUG_INSTALL_DIRS :=
    128132_OTHERS   :=
    129133_PACKING  :=
     
    242246installs:  $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
    243247
     248install-debug:  $$(_DEBUG_INSTALL_DIRS) $$(_DEBUG_INSTALL_FILES)
     249
    244250
    245251
  • trunk/kBuild/header.kmk

    r2520 r2523  
    914914PROPS_SINGLE := $(PROPS_TOOLS) TEMPLATE INSTTYPE INST STAGE NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU FETCHDIR \
    915915        OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF SYSSUFF BINSUFF EXESUFF DLLSUFF LIBSUFF ARLIBSUFF \
    916         MODE UID GID
     916        MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE
    917917## PROPS_SINGLE_LNK
    918918# Subset of PROPS_SINGLE which applies to all linkable targets.
     
    920920        INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU \
    921921        OBJSUFF COBJSUFF CXXOBJSUFF OBJCOBJSUFF OBJCXXOBJSUFF ASOBJSUFF RCOBJSUFF \
    922         MODE UID GID
     922        MODE UID GID LD_DEBUG DEBUG_INSTTYPE DEBUG_INST DEBUG_STAGE
    923923
    924924## PROPS_DEFERRED
     
    11461146PASS_STAGING        := Staging
    11471147PASS_STAGING_trgs   :=
    1148 PASS_STAGING_vars   := _STAGING_DIRS _INSTALLS _STAGING_FILES
     1148PASS_STAGING_vars   := _STAGE_DIRS _INSTALLS _STAGE_FILES _DEBUG_STAGE_DIRS _DEBUG_STAGE_FILES
    11491149PASS_STAGING_pass   := staging
    11501150
     
    11541154PASS_INSTALLS       := Install
    11551155PASS_INSTALLS_trgs  :=
    1156 PASS_INSTALLS_vars  := _INSTALLS_DIRS _INSTALLS_FILES
     1156PASS_INSTALLS_vars  := _INSTALLS_DIRS _INSTALLS_FILES _DEBUG_INSTALL_DIRS _DEBUG_INSTALL_FILES
    11571157PASS_INSTALLS_pass  := installs
    11581158
  • trunk/kBuild/tools/GCC4MACHO.kmk

    r2431 r2523  
    5151TOOL_GCC4MACHO_LDFLAGS.sysmod ?= -r
    5252#TOOL_GCC4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
     53TOOL_GCC4MACHO_DSYMUTIL  ?= dsymutil
    5354
    5455ifdef SLKRUNS
     
    104105TOOL_GCC4MACHO_LDFLAGS.debug    ?= -g
    105106TOOL_GCC4MACHO_LDFLAGS.profile  ?= -g
     107
     108
     109##
     110# Calculate the files in the debug bundle.
     111# @param    1           The whole output filename.
     112# @param    2           The output filename sans suffix.
     113TOOL_GCC4MACHO_DEBUG_BUNDLE_FN = \
     114    $(1).dSYM/ \
     115    $(1).dSYM/Contents/ \
     116    $(1).dSYM/Contents/Resources/ \
     117    $(1).dSYM/Contents/Resources/DWARF/ \
     118    $(1).dSYM/Contents/Info.plist \
     119    $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))
     120
     121##
     122# Calculate the files in the debug bundle.
     123# @param    1           The whole linker output filename.
     124# @param    2           The linker output filename sans suffix.
     125# @param    3           The desired install name (no dir slash).
     126TOOL_GCC4MACHO_DEBUG_INSTALL_FN= \
     127    $(3).dSYM/ \
     128    $(3).dSYM/Contents/ \
     129    $(3).dSYM/Contents/Resources/ \
     130    $(3).dSYM/Contents/Resources/DWARF/ \
     131    $(1).dSYM/Contents/Info.plist=>$(3).dSYM/Contents/Info.plist \
     132    $(1).dSYM/Contents/Resources/DWARF/$(notdir $(1))=>$(3).dSYM/Contents/Resources/DWARF/$(notdir $(1))
    106133
    107134
     
    350377# @param    $(outbase)  Output basename (full). Use this for list files and such.
    351378TOOL_GCC4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
     379TOOL_GCC4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
     380TOOL_GCC4MACHO_LINK_PROGRAM_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
    352381TOOL_GCC4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    353382TOOL_GCC4MACHO_LINK_PROGRAM_DEPORD =
     
    358387                $(foreach p,$(libpath), -L$(p))\
    359388                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
    360 endef
     389 ifeq ($(ld_debug),split)
     390        $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     391 endif
     392endef
     393
    361394
    362395
     
    375408# @param    $(outbase)  Output basename (full). Use this for list files and such.
    376409TOOL_GCC4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
     410TOOL_GCC4MACHO_LINK_DLL_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
     411TOOL_GCC4MACHO_LINK_DLL_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
    377412TOOL_GCC4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    378413TOOL_GCC4MACHO_LINK_DLL_DEPORD =
     
    384419                $(foreach p,$(libpath), -L$(p))\
    385420                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
     421 ifeq ($(ld_debug),split)
     422        $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     423 endif
    386424endef
    387425
     
    401439# @param    $(outbase)  Output basename (full). Use this for list files and such.
    402440TOOL_GCC4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
     441TOOL_GCC4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(call TOOL_GCC4MACHO_DEBUG_BUNDLE_FN,$(out))
     442TOOL_GCC4MACHO_LINK_SYSMOD_DEBUG_INSTALL_FN = $(TOOL_GCC4MACHO_DEBUG_INSTALL_FN)
    403443TOOL_GCC4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    404444TOOL_GCC4MACHO_LINK_SYSMOD_DEPORD =
     
    409449                $(foreach p,$(libpath), -L$(p))\
    410450                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
    411 endef
    412 
     451 ifeq ($(ld_debug),split)
     452        $(QUIET)$(TOOL_GCC4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     453 endif
     454endef
     455
  • trunk/kBuild/tools/GXX4MACHO.kmk

    r2431 r2523  
    5151TOOL_GXX4MACHO_LDFLAGS.sysmod ?= -r
    5252#TOOL_GXX4MACHO_LD_SONAME = -Wl,-dylib_install_name $(firstword $($(1)_SONAME.$(KBUILD_TARGET).$(KBUILD_TYPE)) $($(1)_SONAME.$(KBUILD_TARGET)) $($(1)_SONAME.$(KBUILD_TYPE)) $($(1)_SONAME) $(notdir $(2)))
     53TOOL_GXX4MACHO_DSYMUTIL  ?= dsymutil
    5354
    5455ifdef SLKRUNS
     
    192193        $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
    193194endef
    194 endif # !KUSE_OBJCACHE
     195endif # !KBUILD_USE_KOBJCACHE
    195196
    196197
     
    236237        $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
    237238endef
    238 endif # !KUSE_OBJCACHE
     239endif # !KBUILD_USE_KOBJCACHE
    239240
    240241
     
    280281        $(QUIET)$(APPEND) -n "$(dep)" "" "$(source):" ""
    281282endef
    282 endif # !KUSE_OBJCACHE
     283endif # !KBUILD_USE_KOBJCACHE
    283284
    284285
     
    350351# @param    $(outbase)  Output basename (full). Use this for list files and such.
    351352TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT = $(outbase).rsp
     353TOOL_GXX4MACHO_LINK_PROGRAM_OUTPUT_DEBUG = $(out).dSYM/
    352354TOOL_GXX4MACHO_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    353355TOOL_GXX4MACHO_LINK_PROGRAM_DEPORD =
     
    358360                $(foreach p,$(libpath), -L$(p))\
    359361                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
     362 ifeq ($(ld_debug),split)
     363        $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     364 endif
    360365endef
    361366
     
    375380# @param    $(outbase)  Output basename (full). Use this for list files and such.
    376381TOOL_GXX4MACHO_LINK_DLL_OUTPUT = $(outbase).rsp
     382TOOL_GXX4MACHO_LINK_DLL_OUTPUT_DEBUG = $(out).dSYM/
    377383TOOL_GXX4MACHO_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    378384TOOL_GXX4MACHO_LINK_DLL_DEPORD =
     
    384390                $(foreach p,$(libpath), -L$(p))\
    385391                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
     392 ifeq ($(ld_debug),split)
     393        $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     394 endif
    386395endef
    387396
     
    401410# @param    $(outbase)  Output basename (full). Use this for list files and such.
    402411TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT = $(outbase).rsp
     412TOOL_GXX4MACHO_LINK_SYSMOD_OUTPUT_DEBUG = $(out).dSYM/
    403413TOOL_GXX4MACHO_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
    404414TOOL_GXX4MACHO_LINK_SYSMOD_DEPORD =
     
    409419                $(foreach p,$(libpath), -L$(p))\
    410420                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(lib)), $(lib)))
    411 endef
    412 
     421 ifeq ($(ld_debug),split)
     422        $(QUIET)$(TOOL_GXX4MACHO_DSYMUTIL) --verbose -o $(out).dSYM/ $(out)
     423 endif
     424endef
     425
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette