scc

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

gendep.sh (407B)


      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-\2/" |
     13 sort -u |
     14 (cat Makefile
     15 echo
     16 while read i
     17 do
     18 	cat <<EOF
     19 all: cc1-$i
     20 OBJ-$i= \$(OBJ)  target/$i/arch.o
     21 \$(OBJ-$i): \$(HDR)
     22 cc1-$i: \$(OBJ-$i) \$(LIBDIR)/libscc.a
     23 	\$(CC) \$(SCC_LDFLAGS) \$(OBJ-$i) -lscc -o \$@
     24 
     25 EOF
     26 	echo
     27 done) > $$.mk && mv $$.mk makefile