Changeset 3630


Ignore:
Timestamp:
Oct 25, 2024, 11:49:17 AM (3 weeks ago)
Author:
bird
Message:

header.kmk,footer-pass2-compiling-targets.kmk: Added EARLY_LIBS and LATE_LIBS properties to better control the library order when using templates. The libraries are collected from EARLY_LIBS first, then LIBS, and LATE_LIBS last.

Location:
trunk/kBuild
Files:
2 edited

Legend:

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

    r3521 r3630  
    897897        $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
    898898        $($(target)_LDFLAGS.$(bld_trg_cpu))
     899
     900local targetsdks  := \
     901        $($(target)_SDKS.$(bld_trg).$(bld_trg_arch))\
     902        $($(target)_SDKS.$(bld_trg_arch))\
     903        $($(target)_SDKS.$(bld_trg))\
     904        $($(target)_SDKS.$(bld_type))\
     905        $($(target)_SDKS)
     906local globalsdks  := \
     907        $(SDKS.$(bld_trg).$(bld_trg_arch))\
     908        $(SDKS.$(bld_trg_arch))\
     909        $(SDKS.$(bld_trg))\
     910        $(SDKS.$(bld_type))\
     911        $(SDKS)
     912# Note! Global EARLY_LIBS and LATE_LIBS variables are ignored.
     913## @todo ignore global LIBS and most other global properties.
    899914local libs        :=\
     915        $($(target)_EARLY_LIBS.$(bld_trg_cpu))\
     916        $($(target)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
     917        $($(target)_EARLY_LIBS.$(bld_trg_arch))\
     918        $($(target)_EARLY_LIBS.$(bld_trg))\
     919        $($(target)_EARLY_LIBS.$(bld_type))\
     920        $($(target)_EARLY_LIBS)\
     921        $(foreach sdk, $(targetsdks) $(globalsdks),\
     922                $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg_cpu))\
     923                $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
     924                $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg_arch))\
     925                $(SDK_$(sdk)_EARLY_LIBS.$(bld_trg))\
     926                $(SDK_$(sdk)_EARLY_LIBS.$(bld_type))\
     927                $(SDK_$(sdk)_EARLY_LIBS))\
     928        $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg_cpu))\
     929        $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg).$(bld_trg_arch))\
     930        $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg_arch))\
     931        $(TOOL_$(tool)_EARLY_LIBS.$(bld_trg))\
     932        $(TOOL_$(tool)_EARLY_LIBS.$(bld_type))\
     933        $(TOOL_$(tool)_EARLY_LIBS)\
     934        \
    900935        $($(target)_LIBS.$(bld_trg_cpu))\
    901936        $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
     
    904939        $($(target)_LIBS.$(bld_type))\
    905940        $($(target)_LIBS)\
    906         $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
    907                        $($(target)_SDKS.$(bld_trg_arch)) \
    908                        $($(target)_SDKS.$(bld_trg)) \
    909                        $($(target)_SDKS.$(bld_type)) \
    910                        $($(target)_SDKS),\
     941        $(foreach sdk, $(targetsdks),\
    911942                $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
    912943                $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
     
    921952        $(LIBS.$(bld_type))\
    922953        $(LIBS)\
    923         $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
    924                        $(SDKS.$(bld_trg_arch)) \
    925                        $(SDKS.$(bld_trg)) \
    926                        $(SDKS.$(bld_type)) \
    927                        $(SDKS),\
     954        $(foreach sdk, $(globalsdks),\
    928955                $(SDK_$(sdk)_LIBS.$(bld_trg_cpu))\
    929956                $(SDK_$(sdk)_LIBS.$(bld_trg).$(bld_trg_arch))\
     
    937964        $(TOOL_$(tool)_LIBS.$(bld_trg))\
    938965        $(TOOL_$(tool)_LIBS.$(bld_type))\
    939         $(TOOL_$(tool)_LIBS)
     966        $(TOOL_$(tool)_LIBS)\
     967        \
     968        $($(target)_LATE_LIBS.$(bld_trg_cpu))\
     969        $($(target)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
     970        $($(target)_LATE_LIBS.$(bld_trg_arch))\
     971        $($(target)_LATE_LIBS.$(bld_trg))\
     972        $($(target)_LATE_LIBS.$(bld_type))\
     973        $($(target)_LATE_LIBS)\
     974        $(foreach sdk, $(targetsdks) $(globalsdks),\
     975                $(SDK_$(sdk)_LATE_LIBS.$(bld_trg_cpu))\
     976                $(SDK_$(sdk)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
     977                $(SDK_$(sdk)_LATE_LIBS.$(bld_trg_arch))\
     978                $(SDK_$(sdk)_LATE_LIBS.$(bld_trg))\
     979                $(SDK_$(sdk)_LATE_LIBS.$(bld_type))\
     980                $(SDK_$(sdk)_LATE_LIBS))\
     981        $(TOOL_$(tool)_LATE_LIBS.$(bld_trg_cpu))\
     982        $(TOOL_$(tool)_LATE_LIBS.$(bld_trg).$(bld_trg_arch))\
     983        $(TOOL_$(tool)_LATE_LIBS.$(bld_trg_arch))\
     984        $(TOOL_$(tool)_LATE_LIBS.$(bld_trg))\
     985        $(TOOL_$(tool)_LATE_LIBS.$(bld_type))\
     986        $(TOOL_$(tool)_LATE_LIBS)
    940987local libpath    :=\
    941988        $($(target)_LIBPATH.$(bld_trg_cpu))\
     
    945992        $($(target)_LIBPATH.$(bld_type))\
    946993        $($(target)_LIBPATH)\
    947         $(foreach sdk, $($(target)_SDKS.$(bld_trg).$(bld_trg_arch)) \
    948                        $($(target)_SDKS.$(bld_trg_arch)) \
    949                        $($(target)_SDKS.$(bld_trg)) \
    950                        $($(target)_SDKS.$(bld_type)) \
    951                        $($(target)_SDKS),\
     994        $(foreach sdk, $(targetsdks),\
    952995                $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
    953996                $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
     
    9621005        $(LIBPATH.$(bld_type))\
    9631006        $(LIBPATH)\
    964         $(foreach sdk, $(SDKS.$(bld_trg).$(bld_trg_arch)) \
    965                        $(SDKS.$(bld_trg_arch)) \
    966                        $(SDKS.$(bld_trg)) \
    967                        $(SDKS.$(bld_type)) \
    968                        $(SDKS),\
     1007        $(foreach sdk, $(globalsdks),\
    9691008                $(SDK_$(sdk)_LIBPATH.$(bld_trg_cpu))\
    9701009                $(SDK_$(sdk)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
  • trunk/kBuild/header.kmk

    r3609 r3630  
    11841184        SDKS USES SOURCES EXEC_SOURCES SRC_HANDLERS INTERMEDIATES \
    11851185        INCS CINCS CXXINCS PCHINCS OBJCINCS OBJCXXINCS ASINCS RCINCS \
    1186         LIBS LIBPATH \
     1186        EARLY_LIBS LIBS LATE_LIBS LIBPATH \
    11871187        DIRS BLDDIRS CLEAN
    11881188## PROPS_ACCUMULATE_L_LNK
    11891189# Subset of PROPS_ACCUMULATE_L which applies to all linkable targets.
    1190 PROPS_ACCUMULATE_L_LNK := $(filter-out LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
     1190PROPS_ACCUMULATE_L_LNK := $(filter-out EARLY_LIBS LIBS LATE_LIBS LIBPATH EXEC_SOURCES DIRS, $(PROPS_ACCUMULATE_L))
    11911191
    11921192## PROPS_ALL
     
    11991199PROPS_PROGRAMS_DEFERRED      := $(PROPS_DEFERRED)
    12001200PROPS_PROGRAMS_ACCUMULATE_R  := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
    1201 PROPS_PROGRAMS_ACCUMULATE_L  := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
     1201PROPS_PROGRAMS_ACCUMULATE_L  := $(PROPS_ACCUMULATE_L_LNK) EARLY_LIBS LIBS LATE_LIBS LIBPATH
    12021202## @}
    12031203
     
    12151215PROPS_DLLS_DEFERRED          := $(PROPS_DEFERRED)
    12161216PROPS_DLLS_ACCUMULATE_R      := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
    1217 PROPS_DLLS_ACCUMULATE_L      := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
     1217PROPS_DLLS_ACCUMULATE_L      := $(PROPS_ACCUMULATE_L_LNK) EARLY_LIBS LIBS LATE_LIBS LIBPATH
    12181218## @}
    12191219
     
    12231223PROPS_SYSMODS_DEFERRED       := $(PROPS_DEFERRED)
    12241224PROPS_SYSMODS_ACCUMULATE_R   := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
    1225 PROPS_SYSMODS_ACCUMULATE_L   := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
     1225PROPS_SYSMODS_ACCUMULATE_L   := $(PROPS_ACCUMULATE_L_LNK) EARLY_LIBS LIBS LATE_LIBS LIBPATH
    12261226## @}
    12271227
     
    12311231PROPS_MISCBINS_DEFERRED      := $(PROPS_DEFERRED)
    12321232PROPS_MISCBINS_ACCUMULATE_R  := $(PROPS_ACCUMULATE_R_LNK) LDFLAGS
    1233 PROPS_MISCBINS_ACCUMULATE_L  := $(PROPS_ACCUMULATE_L_LNK) LIBS LIBPATH
     1233PROPS_MISCBINS_ACCUMULATE_L  := $(PROPS_ACCUMULATE_L_LNK) EARLY_LIBS LIBS LATE_LIBS LIBPATH
    12341234## @}
    12351235
Note: See TracChangeset for help on using the changeset viewer.