scc

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

0015-pflag.sh (966B)


      1 #!/bin/sh
      2 
      3 trap 'rm -f $tmp1 $tmp2' EXIT INT QUIT HUP TERM
      4 
      5 tmp1=tmp1.$$
      6 tmp2=tmp2.$$
      7 
      8 unset MAKEFLAGS
      9 
     10 (cat > $tmp2) <<'EOF'
     11 FC = fort77
     12 YFLAGS = 
     13 ARFLAGS = -rv
     14 LDFLAGS = 
     15 LEX = lex
     16 CFLAGS = -O
     17 YACC = yacc
     18 CC = c99
     19 LFLAGS = 
     20 AR = ar
     21 SHELL = /bin/sh
     22 FFLAGS = -O 1
     23 .f.a:
     24 	${FC} -c ${FFLAGS} $<
     25 	${AR} ${ARFLAGS} $@ $*.o
     26 	rm -f $*.o
     27 
     28 .l.o:
     29 	${LEX} ${LFLAGS} $<
     30 	${CC} ${CFLAGS} -c lex.yy.c
     31 	rm -f lex.yy.c
     32 	mv lex.yy.o $@
     33 
     34 .c.a:
     35 	${CC} -c ${CFLAGS} $<
     36 	${AR} ${ARFLAGS} $@ $*.o
     37 	rm -f $*.o
     38 
     39 .c:
     40 	${CC} ${CFLAGS} ${LDFLAGS} -o $@ $<
     41 
     42 .c.o:
     43 	${CC} ${CFLAGS} -c $<
     44 
     45 .l.c:
     46 	${LEX} ${LFLAGS} $<
     47 	mv lex.yy.c $@
     48 
     49 .f.o:
     50 	${FC} ${FFLAGS} -c $<
     51 
     52 .f:
     53 	${FC} ${FFLAGS} ${LDFLAGS} -o $@ $<
     54 
     55 .y.o:
     56 	${YACC} ${YFLAGS} $<
     57 	${CC} ${CFLAGS} -c y.tab.c
     58 	rm -f y.tab.c
     59 	mv y.tab.o $@
     60 
     61 .y.c:
     62 	${YACC} ${YFLAGS} $<
     63 	mv y.tab.c $@
     64 
     65 .SUFFIXES: .o .c .y .l .a .sh .f
     66 
     67 all:
     68 
     69 .sh:
     70 	cp $< $@
     71 	chmod a+x $@
     72 
     73 EOF
     74 
     75 (scc make -pf - | grep -v MAKE > $tmp1 2>&1) <<'EOF'
     76 all:
     77 EOF
     78 
     79 diff -u $tmp1 $tmp2