| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: find-files.mk,v 1.5 2010/05/02 23:59:29 obache Exp $ | | 1 | # $NetBSD: find-files.mk,v 1.6 2010/05/03 05:52:59 obache Exp $ |
2 | # | | 2 | # |
3 | # Copyright (c) 2005 The NetBSD Foundation, Inc. | | 3 | # Copyright (c) 2005 The NetBSD Foundation, Inc. |
4 | # All rights reserved. | | 4 | # All rights reserved. |
5 | # | | 5 | # |
6 | # This code is derived from software contributed to The NetBSD Foundation | | 6 | # This code is derived from software contributed to The NetBSD Foundation |
7 | # by Johnny C. Lam. | | 7 | # by Johnny C. Lam. |
8 | # | | 8 | # |
9 | # Redistribution and use in source and binary forms, with or without | | 9 | # Redistribution and use in source and binary forms, with or without |
10 | # modification, are permitted provided that the following conditions | | 10 | # modification, are permitted provided that the following conditions |
11 | # are met: | | 11 | # are met: |
12 | # 1. Redistributions of source code must retain the above copyright | | 12 | # 1. Redistributions of source code must retain the above copyright |
13 | # notice, this list of conditions and the following disclaimer. | | 13 | # notice, this list of conditions and the following disclaimer. |
14 | # 2. Redistributions in binary form must reproduce the above copyright | | 14 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -74,38 +74,38 @@ | | | @@ -74,38 +74,38 @@ |
74 | | | 74 | |
75 | .if empty(USE_TOOLS:Mecho) | | 75 | .if empty(USE_TOOLS:Mecho) |
76 | USE_TOOLS+= echo | | 76 | USE_TOOLS+= echo |
77 | .endif | | 77 | .endif |
78 | .if empty(USE_TOOLS:Mgrep) | | 78 | .if empty(USE_TOOLS:Mgrep) |
79 | USE_TOOLS+= grep | | 79 | USE_TOOLS+= grep |
80 | .endif | | 80 | .endif |
81 | | | 81 | |
82 | .for _var_ in ${BUILTIN_FIND_FILES_VAR} | | 82 | .for _var_ in ${BUILTIN_FIND_FILES_VAR} |
83 | . if !defined(${_var_}) | | 83 | . if !defined(${_var_}) |
84 | ${_var_}= __nonexistent__ | | 84 | ${_var_}= __nonexistent__ |
85 | . for _file_ in ${BUILTIN_FIND_FILES.${_var_}} | | 85 | . for _file_ in ${BUILTIN_FIND_FILES.${_var_}} |
86 | . if !empty(${_var_}:M__nonexistent__) | | 86 | . if !empty(${_var_}:M__nonexistent__) |
87 | _real_file_= __noexistent__ | | 87 | _real_file_= __nonexistent__ |
88 | . if exists(${_file_}) | | 88 | . if exists(${_file_}) |
89 | _real_file_= ${_file_} | | 89 | _real_file_= ${_file_} |
90 | . endif | | 90 | . endif |
91 | . if !empty(_real_file_:M__noexistent__) && defined(BEINCLUDES) && !empty(BEINCLUDES) | | 91 | . if !empty(_real_file_:M__nonexistent__) && defined(BEINCLUDES) && !empty(BEINCLUDES) |
92 | . for _try_file_ in ${BEINCLUDES:S/;/ /g:=${_file_:S/\/usr\/include\//\//g}} | | 92 | . for _try_file_ in ${BEINCLUDES:S/;/ /g:=${_file_:S/\/usr\/include\//\//g}} |
93 | . if !empty(_real_file_:M__noexistent__) && exists(${_try_file_}) | | 93 | . if !empty(_real_file_:M__nonexistent__) && exists(${_try_file_}) |
94 | _real_file_= ${_try_file_} | | 94 | _real_file_= ${_try_file_} |
95 | . endif | | 95 | . endif |
96 | . endfor | | 96 | . endfor |
97 | . endif | | 97 | . endif |
98 | . if empty(_real_file_:M__noexistent__) | | 98 | . if empty(_real_file_:M__nonexistent__) |
99 | . if !defined(BUILTIN_FIND_GREP.${_var_}) | | 99 | . if !defined(BUILTIN_FIND_GREP.${_var_}) |
100 | ${_var_}:= ${_real_file_} | | 100 | ${_var_}:= ${_real_file_} |
101 | . else | | 101 | . else |
102 | ${_var_}!= \ | | 102 | ${_var_}!= \ |
103 | if ${GREP} -q ${BUILTIN_FIND_GREP.${_var_}:Q} ${_real_file_:Q}; then \ | | 103 | if ${GREP} -q ${BUILTIN_FIND_GREP.${_var_}:Q} ${_real_file_:Q}; then \ |
104 | ${ECHO} ${_real_file_:Q}; \ | | 104 | ${ECHO} ${_real_file_:Q}; \ |
105 | else \ | | 105 | else \ |
106 | ${ECHO} __nonexistent__; \ | | 106 | ${ECHO} __nonexistent__; \ |
107 | fi | | 107 | fi |
108 | . endif | | 108 | . endif |
109 | . endif | | 109 | . endif |
110 | . endif | | 110 | . endif |
111 | . endfor | | 111 | . endfor |