VirtualBox

Changeset 1672 in kBuild


Ignore:
Timestamp:
Jul 7, 2008 9:38:57 PM (17 years ago)
Author:
bird
Message:

Global USES differs from target USES and must be executed before any inherting because they may add target properties. Added a unit callout prior to source processing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r1670 r1672  
    613613
    614614endef # def_inherit
     615
     616
     617#
     618# Load global units before doing any inheriting so they can add new properties.
     619#
     620# This only applies to the guys listed in the global USES since there is
     621# no reliable way to deal with things on a target level without first
     622# applying templates. So, to avoid having USES mess up all targets,
     623# we'll make the global and per-target USES property work differently:
     624#     The global USES does not apply to targets, just globally.
     625#
     626
     627## Unit load function.
     628# @param loading    The unit name
     629define def_unit_load_function
     630ifndef UNIT_$(loading)
     631 UNIT_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
     632 ifeq ($(UNIT_$(loading)_KMK_FILE),)
     633  $(error kBuild: Cannot find include file for the unit '$(loading)'! Searched: $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS))
     634 endif
     635 include $(UNIT_$(loading)_KMK_FILE)
     636 ifndef UNIT_$(loading)
     637  $(warning kBuild: UNIT_$(loading) was not defined by $(UNIT_$(loading)_KMK_FILE)!)
     638 endif
     639endif
     640endef # def_unit_load_function
     641
     642$(foreach loading, \
     643        $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
     644        $(USES.$(KBUILD_TARGET_CPU)) \
     645        $(USES.$(KBUILD_TARGET_ARCH)) \
     646        $(USES.$(KBUILD_TARGET)) \
     647        $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
     648        $(USES.$(KBUILD_HOST_CPU)) \
     649        $(USES.$(KBUILD_HOST_ARCH)) \
     650        $(USES.$(KBUILD_TARGET)) \
     651        $(USES.$(KBUILD_TYPE)) \
     652        $(USES),$(evalval def_unit_load_function))
    615653
    616654
     
    12131251endef # def_sdk_load_function
    12141252
    1215 ## Unit load function.
    1216 # @param loading    The unit name
    1217 define def_unit_load_function
    1218 ifndef UNIT_$(loading)
    1219  UNIT_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
    1220  ifeq ($(UNIT_$(loading)_KMK_FILE),)
    1221   $(error kBuild: Cannot find include file for the unit '$(loading)'! Searched: $(KBUILD_UNIT_PATHS) $(KBUILD_PATH)/units $(KBUILD_DEFAULT_PATHS))
    1222  endif
    1223  include $(UNIT_$(loading)_KMK_FILE)
    1224  ifndef UNIT_$(loading)
    1225   $(warning kBuild: UNIT_$(loading) was not defined by $(UNIT_$(loading)_KMK_FILE)!)
    1226  endif
    1227 endif
    1228 endef # def_unit_load_function
    1229 
    12301253
    12311254properties :=
     
    13061329 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
    13071330else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
    1308   $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
     1331 $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
    13091332endif
    13101333ifeq ($(tool_prefix),AR) ## @todo fix this mess!
     
    21302153ifndef PATH_$(target)
    21312154 PATH_$(target)   := $(patsubst %/,%,$(dir $(outbase)))
    2132 else
    2133  ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
    2134   $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
    2135  endif
     2155else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
     2156 $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
    21362157endif
    21372158local suff        := $(firstword\
     
    21492170othersrc          :=
    21502171$(target)_OBJS_   :=
     2172
     2173# Do units pre source callouts.
     2174local units       := \
     2175        $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
     2176        $($(target)_USES.$(bld_trg_arch))\
     2177        $($(target)_USES.$(bld_trg))\
     2178        $($(target)_USES.$(bld_type))\
     2179        $($(target)_USES)
     2180$(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
    21512181
    21522182# source -> object
     
    23412371ifndef PATH_$(target)
    23422372 PATH_$(target)   := $(patsubst %/,%,$(dir $(outbase)))
    2343 else
    2344  ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
    2345   $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
    2346  endif
     2373else ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
     2374 $(error kBuild internal error: PATH_$(target)=$(PATH_$(target)) expected $(patsubst %/,%,$(dir $(outbase))))
    23472375endif
    23482376local suff        := $(firstword \
     
    23572385othersrc          :=
    23582386$(target)_OBJS_   :=
     2387
     2388# Do units pre source callouts.
     2389local units       := \
     2390        $($(target)_USES.$(bld_trg).$(bld_trg_arch))\
     2391        $($(target)_USES.$(bld_trg_arch))\
     2392        $($(target)_USES.$(bld_trg))\
     2393        $($(target)_USES.$(bld_type))\
     2394        $($(target)_USES)
     2395$(foreach unit,$(units),$(evalval def_unit_$(unit)_target_pre))
    23592396
    23602397# source -> object
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