scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

mkdep (402B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 tmp=$$.tmp
      6 trap "rm -f $tmp" EXIT INT TERM HUP
      7 
      8 (cat Makefile
      9 printf "\n#deps\n"
     10 for i in `find . -name '*.c'`
     11 do
     12 	file=`basename $i | sed 's/\.c$/.o/'`
     13 	dir=`dirname $i`
     14 
     15 	sed -n "/^#include / {
     16 		s///
     17 		s@\"\(.*\)\"@$dir/$file: $dir/\1@p
     18 		s@<\(scc/.*\)>@$dir/$file: \$(INCDIR)/bits/\1@p
     19 	}" $i
     20 done |
     21 sed -e 's@^\./@@' -e 's@ \./@ @g' |
     22 LC_ALL=C sort -s) > $tmp
     23 
     24 mv $tmp makefile