1249033Ssjg# $Id: sys.dependfile.mk,v 1.5 2013/03/08 00:59:21 sjg Exp $
2246149Ssjg#
3246149Ssjg#	@(#) Copyright (c) 2012, Simon J. Gerraty
4246149Ssjg#
5246149Ssjg#	This file is provided in the hope that it will
6246149Ssjg#	be of use.  There is absolutely NO WARRANTY.
7246149Ssjg#	Permission to copy, redistribute or otherwise
8246149Ssjg#	use this file is hereby granted provided that 
9246149Ssjg#	the above copyright notice and this notice are
10246149Ssjg#	left intact. 
11246149Ssjg#      
12246149Ssjg#	Please send copies of changes and bug-fixes to:
13246149Ssjg#	sjg@crufty.net
14246149Ssjg#
15246149Ssjg
16246149Ssjg# This only makes sense in meta mode.
17246149Ssjg# This allows a mixture of auto generated as well as manually edited
18246149Ssjg# dependency files, which can be differentiated by their names.
19246149Ssjg# As per dirdeps.mk we only require:
20246149Ssjg# 1. a common prefix
21246149Ssjg# 2. that machine specific files end in .${MACHINE}
22246149Ssjg#
23246149Ssjg# The .MAKE.DEPENDFILE_PREFERENCE below is an example.
24246149Ssjg
25246149Ssjg# All depend file names should start with this
26246149Ssjg.MAKE.DEPENDFILE_PREFIX ?= Makefile.depend
27246149Ssjg
28249033Ssjg# The order of preference: we will use the first one of these we find.
29249033Ssjg# It usually makes sense to order from most specific to least.
30246149Ssjg.MAKE.DEPENDFILE_PREFERENCE ?= \
31246149Ssjg	${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
32246149Ssjg	${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}
33246149Ssjg
34249033Ssjg# Normally the 1st entry is our default choice
35249033Ssjg# Another useful default is ${.MAKE.DEPENDFILE_PREFIX}
36249033Ssjg.MAKE.DEPENDFILE_DEFAULT ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]}
37249033Ssjg
38246149Ssjg_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}
39246149Ssjg.if !empty(_e)
40246149Ssjg.MAKE.DEPENDFILE := ${_e:[1]}
41249033Ssjg.elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_DEFAULT:E} != ${MACHINE}
42246149Ssjg# MACHINE specific depend files are supported, but *not* default.
43246149Ssjg# If any already exist, we should follow suit.
44246149Ssjg_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
45246149Ssjg# MACHINE must be the last entry in _aml ;-)
46246149Ssjg_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
47246149Ssjg.if !empty(_e)
48246149Ssjg.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
49246149Ssjg.endif
50246149Ssjg.endif
51249033Ssjg.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT}
52