2 # $Id: sys.dependfile.mk,v 1.7 2016/02/20 01:57:39 sjg Exp $
4 # @(#) Copyright (c) 2012, Simon J. Gerraty
6 # This file is provided in the hope that it will
7 # be of use. There is absolutely NO WARRANTY.
8 # Permission to copy, redistribute or otherwise
9 # use this file is hereby granted provided that
10 # the above copyright notice and this notice are
13 # Please send copies of changes and bug-fixes to:
17 # This only makes sense in meta mode.
18 # This allows a mixture of auto generated as well as manually edited
19 # dependency files, which can be differentiated by their names.
20 # As per dirdeps.mk we only require:
22 # 2. that machine specific files end in .${MACHINE}
24 # The .MAKE.DEPENDFILE_PREFERENCE below is an example.
26 # All depend file names should start with this
27 .MAKE.DEPENDFILE_PREFIX ?= Makefile.depend
29 .if !empty(.MAKE.DEPENDFILE) && \
30 ${.MAKE.DEPENDFILE:M${.MAKE.DEPENDFILE_PREFIX}*} == ""
31 # let us do our thing below...
32 .undef .MAKE.DEPENDFILE
35 # The order of preference: we will use the first one of these we find.
36 # It usually makes sense to order from most specific to least.
37 .MAKE.DEPENDFILE_PREFERENCE ?= \
38 ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \
39 ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}
41 # Normally the 1st entry is our default choice
42 # Another useful default is ${.MAKE.DEPENDFILE_PREFIX}
43 .MAKE.DEPENDFILE_DEFAULT ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]}
45 _e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}
47 .MAKE.DEPENDFILE := ${_e:[1]}
48 .elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_DEFAULT:E} != ${MACHINE}
49 # MACHINE specific depend files are supported, but *not* default.
50 # If any already exist, we should follow suit.
51 _aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE}
52 # make sure we restore MACHINE
54 _e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@}
57 .MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]}
60 .MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT}