1134437Stjr# $Id: sys.dependfile.mk,v 1.8 2016/03/11 01:34:13 sjg Exp $ 2134437Stjr# 3134437Stjr# @(#) Copyright (c) 2012, Simon J. Gerraty 4134437Stjr# 5134437Stjr# This file is provided in the hope that it will 6174990Sache# be of use. There is absolutely NO WARRANTY. 7134437Stjr# Permission to copy, redistribute or otherwise 8134437Stjr# use this file is hereby granted provided that 9134437Stjr# the above copyright notice and this notice are 10134437Stjr# left intact. 11134437Stjr# 12134437Stjr# Please send copies of changes and bug-fixes to: 13134437Stjr# sjg@crufty.net 14134437Stjr# 15134437Stjr 16134437Stjr# This only makes sense in meta mode. 17134437Stjr# This allows a mixture of auto generated as well as manually edited 18134437Stjr# dependency files, which can be differentiated by their names. 19134437Stjr# As per dirdeps.mk we only require: 20134437Stjr# 1. a common prefix 21174990Sache# 2. that machine specific files end in .${MACHINE} 22134437Stjr# 23134437Stjr# The .MAKE.DEPENDFILE_PREFERENCE below is an example. 24134437Stjr 25134437Stjr# All depend file names should start with this 26134437Stjr.MAKE.DEPENDFILE_PREFIX ?= Makefile.depend 27134437Stjr 28134437Stjr.if !empty(.MAKE.DEPENDFILE) && \ 29134437Stjr ${.MAKE.DEPENDFILE:M${.MAKE.DEPENDFILE_PREFIX}*} == "" 30134437Stjr# let us do our thing below... 31134437Stjr.undef .MAKE.DEPENDFILE 32134437Stjr.endif 33134437Stjr 34134437Stjr# The order of preference: we will use the first one of these we find. 35134437Stjr# It usually makes sense to order from most specific to least. 36174990Sache.MAKE.DEPENDFILE_PREFERENCE ?= \ 37134437Stjr ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ 38134437Stjr ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX} 39134437Stjr 40134437Stjr# Normally the 1st entry is our default choice 41134437Stjr# Another useful default is ${.MAKE.DEPENDFILE_PREFIX} 42134437Stjr.MAKE.DEPENDFILE_DEFAULT ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]} 43134437Stjr 44134437Stjr_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@} 45134437Stjr.if !empty(_e) 46174990Sache.MAKE.DEPENDFILE := ${_e:[1]} 47134437Stjr.elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_DEFAULT:E} != ${MACHINE} 48134437Stjr# MACHINE specific depend files are supported, but *not* default. 49134437Stjr# If any already exist, we should follow suit. 50134437Stjr_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE} 51134437Stjr# make sure we restore MACHINE 52134437Stjr_m := ${MACHINE} 53134437Stjr_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@} 54134437StjrMACHINE := ${_m} 55134437Stjr.if !empty(_e) 56134437Stjr.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]} 57134437Stjr.endif 58134437Stjr.endif 59134437Stjr.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT} 60134437Stjr