scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

gendep.sh (401B)


      1 #!/bin/sh
      2 
      3 set -e
      4 
      5 rm -f makefile
      6 trap "rm -f $$.mk" 0 2 3
      7 
      8 re='\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)'
      9 
     10 echo $@ |
     11 tr ' ' '\n' |
     12 sed "s/$re/\1/" |
     13 sort -u |
     14 (cat Makefile
     15 while read i
     16 do
     17 	cat <<EOF
     18 include target/$i/target.mk
     19 
     20 \$(OBJ-$i): \$(HDR)
     21 all: as-$i
     22 OBJ-$i: \$(HDR)
     23 as-$i: \$(OBJ-$i) \$(LIBDIR)/libscc.a
     24 	\$(CC) \$(SCC_LDFLAGS) \$(OBJ-$i) -lscc -o \$@
     25 
     26 EOF
     27 done) > $$.mk && mv $$.mk makefile