1297040Ssjg# $Id: sys.dependfile.mk,v 1.8 2016/03/11 01:34:13 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 28281812Ssjg.if !empty(.MAKE.DEPENDFILE) && \ 29281812Ssjg ${.MAKE.DEPENDFILE:M${.MAKE.DEPENDFILE_PREFIX}*} == "" 30281812Ssjg# let us do our thing below... 31281812Ssjg.undef .MAKE.DEPENDFILE 32281812Ssjg.endif 33281812Ssjg 34249033Ssjg# The order of preference: we will use the first one of these we find. 35249033Ssjg# It usually makes sense to order from most specific to least. 36246149Ssjg.MAKE.DEPENDFILE_PREFERENCE ?= \ 37246149Ssjg ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX}.${MACHINE} \ 38246149Ssjg ${.CURDIR}/${.MAKE.DEPENDFILE_PREFIX} 39246149Ssjg 40249033Ssjg# Normally the 1st entry is our default choice 41249033Ssjg# Another useful default is ${.MAKE.DEPENDFILE_PREFIX} 42249033Ssjg.MAKE.DEPENDFILE_DEFAULT ?= ${.MAKE.DEPENDFILE_PREFERENCE:[1]} 43249033Ssjg 44246149Ssjg_e := ${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@} 45246149Ssjg.if !empty(_e) 46246149Ssjg.MAKE.DEPENDFILE := ${_e:[1]} 47249033Ssjg.elif ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}} != "" && ${.MAKE.DEPENDFILE_DEFAULT:E} != ${MACHINE} 48246149Ssjg# MACHINE specific depend files are supported, but *not* default. 49246149Ssjg# If any already exist, we should follow suit. 50246149Ssjg_aml = ${ALL_MACHINE_LIST:Uarm amd64 i386 powerpc:N${MACHINE}} ${MACHINE} 51297040Ssjg# make sure we restore MACHINE 52296637Ssjg_m := ${MACHINE} 53246149Ssjg_e := ${_aml:@MACHINE@${.MAKE.DEPENDFILE_PREFERENCE:@m@${exists($m):?$m:}@}@} 54296637SsjgMACHINE := ${_m} 55246149Ssjg.if !empty(_e) 56246149Ssjg.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_PREFERENCE:M*${MACHINE}:[1]} 57246149Ssjg.endif 58246149Ssjg.endif 59249033Ssjg.MAKE.DEPENDFILE ?= ${.MAKE.DEPENDFILE_DEFAULT} 60