Changeset 39aab06a in rtems
- Timestamp:
- 05/18/12 05:11:47 (12 years ago)
- Branches:
- 4.11, 5, master
- Children:
- bbb69abb
- Parents:
- 8bbf69e
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
compile
r8bbf69e r39aab06a 1 1 #! /bin/sh 2 # Wrapper for compilers which do not understand `-c -o'.3 4 scriptversion=201 0-11-15.09; # UTC5 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010 Free Software7 # Foundation, Inc.2 # Wrapper for compilers which do not understand '-c -o'. 3 4 scriptversion=2012-03-05.13; # UTC 5 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free 7 # Software Foundation, Inc. 8 8 # Written by Tom Tromey <tromey@cygnus.com>. 9 9 # … … 41 41 # func_file_conv build_file lazy 42 42 # Convert a $build file to $host form and store it in $file 43 # Currently only supports Win 32hosts. If the determined conversion43 # Currently only supports Windows hosts. If the determined conversion 44 44 # type is listed in (the comma separated) LAZY, no conversion will 45 45 # take place. … … 78 78 ;; 79 79 esac 80 } 81 82 # func_cl_dashL linkdir 83 # Make cl look for libraries in LINKDIR 84 func_cl_dashL () 85 { 86 func_file_conv "$1" 87 if test -z "$lib_path"; then 88 lib_path=$file 89 else 90 lib_path="$lib_path;$file" 91 fi 92 linker_opts="$linker_opts -LIBPATH:$file" 93 } 94 95 # func_cl_dashl library 96 # Do a library search-path lookup for cl 97 func_cl_dashl () 98 { 99 lib=$1 100 found=no 101 save_IFS=$IFS 102 IFS=';' 103 for dir in $lib_path $LIB 104 do 105 IFS=$save_IFS 106 if $shared && test -f "$dir/$lib.dll.lib"; then 107 found=yes 108 lib=$dir/$lib.dll.lib 109 break 110 fi 111 if test -f "$dir/$lib.lib"; then 112 found=yes 113 lib=$dir/$lib.lib 114 break 115 fi 116 done 117 IFS=$save_IFS 118 119 if test "$found" != yes; then 120 lib=$lib.lib 121 fi 80 122 } 81 123 … … 95 137 case $1 in 96 138 -o) 97 # configure might choose to run compile as `compile cc -o foo foo.c'.139 # configure might choose to run compile as 'compile cc -o foo foo.c'. 98 140 eat=1 99 141 case $2 in … … 110 152 esac 111 153 ;; 154 -I) 155 eat=1 156 func_file_conv "$2" mingw 157 set x "$@" -I"$file" 158 shift 159 ;; 112 160 -I*) 113 161 func_file_conv "${1#-I}" mingw … … 115 163 shift 116 164 ;; 165 -l) 166 eat=1 167 func_cl_dashl "$2" 168 set x "$@" "$lib" 169 shift 170 ;; 117 171 -l*) 118 lib=${1#-l} 119 found=no 120 save_IFS=$IFS 121 IFS=';' 122 for dir in $lib_path $LIB 123 do 124 IFS=$save_IFS 125 if $shared && test -f "$dir/$lib.dll.lib"; then 126 found=yes 127 set x "$@" "$dir/$lib.dll.lib" 128 break 129 fi 130 if test -f "$dir/$lib.lib"; then 131 found=yes 132 set x "$@" "$dir/$lib.lib" 133 break 134 fi 135 done 136 IFS=$save_IFS 137 138 test "$found" != yes && set x "$@" "$lib.lib" 139 shift 172 func_cl_dashl "${1#-l}" 173 set x "$@" "$lib" 174 shift 175 ;; 176 -L) 177 eat=1 178 func_cl_dashL "$2" 140 179 ;; 141 180 -L*) 142 func_file_conv "${1#-L}" 143 if test -z "$lib_path"; then 144 lib_path=$file 145 else 146 lib_path="$lib_path;$file" 147 fi 148 linker_opts="$linker_opts -LIBPATH:$file" 181 func_cl_dashL "${1#-L}" 149 182 ;; 150 183 -static) … … 197 230 case $1 in 198 231 '') 199 echo "$0: No command. Try \`$0 --help' for more information." 1>&2232 echo "$0: No command. Try '$0 --help' for more information." 1>&2 200 233 exit 1; 201 234 ;; … … 204 237 Usage: compile [--help] [--version] PROGRAM [ARGS] 205 238 206 Wrapper for compilers which do not understand `-c -o'.207 Remove `-o dest.o' from ARGS, run PROGRAM with the remaining239 Wrapper for compilers which do not understand '-c -o'. 240 Remove '-o dest.o' from ARGS, run PROGRAM with the remaining 208 241 arguments, and rename the output as expected. 209 242 210 243 If you are trying to build a whole package this is not the 211 right script to run: please start by reading the file `INSTALL'.244 right script to run: please start by reading the file 'INSTALL'. 212 245 213 246 Report bugs to <bug-automake@gnu.org>. … … 234 267 case $1 in 235 268 -o) 236 # configure might choose to run compile as `compile cc -o foo foo.c'.237 # So we strip `-o arg' only if arg is an object.269 # configure might choose to run compile as 'compile cc -o foo foo.c'. 270 # So we strip '-o arg' only if arg is an object. 238 271 eat=1 239 272 case $2 in … … 262 295 263 296 if test -z "$ofile" || test -z "$cfile"; then 264 # If no `-o' option was seen then we might have been invoked from a297 # If no '-o' option was seen then we might have been invoked from a 265 298 # pattern rule where we don't need one. That is ok -- this is a 266 299 # normal compilation that the losing compiler can handle. If no 267 # `.c' file was seen then we are probably linking. That is also300 # '.c' file was seen then we are probably linking. That is also 268 301 # ok. 269 302 exec "$@" … … 274 307 275 308 # Create the lock directory. 276 # Note: use `[/\\:.-]' here to ensure that we don't use the same name309 # Note: use '[/\\:.-]' here to ensure that we don't use the same name 277 310 # that we are using for the .o file. Also, base the name on the expected 278 311 # object file name, since that is what matters with a parallel build. -
depcomp
r8bbf69e r39aab06a 2 2 # depcomp - compile a program generating dependencies as side-effects 3 3 4 scriptversion=201 1-12-04.11; # UTC4 scriptversion=2012-03-27.16; # UTC 5 5 6 6 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 7 # 2011 Free Software Foundation, Inc.7 # 2011, 2012 Free Software Foundation, Inc. 8 8 9 9 # This program is free software; you can redistribute it and/or modify … … 29 29 case $1 in 30 30 '') 31 echo "$0: No command. Try \`$0 --help' for more information." 1>&231 echo "$0: No command. Try '$0 --help' for more information." 1>&2 32 32 exit 1; 33 33 ;; … … 41 41 Environment variables: 42 42 depmode Dependency tracking mode. 43 source Source file read by `PROGRAMS ARGS'.44 object Object file output by `PROGRAMS ARGS'.43 source Source file read by 'PROGRAMS ARGS'. 44 object Object file output by 'PROGRAMS ARGS'. 45 45 DEPDIR directory where to store dependencies. 46 46 depfile Dependency file to output. … … 58 58 esac 59 59 60 # A tabulation character. 61 tab=' ' 62 # A newline character. 63 nl=' 64 ' 65 60 66 if test -z "$depmode" || test -z "$source" || test -z "$object"; then 61 67 echo "depcomp: Variables source, object and depmode must be set" 1>&2 … … 101 107 cygpath_u='sed s,\\\\,/,g' 102 108 depmode=msvc7 109 fi 110 111 if test "$depmode" = xlc; then 112 # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. 113 gccflag=-qmakedep=gcc,-MF 114 depmode=gcc 103 115 fi 104 116 … … 157 169 sed -e 's/^[^:]*: / /' \ 158 170 -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 159 ## This next piece of magic avoids the `deleted header file'problem.171 ## This next piece of magic avoids the "deleted header file" problem. 160 172 ## The problem is that when a header file which appears in a .P file 161 173 ## is deleted, the dependency causes make to die (because there is … … 163 175 ## dummy dependencies for each header file. Too bad gcc doesn't do 164 176 ## this for us directly. 165 tr ' ' ' 166 ' < "$tmpdepfile" | 167 ## Some versions of gcc put a space before the `:'. On the theory 177 tr ' ' "$nl" < "$tmpdepfile" | 178 ## Some versions of gcc put a space before the ':'. On the theory 168 179 ## that the space means something, we add a space to the output as 169 180 ## well. hp depmode also adds that space, but also prefixes the VPATH … … 204 215 # lines with more than a fixed number of characters (4096 in 205 216 # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 206 # the IRIX cc adds comments like `#:fec' to the end of the217 # the IRIX cc adds comments like '#:fec' to the end of the 207 218 # dependency line. 208 tr ' ' ' 209 ' < "$tmpdepfile" \ 219 tr ' ' "$nl" < "$tmpdepfile" \ 210 220 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 211 tr ' 212 ' ' ' >> "$depfile" 221 tr "$nl" ' ' >> "$depfile" 213 222 echo >> "$depfile" 214 223 215 224 # The second pass generates a dummy entry for each header file. 216 tr ' ' ' 217 ' < "$tmpdepfile" \ 225 tr ' ' "$nl" < "$tmpdepfile" \ 218 226 | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 219 227 >> "$depfile" … … 227 235 ;; 228 236 237 xlc) 238 # This case exists only to let depend.m4 do its work. It works by 239 # looking at the text of this script. This case will never be run, 240 # since it is checked for above. 241 exit 1 242 ;; 243 229 244 aix) 230 245 # The C for AIX Compiler uses -M and outputs the dependencies 231 246 # in a .u file. In older versions, this file always lives in the 232 # current directory. Also, the AIX compiler puts `$object:' at the247 # current directory. Also, the AIX compiler puts '$object:' at the 233 248 # start of each line; $object doesn't have directory information. 234 249 # Version 6 uses the directory in both cases. … … 260 275 done 261 276 if test -f "$tmpdepfile"; then 262 # Each line is of the form `foo.o: dependent.h'.277 # Each line is of the form 'foo.o: dependent.h'. 263 278 # Do two passes, one to just change these to 264 # `$object: dependent.h' and one to simply `dependent.h:'.279 # '$object: dependent.h' and one to simply 'dependent.h:'. 265 280 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 266 # That's a tab and a space in the []. 267 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 281 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 268 282 else 269 283 # The sourcefile does not contain any dependencies, so just … … 276 290 277 291 icc) 278 # Intel's C compiler understands `-MD -MF file'. However on 279 # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 292 # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. 293 # However on 294 # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c 280 295 # ICC 7.0 will fill foo.d with something like 281 296 # foo.o: sub/foo.c 282 297 # foo.o: sub/foo.h 283 # which is wrong. We want :298 # which is wrong. We want 284 299 # sub/foo.o: sub/foo.c 285 300 # sub/foo.o: sub/foo.h … … 288 303 # ICC 7.1 will output 289 304 # foo.o: sub/foo.c sub/foo.h 290 # and will wrap long lines using \:305 # and will wrap long lines using '\': 291 306 # foo.o: sub/foo.c ... \ 292 307 # sub/foo.h ... \ 293 308 # ... 294 309 # tcc 0.9.26 (FIXME still under development at the moment of writing) 310 # will emit a similar output, but also prepend the continuation lines 311 # with horizontal tabulation characters. 295 312 "$@" -MD -MF "$tmpdepfile" 296 313 stat=$? … … 301 318 fi 302 319 rm -f "$depfile" 303 # Each line is of the form `foo.o: dependent.h',304 # or `foo.o: dep1.h dep2.h \', or `dep3.h dep4.h \'.320 # Each line is of the form 'foo.o: dependent.h', 321 # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. 305 322 # Do two passes, one to just change these to 306 # `$object: dependent.h' and one to simply `dependent.h:'. 307 sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 308 # Some versions of the HPUX 10.20 sed can't process this invocation 309 # correctly. Breaking it into two sed invocations is a workaround. 310 sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 311 sed -e 's/$/ :/' >> "$depfile" 323 # '$object: dependent.h' and one to simply 'dependent.h:'. 324 sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ 325 < "$tmpdepfile" > "$depfile" 326 sed ' 327 s/[ '"$tab"'][ '"$tab"']*/ /g 328 s/^ *// 329 s/ *\\*$// 330 s/^[^:]*: *// 331 /^$/d 332 /:$/d 333 s/$/ :/ 334 ' < "$tmpdepfile" >> "$depfile" 312 335 rm -f "$tmpdepfile" 313 336 ;; … … 345 368 if test -f "$tmpdepfile"; then 346 369 sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 347 # Add `dependent.h:' lines.370 # Add 'dependent.h:' lines. 348 371 sed -ne '2,${ 349 372 s/^ *// … … 360 383 tru64) 361 384 # The Tru64 compiler uses -MD to generate dependencies as a side 362 # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.385 # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. 363 386 # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 364 # dependencies in `foo.d' instead, so we check for that too.387 # dependencies in 'foo.d' instead, so we check for that too. 365 388 # Subdirectories are respected. 366 389 dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` … … 408 431 if test -f "$tmpdepfile"; then 409 432 sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 410 # That's a tab and a space in the []. 411 sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 433 sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 412 434 else 413 435 echo "#dummy" > "$depfile" … … 444 466 }' | $cygpath_u | sort -u | sed -n ' 445 467 s/ /\\ /g 446 s/\(.*\)/ 468 s/\(.*\)/'"$tab"'\1 \\/p 447 469 s/.\(.*\) \\/\1:/ 448 470 H 449 471 $ { 450 s/.*/ 472 s/.*/'"$tab"'/ 451 473 G 452 474 p … … 479 501 fi 480 502 481 # Remove `-o $object'.503 # Remove '-o $object'. 482 504 IFS=" " 483 505 for arg … … 499 521 500 522 test -z "$dashmflag" && dashmflag=-M 501 # Require at least two characters before searching for `:'523 # Require at least two characters before searching for ':' 502 524 # in the target name. This is to cope with DOS-style filenames: 503 # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.525 # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. 504 526 "$@" $dashmflag | 505 sed 's:^[ ]*[^: ][^:][^:]*\:[]*:'"$object"'\: :' > "$tmpdepfile"527 sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" 506 528 rm -f "$depfile" 507 529 cat < "$tmpdepfile" > "$depfile" 508 tr ' ' ' 509 ' < "$tmpdepfile" | \ 530 tr ' ' "$nl" < "$tmpdepfile" | \ 510 531 ## Some versions of the HPUX 10.20 sed can't process this invocation 511 532 ## correctly. Breaking it into two sed invocations is a workaround. … … 563 584 # No need to regex-escape $object, excess matching of '.' is harmless. 564 585 sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" 565 sed '1,2d' "$tmpdepfile" | tr ' ' ' 566 ' | \ 586 sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ 567 587 ## Some versions of the HPUX 10.20 sed can't process this invocation 568 588 ## correctly. Breaking it into two sed invocations is a workaround. … … 584 604 fi 585 605 586 # Remove `-o $object'.606 # Remove '-o $object'. 587 607 IFS=" " 588 608 for arg … … 653 673 rm -f "$depfile" 654 674 echo "$object : \\" > "$depfile" 655 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: 656 echo " 675 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" 676 echo "$tab" >> "$depfile" 657 677 sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 658 678 rm -f "$tmpdepfile"
Note: See TracChangeset
for help on using the changeset viewer.