scc

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

0094-expansion.sh (743B)


      1 #!/bin/sh
      2 
      3 trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
      4 
      5 tmp1=tmp1.$$
      6 tmp2=tmp2.$$
      7 
      8 cat > $tmp1 <<EOF
      9 file1.o file2.o
     10 all
     11 alp
     12 all.o
     13 file1.c file2.c
     14 file1 file2
     15 file1.e file2.e
     16 file1.c file2.c
     17 all
     18 EOF
     19 
     20 scc make -f- <<'EOF' > $tmp2 2>&1
     21 O = o
     22 SRC = file1.c  file2.c
     23 OBJ = $(SRC:.c=.$O)
     24 O = e
     25 C = c
     26 
     27 all:
     28 	@echo $(SRC:.c=.o)
     29 	@echo $(@)
     30 	@echo $(@:l=p)
     31 	@echo $(@:=.o)
     32 	@echo $(OBJ:.$O=.$C)
     33 	@echo $(OBJ:.$O=)
     34 	@echo $(OBJ)
     35 	@echo $(SRC)
     36 	@echo $(@:=)
     37 EOF
     38 diff $tmp1 $tmp2
     39 
     40 scc make -f- <<'EOF' > $tmp2 2>&1
     41 O = o
     42 SRC = file1.c  file2.c
     43 OBJ = ${SRC:.c=.$O}
     44 O = e
     45 C = c
     46 
     47 all:
     48 	@echo ${SRC:.c=.o}
     49 	@echo ${@}
     50 	@echo ${@:l=p}
     51 	@echo ${@:=.o}
     52 	@echo ${OBJ:.$O=.$C}
     53 	@echo ${OBJ:.$O=}
     54 	@echo ${OBJ}
     55 	@echo ${SRC}
     56 	@echo ${@:=}
     57 EOF
     58 diff $tmp1 $tmp2