scc

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

0070-macro.sh (261B)


      1 #!/bin/sh
      2 
      3 trap 'rm -f $tmp1 $tmp2' EXIT INT TERM QUIT HUP
      4 
      5 tmp1=tmp1.$$
      6 tmp2=tmp2.$$
      7 
      8 echo Hello World! > $tmp2
      9 
     10 scc make -f- <<'EOF' > $tmp1 2>&1
     11 VAR1 = one
     12 VAR = $(VAR1)
     13 VAR1 = print
     14 
     15 all: $(VAR)
     16 
     17 print:
     18 	@echo Hello World!
     19 VAR1 = two
     20 
     21 EOF
     22 
     23 diff $tmp1 $tmp2