Consider a source tree with sub-directories (A) and (B), where the code in directory (B) uses a file that is generated by the build steps in directory (A).
For an in-place build, the directory hierarchy might look like: $(TOP)/ | +-- A/ | | | +- generated-file | +-- B/ | | | +- uses-generated-file etc. In the event an 'obj' directory is used, the tree might be something like: $(TOP)/ | +-- A/ | | | +- obj/ | | | +- generated-file | +-- B/ | | | +- uses-generated-file etc. If MAKEOBJDIRPREFIX is used, the obj/ tree could reside somewhere else entirely: $(TOP)/ | +-- A/ | +-- B/ | | | +- uses-generated-file etc. $(MAKEOBJDIRPREFIX)/$(TOP)/ | +-- A/ | | | +- generated-file | +-- B/ | etc. What would be the cleanest way to is there a way to determine the path to an obj/ directory, given relative locations of source directories (A) and (B)? For the Elftoolchain build I currently use nested conditional blocks: .if exists(${.OBJDIR}/../A) # For in-place builds, or when MAKEOBJDIRPREFIX is used. .elif exists(${.CURDIR}/../A/${.OBJDIR:S,${.CURDIR}/,,} # For builds using an obj/ directory. .endif I was wondering if there was a better way. Thanks, Joseph Koshy