scc

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

mkdep (389B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 touch deps.mk
      6 
      7 cat <<EOF | ed -s deps.mk
      8 1s/$//
      9 g/^#deps/ s///
     10 .;\$c
     11 #deps
     12 $(for i in `find . -name '*.c'`
     13 do
     14 	file=`basename $i | sed 's/\.c$/.o/'`
     15 	dir=`dirname $i`
     16 
     17 	sed -n "/^#include / {
     18 		s///
     19 		s@\"\(.*\)\"@$dir/$file: $dir/\1@p
     20 		s@<\(scc/.*\)>@$dir/$file: \$(INCDIR)/scc/\1@p
     21 	}" $i
     22 done | LC_ALL=C sort -s)
     23 .
     24 g@^\./@ s///
     25 g@ \./@ s// /
     26 /^#deps/;$ g/^$/d
     27 w
     28 EOF