scc

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

gendep.sh (518B)


      1 #!/bin/sh
      2 
      3 gentarget()
      4 {
      5 
      6 	cat <<EOF
      7 include target/$1/target.mk
      8 \$(OBJ-$1): \$(HDR)
      9 all: cc2-$1
     10 cc2-$1: \$(OBJ-$1) \$(LIBDIR)/libscc.a
     11 	\$(CC) \$(SCC_LDFLAGS) \$(OBJ-$1) -lscc -o \$@
     12 
     13 EOF
     14 }
     15 
     16 set -e
     17 
     18 rm -f makefile
     19 trap "rm -f $$.mk" 0 2 3
     20 
     21 re='\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)'
     22 
     23 echo $@ |
     24 tr ' ' '\n' |
     25 sed "s/$re/\1-\2/" |
     26 sort -u |
     27 (cat Makefile
     28 while read i
     29 do
     30 	if test ${MKQBE:-0} -eq 1
     31 	then
     32 		case $i in
     33 		amd64-sysv)
     34 			gentarget qbe_$i
     35 			;;
     36 		esac
     37 	fi
     38 	gentarget $i
     39 done) > $$.mk && mv $$.mk makefile