1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 # miscelaneous helper rules
17 # Utility rules; no side effects on these
20 # /FGrist path to file ;
22 # Returns a single string that is used as grist
30 return $(<:G=$(SOURCE_GRIST:E)) ;
34 ## LOCAL CHANGE: OPT_HEADER_CACHE_EXT
35 # With header caching, there is no performance penalty to gristing
36 # header files. It is also not correct to assume that header
37 # files have global visibility.
39 # So FGristSourceFiles is the same as FGristFiles
40 #rule FGristSourceFiles
44 if $(1) { return [ FReverse $(1[2-]) ] $(1[1]) ; }
49 # If $(>) is the path to the current directory, compute the
50 # path (using ../../ etc) back to that root directory.
58 for _i in $(<[2-]) { _d = $(_d:R=$(DOTDOT)) ; }
65 # FStripCommon v1 : v2 ;
67 # Strip common initial elements of variables v1 and v2.
68 # Modifies the variable values themselves.
69 if $($(<)[1]) && $($(<)[1]) = $($(>)[1]) {
72 FStripCommon $(<) : $(>) ;
80 # first strip off common parts
83 FStripCommon _l : _r ;
85 # now make path to root and path down
86 _l = [ FSubDir $(_l) ] ;
87 _r = [ FDirName $(_r) ] ;
89 # Concatenate and save
90 # XXX This should be better
91 if $(_r) = $(DOT) { return $(_l) ; } else { return $(_r:R=$(_l)) ; }
96 # E.g., "FAppendSuffix yacc lex foo.bat : $(SUFEXE) ;"
97 # returns (yacc,lex,foo.bat) on Unix and
98 # (yacc.exe,lex.exe,foo.bat) on NT.
103 if $(_i:S) { _o += $(_i) ; } else { _o += $(_i:S=$(>)) ; }
113 # Operating system specific utility rules
114 # First, the (generic) UNIX versions
117 rule FQuote { return '\"$(<)\"' ; }
118 rule FDefines { return -D$(<) ; }
119 rule FIncludes { return -I$(<) ; }
122 # Turn individual elements in $(<) into a usable path.
126 for _i in $(<) { _s = $(_i:R=$(_s)) ; }
131 if $(NT) && $(JAM_TOOLSET) != MINGW && $(JAM_TOOLSET) != LCC {
132 rule FDefines { return /D$(<) ; }
133 rule FIncludes { return /I$(<) ; }
137 rule sys-have-command {
138 if [ Command "which $(1:Q) 2>/dev/null 1>&2" ] {
147 UNDEFS on [ FAppendSuffix $(<) : $(SUFEXE) ] += $(UNDEFFLAG)$(>) ;
152 if ( "gcc" in $(CC) ) || ( $(JAM_TOOLSET) = MINGW ) { return "tan"; }
158 if ( "gcc" in $(C++) ) || ( $(JAM_TOOLSET) = MINGW ) { return "tan"; }