1# $Id: sys.dependfile.mk,v 1.12 2025/08/09 22:42:24 sjg Exp $ 2# 3# @(#) Copyright (c) 2012-2023, Simon J. Gerraty 4# 5# SPDX-License-Identifier: BSD-2-Clause 6# 7# Please send copies of changes and bug-fixes to: 8# sjg@crufty.net 9# 10 11.if !target(__${.PARSEFILE}__) 12__${.PARSEFILE}__: .NOTMAIN 13 14# This only makes sense for DIRDEPS_BUILD. 15# This allows a mixture of auto generated as well as manually edited 16# dependency files, which can be differentiated by their names. 17# As per dirdeps.mk we only require: 18# 1. a common prefix 19# 2. that machine specific files end in .${MACHINE} 20# 21# The .MAKE.DEPENDFILE_PREFERENCE below is an example. 22 23# All depend file names should start with this 24.MAKE.DEPENDFILE_PREFIX ?= Makefile.depend 25 26.if !empty(.MAKE.DEPENDFILE) && \ 27 ${.MAKE.DEPENDFILE:M${.MAKE.DEPENDFILE_PREFIX}*} == "" 28# let us do our thing below... 29.undef .MAKE.DEPENDFILE 30.endif 31 32# The order of preference: we will use the first one of these we find. 33# It usually makes sense to order from most specific to least. 34.MAKE.DEPENDFILE_PREFERENCE ?= \ 35 ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ 36 ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX} 37 38# Normally the 1st entry is our default choice 39# Another useful default is ${.MAKE.DEPENDFILE_PREFIX} 40.MAKE.DEPENDFILE_DEFAULT ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]} 41 42_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@} 43.if !empty(_e) 44.MAKE.DEPENDFILE := ${_e:[1]} 45.elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_DEFAULT:E} != ${MACHINE} 46# MACHINE specific depend files are supported, but *not* default. 47# If any already exist, we should follow suit. 48_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE} 49# make sure we restore MACHINE 50_m := ${MACHINE} 51_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@} 52MACHINE := ${_m} 53.if !empty(_e) 54.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]} 55.endif 56.endif 57.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT} 58 59.endif 60