From 0a410cf402eef3cc56876659ee046166b1a527cc Mon Sep 17 00:00:00 2001 From: obache Date: Sun, 2 May 2010 23:59:29 +0000 Subject: Fixes r1.3, and recommit. Assign with expansion to avoid confusion if this file is included multiply. --- mk/buildlink3/find-files.mk | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'mk/buildlink3') diff --git a/mk/buildlink3/find-files.mk b/mk/buildlink3/find-files.mk index ee9c98be7c1..0398e9ebc1e 100644 --- a/mk/buildlink3/find-files.mk +++ b/mk/buildlink3/find-files.mk @@ -1,4 +1,4 @@ -# $NetBSD: find-files.mk,v 1.4 2010/05/02 20:26:13 wiz Exp $ +# $NetBSD: find-files.mk,v 1.5 2010/05/02 23:59:29 obache Exp $ # # Copyright (c) 2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -83,17 +83,30 @@ USE_TOOLS+= grep . if !defined(${_var_}) ${_var_}= __nonexistent__ . for _file_ in ${BUILTIN_FIND_FILES.${_var_}} -. if !empty(${_var_}:M__nonexistent__) && exists(${_file_}) +. if !empty(${_var_}:M__nonexistent__) +_real_file_= __noexistent__ +. if exists(${_file_}) +_real_file_= ${_file_} +. endif +. if !empty(_real_file_:M__noexistent__) && defined(BEINCLUDES) && !empty(BEINCLUDES) +. for _try_file_ in ${BEINCLUDES:S/;/ /g:=${_file_:S/\/usr\/include\//\//g}} +. if !empty(_real_file_:M__noexistent__) && exists(${_try_file_}) +_real_file_= ${_try_file_} +. endif +. endfor +. endif +. if empty(_real_file_:M__noexistent__) . if !defined(BUILTIN_FIND_GREP.${_var_}) -${_var_}= ${_file_} +${_var_}:= ${_real_file_} . else ${_var_}!= \ - if ${GREP} -q ${BUILTIN_FIND_GREP.${_var_}:Q} ${_file_:Q}; then \ - ${ECHO} ${_file_:Q}; \ + if ${GREP} -q ${BUILTIN_FIND_GREP.${_var_}:Q} ${_real_file_:Q}; then \ + ${ECHO} ${_real_file_:Q}; \ else \ ${ECHO} __nonexistent__; \ fi . endif +. endif . endif . endfor . endif -- cgit v1.2.3