sys.dependfile.mk revision 246149
1# $Id: sys.dependfile.mk,v 1.4 2012/11/08 18:31:42 sjg Exp $
2#
3#	@(#) Copyright (c) 2012, Simon J. Gerraty
4#
5#	This file is provided in the hope that it will
6#	be of use.  There is absolutely NO WARRANTY.
7#	Permission to copy, redistribute or otherwise
8#	use this file is hereby granted provided that 
9#	the above copyright notice and this notice are
10#	left intact. 
11#      
12#	Please send copies of changes and bug-fixes to:
13#	sjg@crufty.net
14#
15
16# This only makes sense in meta mode.
17# This allows a mixture of auto generated as well as manually edited
18# dependency files, which can be differentiated by their names.
19# As per dirdeps.mk we only require:
20# 1. a common prefix
21# 2. that machine specific files end in .${MACHINE}
22#
23# The .MAKE.DEPENDFILE_PREFERENCE below is an example.
24
25# All depend file names should start with this
26.MAKE.DEPENDFILE_PREFIX ?= Makefile.depend
27
28# The order of preference: we will use the first one of these we find
29# otherwise the 1st entry will be used by default.
30.MAKE.DEPENDFILE_PREFERENCE ?= \
31	${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
32	${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}
33
34_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}
35.if !empty(_e)
36.MAKE.DEPENDFILE := ${_e:[1]}
37.elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_PREFERENCE:[1]:E} != ${MACHINE}
38# MACHINE specific depend files are supported, but *not* default.
39# If any already exist, we should follow suit.
40_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
41# MACHINE must be the last entry in _aml ;-)
42_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
43.if !empty(_e)
44.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
45.endif
46.endif
47.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]}
48