1*10ea6facSSimon J. Gerraty# $Id: gendirdeps.mk,v 1.25 2014/03/14 21:28:37 sjg Exp $ 27750ad47SMarcel Moolenaar 34ed4429cSSimon J. Gerraty# Copyright (c) 2010-2013, Juniper Networks, Inc. 44ed4429cSSimon J. Gerraty# All rights reserved. 57750ad47SMarcel Moolenaar# 67750ad47SMarcel Moolenaar# Redistribution and use in source and binary forms, with or without 77750ad47SMarcel Moolenaar# modification, are permitted provided that the following conditions 87750ad47SMarcel Moolenaar# are met: 97750ad47SMarcel Moolenaar# 1. Redistributions of source code must retain the above copyright 107750ad47SMarcel Moolenaar# notice, this list of conditions and the following disclaimer. 117750ad47SMarcel Moolenaar# 2. Redistributions in binary form must reproduce the above copyright 127750ad47SMarcel Moolenaar# notice, this list of conditions and the following disclaimer in the 137750ad47SMarcel Moolenaar# documentation and/or other materials provided with the distribution. 147750ad47SMarcel Moolenaar# 157750ad47SMarcel Moolenaar# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 167750ad47SMarcel Moolenaar# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 177750ad47SMarcel Moolenaar# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 187750ad47SMarcel Moolenaar# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 197750ad47SMarcel Moolenaar# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 207750ad47SMarcel Moolenaar# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 217750ad47SMarcel Moolenaar# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 227750ad47SMarcel Moolenaar# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 237750ad47SMarcel Moolenaar# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 247750ad47SMarcel Moolenaar# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 257750ad47SMarcel Moolenaar# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 267750ad47SMarcel Moolenaar 277750ad47SMarcel Moolenaar# 287750ad47SMarcel Moolenaar# This makefile [re]generates ${.MAKE.DEPENDFILE} 297750ad47SMarcel Moolenaar# 307750ad47SMarcel Moolenaar 317750ad47SMarcel Moolenaar.include <install-new.mk> 327750ad47SMarcel Moolenaar 337750ad47SMarcel Moolenaar# Assumptions: 347750ad47SMarcel Moolenaar# RELDIR is the relative path from ${SRCTOP} to ${_CURDIR} 357750ad47SMarcel Moolenaar# (SRCTOP is ${SB}/src) 367750ad47SMarcel Moolenaar# _CURDIR is the absolute version of ${.CURDIR} 377750ad47SMarcel Moolenaar# _OBJDIR is the absolute version of ${.OBJDIR} 387750ad47SMarcel Moolenaar# _objroot is realpath of ${_OBJTOP} without ${MACHINE} 397750ad47SMarcel Moolenaar# this may be different from _OBJROOT if $SB/obj is a 407750ad47SMarcel Moolenaar# symlink to another filesystem. 417750ad47SMarcel Moolenaar# _objroot must be a prefix match for _objtop 427750ad47SMarcel Moolenaar 437750ad47SMarcel Moolenaar.MAIN: all 447750ad47SMarcel Moolenaar 457750ad47SMarcel Moolenaar# keep this simple 467750ad47SMarcel Moolenaar.MAKE.MODE = compat 477750ad47SMarcel Moolenaar 487750ad47SMarcel Moolenaarall: 497750ad47SMarcel Moolenaar 507750ad47SMarcel Moolenaar_CURDIR ?= ${.CURDIR} 517750ad47SMarcel Moolenaar_OBJDIR ?= ${.OBJDIR} 527750ad47SMarcel Moolenaar_OBJTOP ?= ${OBJTOP} 537750ad47SMarcel Moolenaar_OBJROOT ?= ${OBJROOT:U${_OBJTOP}} 5410cd22b1SSimon J. Gerraty.if ${_OBJROOT:M*/} 5510cd22b1SSimon J. Gerraty_slash=/ 5610cd22b1SSimon J. Gerraty.else 5710cd22b1SSimon J. Gerraty_slash= 5810cd22b1SSimon J. Gerraty.endif 5910cd22b1SSimon J. Gerraty_objroot ?= ${_OBJROOT:tA}${_slash} 607750ad47SMarcel Moolenaar 617750ad47SMarcel Moolenaar_this = ${.PARSEDIR}/${.PARSEFILE} 627750ad47SMarcel Moolenaar 637750ad47SMarcel Moolenaar# remember what to make 647750ad47SMarcel Moolenaar_DEPENDFILE := ${_CURDIR}/${.MAKE.DEPENDFILE:T} 657750ad47SMarcel Moolenaar 667750ad47SMarcel Moolenaar# We do _not_ want to read our own output! 677750ad47SMarcel Moolenaar.MAKE.DEPENDFILE = /dev/null 687750ad47SMarcel Moolenaar 697750ad47SMarcel Moolenaar# caller should have set this 707750ad47SMarcel MoolenaarMETA_FILES ?= ${.MAKE.META.FILES} 717750ad47SMarcel Moolenaar 727750ad47SMarcel Moolenaar.if !empty(META_FILES) 737750ad47SMarcel Moolenaar 747750ad47SMarcel Moolenaar.if ${.MAKE.LEVEL} > 0 && !empty(GENDIRDEPS_FILTER) 757750ad47SMarcel Moolenaar# so we can compare below 767750ad47SMarcel Moolenaar.-include <${_DEPENDFILE}> 777750ad47SMarcel Moolenaar# yes, I mean :U with no value 787750ad47SMarcel Moolenaar_DIRDEPS := ${DIRDEPS:U:O:u} 797750ad47SMarcel Moolenaar.endif 807750ad47SMarcel Moolenaar 817750ad47SMarcel MoolenaarMETA_FILES := ${META_FILES:T:O:u} 827750ad47SMarcel Moolenaar.export META_FILES 837750ad47SMarcel Moolenaar 847750ad47SMarcel Moolenaar# pickup customizations 857750ad47SMarcel Moolenaar.-include "local.gendirdeps.mk" 867750ad47SMarcel Moolenaar 877750ad47SMarcel Moolenaar# these are actually prefixes that we'll skip 887750ad47SMarcel Moolenaar# they should all be absolute paths 897750ad47SMarcel MoolenaarSKIP_GENDIRDEPS ?= 907750ad47SMarcel Moolenaar.if !empty(SKIP_GENDIRDEPS) 917750ad47SMarcel Moolenaar_skip_gendirdeps = egrep -v '^(${SKIP_GENDIRDEPS:O:u:ts|})' | 927750ad47SMarcel Moolenaar.else 937750ad47SMarcel Moolenaar_skip_gendirdeps = 947750ad47SMarcel Moolenaar.endif 957750ad47SMarcel Moolenaar 967750ad47SMarcel Moolenaar# this (*should* be set in meta.sys.mk) 977750ad47SMarcel Moolenaar# is the script that extracts what we want. 987750ad47SMarcel MoolenaarMETA2DEPS ?= ${.PARSEDIR}/meta2deps.sh 997750ad47SMarcel MoolenaarMETA2DEPS := ${META2DEPS} 1007750ad47SMarcel Moolenaar 1017750ad47SMarcel Moolenaar.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" && ${DEBUG_GENDIRDEPS:Uno:Mmeta2d*} != "" 1027750ad47SMarcel Moolenaar_time = time 1037750ad47SMarcel Moolenaar_sh_x = sh -x 1047750ad47SMarcel Moolenaar_py_d = -ddd 1057750ad47SMarcel Moolenaar.else 1067750ad47SMarcel Moolenaar_time = 1077750ad47SMarcel Moolenaar_sh_x = 1087750ad47SMarcel Moolenaar_py_d = 1097750ad47SMarcel Moolenaar.endif 1107750ad47SMarcel Moolenaar 1117750ad47SMarcel Moolenaar.if ${META2DEPS:E} == "py" 1127750ad47SMarcel Moolenaar# we can afford to do this all the time. 1137750ad47SMarcel MoolenaarDPDEPS ?= no 11406137b0fSSimon J. GerratyMETA2DEPS_CMD = ${_time} ${PYTHON} ${META2DEPS} ${_py_d} 11506137b0fSSimon J. Gerraty.if ${DPDEPS:tl} != "no" 11606137b0fSSimon J. GerratyMETA2DEPS_CMD += -D ${DPDEPS} 11706137b0fSSimon J. Gerraty.endif 11806137b0fSSimon J. GerratyMETA2DEPS_FILTER = sed 's,^src:,${SRCTOP}/,;s,^\([^/]\),${OBJTOP}/\1,' | 11906137b0fSSimon J. Gerraty.elif ${META2DEPS:E} == "sh" 12006137b0fSSimon J. GerratyMETA2DEPS_CMD = ${_time} ${_sh_x} ${META2DEPS} OBJTOP=${_OBJTOP} 12106137b0fSSimon J. Gerraty.else 12206137b0fSSimon J. GerratyMETA2DEPS_CMD ?= ${META2DEPS} 12306137b0fSSimon J. Gerraty.endif 1244ed4429cSSimon J. Gerraty 12501f18a0cSSimon J. Gerraty.if ${TARGET_OBJ_SPEC:U${MACHINE}} != ${MACHINE} 12601f18a0cSSimon J. GerratyMETA2DEPS_CMD += -T ${TARGET_OBJ_SPEC} 12701f18a0cSSimon J. Gerraty.endif 12806137b0fSSimon J. GerratyMETA2DEPS_CMD += \ 12906137b0fSSimon J. Gerraty -R ${RELDIR} -H ${HOST_TARGET} \ 13006137b0fSSimon J. Gerraty ${M2D_OBJROOTS:O:u:@o@-O $o@} 13106137b0fSSimon J. Gerraty 1324ed4429cSSimon J. Gerraty 133876336c8SSimon J. GerratyM2D_OBJROOTS += ${OBJTOP} ${_OBJROOT} ${_objroot} 1344ed4429cSSimon J. Gerraty.if defined(SB_OBJROOT) 1354ed4429cSSimon J. GerratyM2D_OBJROOTS += ${SB_OBJROOT} 1364ed4429cSSimon J. Gerraty.endif 1377750ad47SMarcel Moolenaar.if ${.MAKE.DEPENDFILE_PREFERENCE:U${.MAKE.DEPENDFILE}:M*.${MACHINE}} == "" 1387750ad47SMarcel Moolenaar# meta2deps.py only groks objroot 1397750ad47SMarcel Moolenaar# so we need to give it what it expects 1407750ad47SMarcel Moolenaar# and tell it not to add machine qualifiers 1417750ad47SMarcel MoolenaarMETA2DEPS_ARGS += MACHINE=none 1427750ad47SMarcel Moolenaar.endif 1437750ad47SMarcel Moolenaar.if defined(SB_BACKING_SB) 1444ed4429cSSimon J. GerratyMETA2DEPS_CMD += -S ${SB_BACKING_SB}/src 1454ed4429cSSimon J. GerratyM2D_OBJROOTS += ${SB_BACKING_SB}/${SB_OBJPREFIX} 1467750ad47SMarcel Moolenaar.endif 1477750ad47SMarcel Moolenaar 1487750ad47SMarcel Moolenaar# we are only interested in the dirs 1497750ad47SMarcel Moolenaar# sepecifically those we read something from. 1507750ad47SMarcel Moolenaar# we canonicalize them to keep things simple 1517750ad47SMarcel Moolenaar# if we are using a split-fs sandbox, it gets a little messier. 1527750ad47SMarcel Moolenaar_objtop := ${_OBJTOP:tA} 1537750ad47SMarcel Moolenaardir_list != cd ${_OBJDIR} && \ 1547750ad47SMarcel Moolenaar ${META2DEPS_CMD} MACHINE=${MACHINE} \ 1557750ad47SMarcel Moolenaar SRCTOP=${SRCTOP} RELDIR=${RELDIR} CURDIR=${_CURDIR} \ 1567750ad47SMarcel Moolenaar ${META2DEPS_ARGS} \ 1577750ad47SMarcel Moolenaar ${META_FILES:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ 1587750ad47SMarcel Moolenaar sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,' 1597750ad47SMarcel Moolenaar 1607750ad47SMarcel Moolenaar.if ${dir_list:M*ERROR\:*} != "" 1617750ad47SMarcel Moolenaar.warning ${dir_list:tW:C,.*(ERROR),\1,} 1627750ad47SMarcel Moolenaar.warning Skipping ${_DEPENDFILE:S,${SRCTOP}/,,} 1637750ad47SMarcel Moolenaar# we are not going to update anything 1647750ad47SMarcel Moolenaar.else 165*10ea6facSSimon J. Gerratydpadd_dir_list= 1667750ad47SMarcel Moolenaar.if !empty(DPADD) 1677750ad47SMarcel Moolenaar_nonlibs := ${DPADD:T:Nlib*:N*include} 1687750ad47SMarcel Moolenaar.if !empty(_nonlibs) 169c2ec0b51SSimon J. Gerratyddep_list = 1702cb6de20SSimon J. Gerraty.for f in ${_nonlibs:@x@${DPADD:M*/$x}@} 171c2ec0b51SSimon J. Gerraty.if exists($f.dirdep) 172c2ec0b51SSimon J. Gerratyddep_list += $f.dirdep 173c2ec0b51SSimon J. Gerraty.elif exists(${f:H}.dirdep) 174c2ec0b51SSimon J. Gerratyddep_list += ${f:H}.dirdep 175c2ec0b51SSimon J. Gerraty.else 1762cb6de20SSimon J. Gerratydir_list += ${f:H:tA} 177*10ea6facSSimon J. Gerratydpadd_dir_list += ${f:H:tA} 178c2ec0b51SSimon J. Gerraty.endif 179c2ec0b51SSimon J. Gerraty.endfor 180c2ec0b51SSimon J. Gerraty.if !empty(ddep_list) 181c2ec0b51SSimon J. Gerratyddeps != cat ${ddep_list:O:u} | ${META2DEPS_FILTER} ${_skip_gendirdeps} \ 182876336c8SSimon J. Gerraty sed 's,//*$$,,;s,\.${HOST_TARGET}$$,.host,;s,\.${MACHINE}$$,,' 183876336c8SSimon J. Gerraty 184876336c8SSimon J. Gerraty.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" 185876336c8SSimon J. Gerraty.info ${RELDIR}: raw_dir_list='${dir_list}' 186876336c8SSimon J. Gerraty.info ${RELDIR}: ddeps='${ddeps}' 187876336c8SSimon J. Gerraty.endif 188c2ec0b51SSimon J. Gerratydir_list += ${ddeps} 189c2ec0b51SSimon J. Gerraty.endif 1907750ad47SMarcel Moolenaar.endif 1917750ad47SMarcel Moolenaar.endif 1927750ad47SMarcel Moolenaar 1937750ad47SMarcel Moolenaar# DIRDEPS represent things that had to have been built first 1947750ad47SMarcel Moolenaar# so they should all be undir OBJTOP. 1957750ad47SMarcel Moolenaar# Note that ${_OBJTOP}/bsd/include/machine will get reported 1967750ad47SMarcel Moolenaar# to us as $SRCTOP/bsd/sys/$MACHINE_ARCH/include meaning we 1977750ad47SMarcel Moolenaar# will want to visit bsd/include 1987750ad47SMarcel Moolenaar# so we add 1997750ad47SMarcel Moolenaar# ${"${dir_list:M*bsd/sys/${MACHINE_ARCH}/include}":?bsd/include:} 2007750ad47SMarcel Moolenaar# to GENDIRDEPS_DIR_LIST_XTRAS 201*10ea6facSSimon J. Gerraty_objtops = ${OBJTOP} ${_OBJTOP} ${_objtop} 202876336c8SSimon J. Gerraty_objtops := ${_objtops:O:u} 2037750ad47SMarcel Moolenaardirdep_list = \ 204876336c8SSimon J. Gerraty ${_objtops:@o@${dir_list:M$o*/*:C,$o[^/]*/,,}@} \ 2057750ad47SMarcel Moolenaar ${GENDIRDEPS_DIR_LIST_XTRAS} 2067750ad47SMarcel Moolenaar 207c2ec0b51SSimon J. Gerraty# sort longest first 208c2ec0b51SSimon J. GerratyM2D_OBJROOTS := ${M2D_OBJROOTS:O:u:[-1..1]} 209c2ec0b51SSimon J. Gerraty 2107750ad47SMarcel Moolenaar# anything we use from an object dir other than ours 2117750ad47SMarcel Moolenaar# needs to be qualified with its .<machine> suffix 2127750ad47SMarcel Moolenaar# (we used the pseudo machine "host" for the HOST_TARGET). 213876336c8SSimon J. Gerratyskip_ql= ${SRCTOP}* ${_objtops:@o@$o*@} 214c2ec0b51SSimon J. Gerraty.for o in ${M2D_OBJROOTS:${skip_ql:${M_ListToSkip}}} 215876336c8SSimon J. Gerraty# we need := so only skip_ql to this point applies 216*10ea6facSSimon J. Gerratyql.$o := ${dir_list:${skip_ql:${M_ListToSkip}}:M$o*/*/*:C,$o([^/]+)/(.*),\2.\1,:S,.${HOST_TARGET},.host,} 217*10ea6facSSimon J. Gerratyqualdir_list += ${ql.$o} 218*10ea6facSSimon J. Gerraty.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" 219*10ea6facSSimon J. Gerraty.info ${RELDIR}: o=$o ${ql.$o qualdir_list:L:@v@$v=${$v}@} 220*10ea6facSSimon J. Gerraty.endif 221c2ec0b51SSimon J. Gerratyskip_ql+= $o* 222c2ec0b51SSimon J. Gerraty.endfor 2237750ad47SMarcel Moolenaar 2247750ad47SMarcel Moolenaardirdep_list := ${dirdep_list:O:u} 225c2ec0b51SSimon J. Gerratyqualdir_list := ${qualdir_list:N*.${MACHINE}:O:u} 2267750ad47SMarcel Moolenaar 2277750ad47SMarcel MoolenaarDIRDEPS = \ 2287750ad47SMarcel Moolenaar ${dirdep_list:N${RELDIR}:N${RELDIR}/*} \ 2297750ad47SMarcel Moolenaar ${qualdir_list:N${RELDIR}.*:N${RELDIR}/*} 2307750ad47SMarcel Moolenaar 2317750ad47SMarcel Moolenaar# We only consider things below $RELDIR/ if they have a makefile. 232*10ea6facSSimon J. Gerraty# This is the same test that _DIRDEP_USE applies. 2337750ad47SMarcel Moolenaar# We have do a double test with dirdep_list as it _may_ contain 2347750ad47SMarcel Moolenaar# qualified dirs - if we got anything from a stage dir. 2357750ad47SMarcel Moolenaar# qualdir_list we know are all qualified. 2367750ad47SMarcel Moolenaar# It would be nice do peform this check for all of DIRDEPS, 2377750ad47SMarcel Moolenaar# but we cannot assume that all of the tree is present, 2387750ad47SMarcel Moolenaar# in fact we can only assume that RELDIR is. 2397750ad47SMarcel MoolenaarDIRDEPS += \ 2407750ad47SMarcel Moolenaar ${dirdep_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/$d/$m):?$d:${exists(${SRCTOP}/${d:R}/$m):?$d:}}@}@} \ 2417750ad47SMarcel Moolenaar ${qualdir_list:M${RELDIR}/*:@d@${.MAKE.MAKEFILE_PREFERENCE:@m@${exists(${SRCTOP}/${d:R}/$m):?$d:}@}@} 2427750ad47SMarcel Moolenaar 243*10ea6facSSimon J. GerratyDIRDEPS := ${DIRDEPS:${GENDIRDEPS_FILTER:UNno:ts:}:C,//+,/,g:O:u} 2447750ad47SMarcel Moolenaar 2457750ad47SMarcel Moolenaar.if ${DEBUG_GENDIRDEPS:Uno:@x@${RELDIR:M$x}@} != "" 246c2ec0b51SSimon J. Gerraty.info ${RELDIR}: M2D_OBJROOTS=${M2D_OBJROOTS} 2477750ad47SMarcel Moolenaar.info ${RELDIR}: dir_list='${dir_list}' 248*10ea6facSSimon J. Gerraty.info ${RELDIR}: dpadd_dir_list='${dpadd_dir_list}' 2497750ad47SMarcel Moolenaar.info ${RELDIR}: dirdep_list='${dirdep_list}' 2507750ad47SMarcel Moolenaar.info ${RELDIR}: qualdir_list='${qualdir_list}' 2517750ad47SMarcel Moolenaar.info ${RELDIR}: SKIP_GENDIRDEPS='${SKIP_GENDIRDEPS}' 2527750ad47SMarcel Moolenaar.info ${RELDIR}: GENDIRDEPS_FILTER='${GENDIRDEPS_FILTER}' 2537750ad47SMarcel Moolenaar.info ${RELDIR}: FORCE_DPADD='${DPADD}' 2547750ad47SMarcel Moolenaar.info ${RELDIR}: DIRDEPS='${DIRDEPS}' 2557750ad47SMarcel Moolenaar.endif 2567750ad47SMarcel Moolenaar 2577750ad47SMarcel Moolenaar# SRC_DIRDEPS is for checkout logic 2587750ad47SMarcel Moolenaarsrc_dirdep_list = \ 2597750ad47SMarcel Moolenaar ${dir_list:M${SRCTOP}/*:S,${SRCTOP}/,,} 2607750ad47SMarcel Moolenaar 2617750ad47SMarcel MoolenaarSRC_DIRDEPS = \ 2627750ad47SMarcel Moolenaar ${src_dirdep_list:N${RELDIR}:N${RELDIR}/*:C,(/h)/.*,,} 2637750ad47SMarcel Moolenaar 264*10ea6facSSimon J. GerratySRC_DIRDEPS := ${SRC_DIRDEPS:${GENDIRDEPS_SRC_FILTER:UN/*:ts:}:C,//+,/,g:O:u} 2657750ad47SMarcel Moolenaar 2667750ad47SMarcel Moolenaar# if you want to capture SRC_DIRDEPS in .MAKE.DEPENDFILE put 2677750ad47SMarcel Moolenaar# SRC_DIRDEPS_FILE = ${_DEPENDFILE} 2687750ad47SMarcel Moolenaar# in local.gendirdeps.mk 2697750ad47SMarcel Moolenaar.if ${SRC_DIRDEPS_FILE:Uno:tl} != "no" 2707750ad47SMarcel MoolenaarECHO_SRC_DIRDEPS = echo 'SRC_DIRDEPS = \'; echo '${SRC_DIRDEPS:@d@ $d \\${.newline}@}'; echo; 2717750ad47SMarcel Moolenaar 2727750ad47SMarcel Moolenaar.if ${SRC_DIRDEPS_FILE:T} == ${_DEPENDFILE:T} 2737750ad47SMarcel Moolenaar_include_src_dirdeps = ${ECHO_SRC_DIRDEPS} 2747750ad47SMarcel Moolenaar.else 2757750ad47SMarcel Moolenaarall: ${SRC_DIRDEPS_FILE} 2767750ad47SMarcel Moolenaar.if !target(${SRC_DIRDEPS_FILE}) 2777750ad47SMarcel Moolenaar${SRC_DIRDEPS_FILE}: ${META_FILES} ${_this} ${META2DEPS} 2787750ad47SMarcel Moolenaar @(${ECHO_SRC_DIRDEPS}) > $@ 2797750ad47SMarcel Moolenaar.endif 2807750ad47SMarcel Moolenaar.endif 2817750ad47SMarcel Moolenaar.endif 2827750ad47SMarcel Moolenaar_include_src_dirdeps ?= 2837750ad47SMarcel Moolenaar 2847750ad47SMarcel Moolenaarall: ${_DEPENDFILE} 2857750ad47SMarcel Moolenaar 2867750ad47SMarcel Moolenaar# if this is going to exist it would be there by now 2877750ad47SMarcel Moolenaar.if !exists(.depend) 2887750ad47SMarcel MoolenaarCAT_DEPEND = /dev/null 2897750ad47SMarcel Moolenaar.endif 2907750ad47SMarcel MoolenaarCAT_DEPEND ?= .depend 2917750ad47SMarcel Moolenaar 2927750ad47SMarcel Moolenaar.if !empty(_DIRDEPS) && ${DIRDEPS} != ${_DIRDEPS} 2937750ad47SMarcel Moolenaar# we may have changed a filter 2947750ad47SMarcel Moolenaar.PHONY: ${_DEPENDFILE} 2957750ad47SMarcel Moolenaar.endif 2967750ad47SMarcel Moolenaar 2977750ad47SMarcel Moolenaar# 'cat .depend' should suffice, but if we are mixing build modes 2987750ad47SMarcel Moolenaar# .depend may contain things we don't want. 2997750ad47SMarcel Moolenaar# The sed command at the end of the stream, allows for the filters 3007750ad47SMarcel Moolenaar# to output _{VAR} tokens which we will turn into proper ${VAR} references. 3017750ad47SMarcel Moolenaar${_DEPENDFILE}: ${CAT_DEPEND:M.depend} ${META_FILES:O:u:@m@${exists($m):?$m:}@} ${_this} ${META2DEPS} 3027750ad47SMarcel Moolenaar @(echo '# Autogenerated - do NOT edit!'; echo; \ 3037750ad47SMarcel Moolenaar echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \ 3047750ad47SMarcel Moolenaar echo 'DIRDEPS = \'; \ 3057750ad47SMarcel Moolenaar echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ 3067750ad47SMarcel Moolenaar ${_include_src_dirdeps} \ 3077750ad47SMarcel Moolenaar echo '.include <dirdeps.mk>'; \ 3087750ad47SMarcel Moolenaar echo; \ 3097750ad47SMarcel Moolenaar echo '.if $${DEP_RELDIR} == $${_DEP_RELDIR}'; \ 3107750ad47SMarcel Moolenaar echo '# local dependencies - needed for -jN in clean tree'; \ 3117750ad47SMarcel Moolenaar [ -s ${CAT_DEPEND} ] && { grep : ${CAT_DEPEND} | grep -v '[/\\]'; }; \ 3127750ad47SMarcel Moolenaar echo '.endif' ) | sed 's,_\([{(]\),$$\1,g' > $@.new${.MAKE.PID} 3137750ad47SMarcel Moolenaar @${InstallNew}; InstallNew -s $@.new${.MAKE.PID} 3147750ad47SMarcel Moolenaar 3157750ad47SMarcel Moolenaar.endif # meta2deps failed 3167750ad47SMarcel Moolenaar.elif !empty(SUBDIR) 3177750ad47SMarcel Moolenaar 3187750ad47SMarcel MoolenaarDIRDEPS := ${SUBDIR:S,^,${RELDIR}/,:O:u} 3197750ad47SMarcel Moolenaar 3207750ad47SMarcel Moolenaarall: ${_DEPENDFILE} 3217750ad47SMarcel Moolenaar 3227750ad47SMarcel Moolenaar${_DEPENDFILE}: ${MAKEFILE} ${_this} 3237750ad47SMarcel Moolenaar @(echo '# Autogenerated - do NOT edit!'; echo; \ 3247750ad47SMarcel Moolenaar echo 'DEP_RELDIR := $${_PARSEDIR:S,$${SRCTOP}/,,}'; echo; \ 3257750ad47SMarcel Moolenaar echo 'DIRDEPS = \'; \ 3267750ad47SMarcel Moolenaar echo '${DIRDEPS:@d@ $d \\${.newline}@}'; echo; \ 3277750ad47SMarcel Moolenaar echo '.include <dirdeps.mk>'; \ 3287750ad47SMarcel Moolenaar echo ) | sed 's,_\([{(]\),$$\1,g' > $@.new 3297750ad47SMarcel Moolenaar @${InstallNew}; InstallNew $@.new 3307750ad47SMarcel Moolenaar 3317750ad47SMarcel Moolenaar.else 3327750ad47SMarcel Moolenaar 3337750ad47SMarcel Moolenaar# nothing to do 3347750ad47SMarcel Moolenaarall ${_DEPENDFILE}: 3357750ad47SMarcel Moolenaar 3367750ad47SMarcel Moolenaar.endif 3377750ad47SMarcel Moolenaar${_DEPENDFILE}: .PRECIOUS 338