~ubuntu-branches/ubuntu/lucid/libatomic-ops/lucid

« back to all changes in this revision

Viewing changes to depcomp

  • Committer: Bazaar Package Importer
  • Author(s): Ian Wienand
  • Date: 2006-10-16 09:45:29 UTC
  • mfrom: (2.1.4 dapper)
  • Revision ID: james.westby@ubuntu.com-20061016094529-r3bevpq5w6g3rv20
Tags: 1.1-4
* Closes: #322027, #338469 -- add 04_m68k.patch for M68K support, from
  Roman Zippel <zippel@linux-m68k.org>.  Add note in README.Debian about
  port.
* Change mainatiner address to my @debian.org

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /bin/sh
2
2
 
3
3
# depcomp - compile a program generating dependencies as side-effects
4
 
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
 
4
# Copyright 1999, 2000 Free Software Foundation, Inc.
5
5
 
6
6
# This program is free software; you can redistribute it and/or modify
7
7
# it under the terms of the GNU General Public License as published by
172
172
 
173
173
aix)
174
174
  # The C for AIX Compiler uses -M and outputs the dependencies
175
 
  # in a .u file.  In older versions, this file always lives in the
176
 
  # current directory.  Also, the AIX compiler puts `$object:' at the
177
 
  # start of each line; $object doesn't have directory information.
178
 
  # Version 6 uses the directory in both cases.
179
 
  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
 
175
  # in a .u file.  This file always lives in the current directory.
 
176
  # Also, the AIX compiler puts `$object:' at the start of each line;
 
177
  # $object doesn't have directory information.
 
178
  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
180
179
  tmpdepfile="$stripped.u"
 
180
  outname="$stripped.o"
181
181
  if test "$libtool" = yes; then
182
182
    "$@" -Wc,-M
183
183
  else
184
184
    "$@" -M
185
185
  fi
 
186
 
186
187
  stat=$?
187
 
 
188
 
  if test -f "$tmpdepfile"; then :
189
 
  else
190
 
    stripped=`echo "$stripped" | sed 's,^.*/,,'`
191
 
    tmpdepfile="$stripped.u"
192
 
  fi
193
 
 
194
188
  if test $stat -eq 0; then :
195
189
  else
196
190
    rm -f "$tmpdepfile"
198
192
  fi
199
193
 
200
194
  if test -f "$tmpdepfile"; then
201
 
    outname="$stripped.o"
202
195
    # Each line is of the form `foo.o: dependent.h'.
203
196
    # Do two passes, one to just change these to
204
197
    # `$object: dependent.h' and one to simply `dependent.h:'.
213
206
  rm -f "$tmpdepfile"
214
207
  ;;
215
208
 
216
 
icc)
217
 
  # Intel's C compiler understands `-MD -MF file'.  However on
218
 
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
219
 
  # ICC 7.0 will fill foo.d with something like
220
 
  #    foo.o: sub/foo.c
221
 
  #    foo.o: sub/foo.h
222
 
  # which is wrong.  We want:
223
 
  #    sub/foo.o: sub/foo.c
224
 
  #    sub/foo.o: sub/foo.h
225
 
  #    sub/foo.c:
226
 
  #    sub/foo.h:
227
 
  # ICC 7.1 will output
228
 
  #    foo.o: sub/foo.c sub/foo.h
229
 
  # and will wrap long lines using \ :
230
 
  #    foo.o: sub/foo.c ... \
231
 
  #     sub/foo.h ... \
232
 
  #     ...
233
 
 
234
 
  "$@" -MD -MF "$tmpdepfile"
235
 
  stat=$?
236
 
  if test $stat -eq 0; then :
237
 
  else
238
 
    rm -f "$tmpdepfile"
239
 
    exit $stat
240
 
  fi
241
 
  rm -f "$depfile"
242
 
  # Each line is of the form `foo.o: dependent.h',
243
 
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
244
 
  # Do two passes, one to just change these to
245
 
  # `$object: dependent.h' and one to simply `dependent.h:'.
246
 
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
247
 
  # Some versions of the HPUX 10.20 sed can't process this invocation
248
 
  # correctly.  Breaking it into two sed invocations is a workaround.
249
 
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
250
 
    sed -e 's/$/ :/' >> "$depfile"
251
 
  rm -f "$tmpdepfile"
252
 
  ;;
253
 
 
254
209
tru64)
255
210
   # The Tru64 compiler uses -MD to generate dependencies as a side
256
211
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
257
 
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
 
212
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
258
213
   # dependencies in `foo.d' instead, so we check for that too.
259
214
   # Subdirectories are respected.
260
 
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
261
 
   test "x$dir" = "x$object" && dir=
262
 
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
263
215
 
 
216
   base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'`
 
217
   tmpdepfile1="$base.o.d"
 
218
   tmpdepfile2="$base.d"
264
219
   if test "$libtool" = yes; then
265
 
      tmpdepfile1="$dir.libs/$base.lo.d"
266
 
      tmpdepfile2="$dir.libs/$base.d"
267
220
      "$@" -Wc,-MD
268
221
   else
269
 
      tmpdepfile1="$dir$base.o.d"
270
 
      tmpdepfile2="$dir$base.d"
271
222
      "$@" -MD
272
223
   fi
273
224
 
285
236
   fi
286
237
   if test -f "$tmpdepfile"; then
287
238
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
288
 
      # That's a tab and a space in the [].
289
 
      sed -e 's,^.*\.[a-z]*:[    ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 
239
      # That's a space and a tab in the [].
 
240
      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
290
241
   else
291
242
      echo "#dummy" > "$depfile"
292
243
   fi
299
250
 
300
251
dashmstdout)
301
252
  # Important note: in order to support this mode, a compiler *must*
302
 
  # always write the preprocessed file to stdout, regardless of -o.
303
 
  "$@" || exit $?
304
 
 
305
 
  # Remove the call to Libtool.
306
 
  if test "$libtool" = yes; then
307
 
    while test $1 != '--mode=compile'; do
308
 
      shift
309
 
    done
310
 
    shift
311
 
  fi
312
 
 
313
 
  # Remove `-o $object'.
314
 
  IFS=" "
315
 
  for arg
316
 
  do
317
 
    case $arg in
318
 
    -o)
319
 
      shift
320
 
      ;;
321
 
    $object)
322
 
      shift
323
 
      ;;
324
 
    *)
325
 
      set fnord "$@" "$arg"
326
 
      shift # fnord
327
 
      shift # $arg
328
 
      ;;
329
 
    esac
330
 
  done
331
 
 
 
253
  # always write the proprocessed file to stdout, regardless of -o,
 
254
  # because we must use -o when running libtool.
332
255
  test -z "$dashmflag" && dashmflag=-M
333
 
  # Require at least two characters before searching for `:'
334
 
  # in the target name.  This is to cope with DOS-style filenames:
335
 
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
336
 
  "$@" $dashmflag |
337
 
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
 
256
  ( IFS=" "
 
257
    case " $* " in
 
258
    *" --mode=compile "*) # this is libtool, let us make it quiet
 
259
      for arg
 
260
      do # cycle over the arguments
 
261
        case "$arg" in
 
262
        "--mode=compile")
 
263
          # insert --quiet before "--mode=compile"
 
264
          set fnord "$@" --quiet
 
265
          shift # fnord
 
266
          ;;
 
267
        esac
 
268
        set fnord "$@" "$arg"
 
269
        shift # fnord
 
270
        shift # "$arg"
 
271
      done
 
272
      ;;
 
273
    esac
 
274
    "$@" $dashmflag | sed 's:^[^:]*\:[  ]*:'"$object"'\: :' > "$tmpdepfile"
 
275
  ) &
 
276
  proc=$!
 
277
  "$@"
 
278
  stat=$?
 
279
  wait "$proc"
 
280
  if test "$stat" != 0; then exit $stat; fi
338
281
  rm -f "$depfile"
339
282
  cat < "$tmpdepfile" > "$depfile"
340
283
  tr ' ' '
352
295
  ;;
353
296
 
354
297
makedepend)
355
 
  "$@" || exit $?
356
 
  # Remove any Libtool call
357
 
  if test "$libtool" = yes; then
358
 
    while test $1 != '--mode=compile'; do
359
 
      shift
360
 
    done
361
 
    shift
362
 
  fi
363
298
  # X makedepend
364
 
  shift
365
 
  cleared=no
366
 
  for arg in "$@"; do
367
 
    case $cleared in
368
 
    no)
369
 
      set ""; shift
370
 
      cleared=yes ;;
371
 
    esac
372
 
    case "$arg" in
373
 
    -D*|-I*)
374
 
      set fnord "$@" "$arg"; shift ;;
375
 
    # Strip any option that makedepend may not understand.  Remove
376
 
    # the object too, otherwise makedepend will parse it as a source file.
377
 
    -*|$object)
378
 
      ;;
379
 
    *)
380
 
      set fnord "$@" "$arg"; shift ;;
381
 
    esac
382
 
  done
383
 
  obj_suffix="`echo $object | sed 's/^.*\././'`"
384
 
  touch "$tmpdepfile"
385
 
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
 
299
  (
 
300
    shift
 
301
    cleared=no
 
302
    for arg in "$@"; do
 
303
      case $cleared in no)
 
304
        set ""; shift
 
305
        cleared=yes
 
306
      esac
 
307
      case "$arg" in
 
308
        -D*|-I*)
 
309
          set fnord "$@" "$arg"; shift;;
 
310
        -*)
 
311
          ;;
 
312
        *)
 
313
          set fnord "$@" "$arg"; shift;;
 
314
      esac
 
315
    done
 
316
    obj_suffix="`echo $object | sed 's/^.*\././'`"
 
317
    touch "$tmpdepfile"
 
318
    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
 
319
  ) &
 
320
  proc=$!
 
321
  "$@"
 
322
  stat=$?
 
323
  wait "$proc"
 
324
  if test "$stat" != 0; then exit $stat; fi
386
325
  rm -f "$depfile"
387
326
  cat < "$tmpdepfile" > "$depfile"
388
327
  sed '1,2d' "$tmpdepfile" | tr ' ' '
395
334
 
396
335
cpp)
397
336
  # Important note: in order to support this mode, a compiler *must*
398
 
  # always write the preprocessed file to stdout.
399
 
  "$@" || exit $?
400
 
 
401
 
  # Remove the call to Libtool.
402
 
  if test "$libtool" = yes; then
403
 
    while test $1 != '--mode=compile'; do
404
 
      shift
405
 
    done
406
 
    shift
407
 
  fi
408
 
 
409
 
  # Remove `-o $object'.
410
 
  IFS=" "
411
 
  for arg
412
 
  do
413
 
    case $arg in
414
 
    -o)
415
 
      shift
416
 
      ;;
417
 
    $object)
418
 
      shift
419
 
      ;;
420
 
    *)
421
 
      set fnord "$@" "$arg"
422
 
      shift # fnord
423
 
      shift # $arg
 
337
  # always write the proprocessed file to stdout, regardless of -o,
 
338
  # because we must use -o when running libtool.
 
339
  ( IFS=" "
 
340
    case " $* " in
 
341
    *" --mode=compile "*)
 
342
      for arg
 
343
      do # cycle over the arguments
 
344
        case $arg in
 
345
        "--mode=compile")
 
346
          # insert --quiet before "--mode=compile"
 
347
          set fnord "$@" --quiet
 
348
          shift # fnord
 
349
          ;;
 
350
        esac
 
351
        set fnord "$@" "$arg"
 
352
        shift # fnord
 
353
        shift # "$arg"
 
354
      done
424
355
      ;;
425
356
    esac
426
 
  done
427
 
 
428
 
  "$@" -E |
 
357
    "$@" -E |
429
358
    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
430
359
    sed '$ s: \\$::' > "$tmpdepfile"
 
360
  ) &
 
361
  proc=$!
 
362
  "$@"
 
363
  stat=$?
 
364
  wait "$proc"
 
365
  if test "$stat" != 0; then exit $stat; fi
431
366
  rm -f "$depfile"
432
367
  echo "$object : \\" > "$depfile"
433
368
  cat < "$tmpdepfile" >> "$depfile"
437
372
 
438
373
msvisualcpp)
439
374
  # Important note: in order to support this mode, a compiler *must*
440
 
  # always write the preprocessed file to stdout, regardless of -o,
 
375
  # always write the proprocessed file to stdout, regardless of -o,
441
376
  # because we must use -o when running libtool.
442
 
  "$@" || exit $?
443
 
  IFS=" "
444
 
  for arg
445
 
  do
446
 
    case "$arg" in
447
 
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 
377
  ( IFS=" "
 
378
    case " $* " in
 
379
    *" --mode=compile "*)
 
380
      for arg
 
381
      do # cycle over the arguments
 
382
        case $arg in
 
383
        "--mode=compile")
 
384
          # insert --quiet before "--mode=compile"
 
385
          set fnord "$@" --quiet
 
386
          shift # fnord
 
387
          ;;
 
388
        esac
 
389
        set fnord "$@" "$arg"
 
390
        shift # fnord
 
391
        shift # "$arg"
 
392
      done
 
393
      ;;
 
394
    esac
 
395
    for arg
 
396
    do
 
397
      case "$arg" in
 
398
      "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
448
399
        set fnord "$@"
449
400
        shift
450
401
        shift
451
402
        ;;
452
 
    *)
 
403
      *)
453
404
        set fnord "$@" "$arg"
454
405
        shift
455
406
        shift
456
407
        ;;
457
 
    esac
458
 
  done
459
 
  "$@" -E |
460
 
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
 
408
      esac
 
409
    done
 
410
    "$@" -E |
 
411
    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
 
412
  ) &
 
413
  proc=$!
 
414
  "$@"
 
415
  stat=$?
 
416
  wait "$proc"
 
417
  if test "$stat" != 0; then exit $stat; fi
461
418
  rm -f "$depfile"
462
419
  echo "$object : \\" > "$depfile"
463
420
  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::    \1 \\:p' >> "$depfile"