summaryrefslogtreecommitdiff
path: root/mk/buildlink3
diff options
context:
space:
mode:
Diffstat (limited to 'mk/buildlink3')
-rw-r--r--mk/buildlink3/find-files.mk23
1 files changed, 18 insertions, 5 deletions
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