GCC with OpenMP stream-computing extension and BatchQueue algorithm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mkdep 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh -
  2. #
  3. # Copyright (c) 1987 Regents of the University of California.
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms are permitted
  7. # provided that the above copyright notice and this paragraph are
  8. # duplicated in all such forms and that any documentation,
  9. # advertising materials, and other materials related to such
  10. # distribution and use acknowledge that the software was developed
  11. # by the University of California, Berkeley. The name of the
  12. # University may not be used to endorse or promote products derived
  13. # from this software without specific prior written permission.
  14. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  15. # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  16. # WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  17. #
  18. # @(#)mkdep.sh 5.12 (Berkeley) 6/30/88
  19. #
  20. MAKE=Makefile # default makefile name is "Makefile"
  21. while :
  22. do case "$1" in
  23. # -f allows you to select a makefile name
  24. -f)
  25. MAKE=$2
  26. shift; shift ;;
  27. # the -p flag produces "program: program.c" style dependencies
  28. # so .o's don't get produced
  29. -p)
  30. SED='s;\.o;;'
  31. shift ;;
  32. *)
  33. break ;;
  34. esac
  35. done
  36. if [ $# = 0 ] ; then
  37. echo 'usage: mkdep [-p] [-f makefile] [flags] file ...'
  38. exit 1
  39. fi
  40. if [ ! -w $MAKE ]; then
  41. echo "mkdep: no writeable file \"$MAKE\""
  42. exit 1
  43. fi
  44. TMP=/tmp/mkdep$$
  45. trap 'rm -f $TMP ; exit 1' 1 2 3 13 15
  46. cp $MAKE ${MAKE}.bak
  47. sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP
  48. cat << _EOF_ >> $TMP
  49. # DO NOT DELETE THIS LINE -- mkdep uses it.
  50. # DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
  51. _EOF_
  52. # If your compiler doesn't have -M, add it. If you can't, the next two
  53. # lines will try and replace the "cc -M". The real problem is that this
  54. # hack can't deal with anything that requires a search path, and doesn't
  55. # even try for anything using bracket (<>) syntax.
  56. #
  57. # egrep '^#include[ ]*".*"' /dev/null $* |
  58. # sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' |
  59. gcc -MM $* |
  60. sed "
  61. s; \./; ;g
  62. $SED" >> $TMP
  63. cat << _EOF_ >> $TMP
  64. # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
  65. _EOF_
  66. # copy to preserve permissions
  67. cp $TMP $MAKE
  68. rm -f ${MAKE}.bak $TMP
  69. exit 0