Ignore:
Timestamp:
May 12, 2008, 9:44:45 PM (17 years ago)
Author:
bird
Message:

Introduce the concept of units to prevent footer.kmk from growing beyond proportions. Features that are rarely used are put into units and dragged in via the USES property when needed. The first example of this is how lex (.l files) is handled.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r1614 r1621  
    10721072
    10731073#
    1074 # Include tools & sdks
     1074# Include tools, sdks and units.
    10751075#
    10761076# The first part of this exercise is to figure out which TOOLS and SDKS
     
    10841084          $(SDKS.$(KBUILD_TYPE)) \
    10851085          $(SDKS)
     1086_USES  := $(USES.$(KBUILD_TARGET))   $(USES.$(KBUILD_TARGET_ARCH))   $(USES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
     1087          $(USES.$(KBUILD_HOST)) $(USES.$(KBUILD_HOST_ARCH)) $(USES.$(KBUILD_HOST).$(KBUILD_HOST_ARCH)) \
     1088          $(USES.$(KBUILD_TYPE)) \
     1089          $(USES)
    10861090define def_tools_sdks_target_source
    10871091$(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
     
    11051109        $($(source)_SDKS) \
    11061110        $($(target)_$(source)_SDKS))
     1111$(eval _USES += \
     1112        $($(source)_USES.$(_bld_trg)) \
     1113        $($(target)_$(source)_USES.$(_bld_trg)) \
     1114        $($(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
     1115        $($(target)_$(source)_USES.$(_bld_trg).$(_bld_trg_arch)) \
     1116        $($(source)_USES.$(_bld_trg_arch)) \
     1117        $($(target)_$(source)_USES.$(_bld_trg_arch)) \
     1118        $($(source)_USES.$(KBUILD_TYPE)) \
     1119        $($(target)_$(source)_USES.$(KBUILD_TYPE)) \
     1120        $($(source)_USES) \
     1121        $($(target)_$(source)_USES))
    11071122endef # def_tools_sdks_target_source
    11081123
     
    11231138        $($(target)_SDKS.$(_bld_trg).$(_bld_trg_arch)) \
    11241139        $($(target)_SDKS))
     1140$(eval _USES += \
     1141        $($(target)_USES.$(_bld_trg)) \
     1142        $($(target)_USES.$(_bld_trg_arch)) \
     1143        $($(target)_USES.$(_bld_trg).$(_bld_trg_arch)) \
     1144        $($(target)_USES))
    11251145$(foreach source, \
    11261146        $($(target)_SOURCES.$(_bld_trg)) \
     
    11931213endef # def_sdk_load_function
    11941214
     1215## Unit load function.
     1216# @param loading    The unit name
     1217define def_unit_load_function
     1218ifndef 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
     1227endif
     1228endef # def_unit_load_function
     1229
    11951230
    11961231properties :=
     
    12191254properties_deferred_r :=
    12201255
     1256# No inheriting for the uses, they're just global 'code'.
     1257$(foreach loading, $(_USES), $(evalval def_unit_load_function))
     1258
    12211259
    12221260ifdef KBUILD_PROFILE_SELF
    12231261 _KBUILD_TS_NOW := $(nanots )
    1224  $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done tools and sdks)
     1262 $(info prof: $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_HEADER_START)) - $(int-sub $(_KBUILD_TS_NOW), $(_KBUILD_TS_PREV)) - done tools, sdks and units)
    12251263 $(info stat: $(make-stats ))
    12261264 _KBUILD_TS_PREV := $(_KBUILD_TS_NOW)
     
    20162054        $($(target)_SOURCES.$(bld_trg_cpu))\
    20172055        $($(target)_SOURCES.$(bld_type))\
     2056        ,$(evalval def_src_handler_one) )
     2057
     2058$(foreach source,\
     2059        $($(target)_GEN_SOURCES_)\
     2060        $($(target)_GEN_SOURCES_.$(bld_trg))\
     2061        $($(target)_GEN_SOURCES_.$(bld_trg).$(bld_trg_arch))\
     2062        $($(target)_GEN_SOURCES_.$(bld_trg_arch))\
     2063        $($(target)_GEN_SOURCES_.$(bld_trg_cpu))\
     2064        $($(target)_GEN_SOURCES_.$(bld_type))\
    20182065        ,$(evalval def_src_handler_one) )
    20192066endef
Note: See TracChangeset for help on using the changeset viewer.