Ignore:
Timestamp:
Dec 15, 2006, 6:18:47 AM (19 years ago)
Author:
bird
Message:

Partial implementation of a _PATH target property for resolving relative paths. It's primarily intended for sub-makefile mode where we apply it to all targets automatically. TODOs: INCS, DEPs (source level) and SUBDIRS*.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/header.kmk

    r724 r725  
    156156# Common definitions.
    157157#
     158## PATH_CURRENT is the current directory (getcwd).
    158159PATH_CURRENT        := $(abspath $(CURDIR))
     160## PATH_SUB_CURRENT points to current directory of the current makefile.
     161# Meaning that it will change value as we enter and exit sub-makefiles.
     162PATH_SUB_CURRENT    := $(PATH_CURRENT)
     163## PATH_ROOT points to the project root directory.
     164PATH_ROOT           := $(abspath $(PATH_CURRENT)/$(DEPTH))
     165## PATH_SUB_ROOT points to the directory of the top-level makefile.
    159166ifneq ($(strip $(SUB_DEPTH)),)
    160 PATH_SUB_CURRENT    := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
    161 else
    162 PATH_SUB_CURRENT    := $(PATH_CURRENT)
    163 endif
    164 PATH_ROOT           := $(abspath $(PATH_CURRENT)/$(DEPTH))
    165 
    166 # Subdirectory relative to the root.
     167 PATH_SUB_ROOT      := $(abspath $(PATH_CURRENT)/$(SUB_DEPTH))
     168else
     169 PATH_SUB_ROOT      := $(PATH_CURRENT)
     170endif
     171
     172## CURSUBDIR is PATH_SUB_ROOT described relative to PATH_ROOT.
     173# This variable is used to determin where the object files and other output goes.
    167174ifneq ($(PATH_ROOT),$(PATH_CURRENT))
    168 CURSUBDIR           := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_CURRENT))
     175CURSUBDIR           := $(patsubst $(PATH_ROOT)/%,%,$(PATH_SUB_ROOT))
    169176else
    170177CURSUBDIR           := .
     
    173180# Output directories.
    174181ifndef PATH_OUT_BASE
    175 PATH_OUT_BASE       := $(PATH_ROOT)/out
     182 PATH_OUT_BASE      := $(PATH_ROOT)/out
    176183endif
    177184ifndef PATH_OUT
    178 ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
    179 PATH_OUT            := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
    180 else
    181 PATH_OUT            := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
    182 endif
     185 ifdef BUILD_TARGET_SUB # (BUILD_TARGET_SUB is not currently recognized by kBuild in any other places.)
     186  PATH_OUT          := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH).$(BUILD_TARGET_SUB)/$(BUILD_TYPE)
     187 else
     188  PATH_OUT          := $(PATH_OUT_BASE)/$(BUILD_TARGET).$(BUILD_TARGET_ARCH)/$(BUILD_TYPE)
     189 endif
    183190endif # !define PATH_OUT
    184191PATH_OBJ             = $(PATH_OUT)/obj
     
    193200# Usually kBuild is external to the source tree.
    194201ifndef PATH_KBUILD
    195 PATH_KBUILD         := $(PATH_ROOT)/kBuild
     202 PATH_KBUILD        := $(PATH_ROOT)/kBuild
    196203endif
    197204PATH_KBUILD         := $(abspath $(PATH_KBUILD))
    198205# kBuild files which might be of interest.
    199206FILE_KBUILD_HEADER  := $(PATH_KBUILD)/header.kmk
    200 FILE_KBUILD_CONFIG  := $(PATH_KBUILD)/config.kmk
     207#FILE_KBUILD_CONFIG  := $(PATH_KBUILD)/config.kmk
    201208FILE_KBUILD_FOOTER  := $(PATH_KBUILD)/footer.kmk
    202209
    203210SUFF_DEP            := .dep
     211## MAKEFILE is the name of the main makefile.
    204212MAKEFILE            := $(firstword $(MAKEFILE_LIST))
     213## MAKEFILE_CURRENT is the name of the current makefile.
     214# This is updated everything a sub-makefile is included.
     215MAKEFILE_CURRENT    := $(MAKEFILE)
    205216
    206217
Note: See TracChangeset for help on using the changeset viewer.