5 # Space-optimized version: strip comments, drop precision to 3
6 # figures, eliminate duplicates.
7 # update(creinig): precision reduction is now done in data2ps and comments
8 # (except for % bound) now are also ommitted from the start
10 echo 'image.ps: image-unop.ps'
11 #echo ' grep -v "^%" < $< | sed -e "s/\.\([0-9][0-9]\)[0-9]\+/.\1/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9][0-9]\.[0-9][0-9]/\1\200/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)[0-9]\.[0-9][0-9]/\1\20/g" -e "s/\(^\| \|-\)\([0-9][0-9][0-9]\)\.[0-9][0-9]/\1\2/g" -e "s/\(^\| \|-\)\([0-9][0-9]\)\.\([0-9]\)[0-9]/\1\2.\30/g" | awk "\$$0 ~ /lineto/ { if ( LASTLINE == \$$0 ) next; } { LASTLINE=\$$0; print; }" > $@'
12 echo ' grep -v "^% bound" < $< > $@'
13 # Need last comment (bounding box)
14 echo ' tail -1 $< >> $@'
15 echo ' ls -l image.ps image-unop.ps'
17 echo 'image-unop.ps: outline.ps ring1.ps ring2.ps ring3.ps ring4.ps'
18 echo ' cat ring[1234].ps > $@'
19 # Bounding box is at bottom now. Next two won't change it.
20 echo ' tail -1 $@ > bounding-box'
21 echo ' cat outline.ps >> $@'
22 echo ' cat ../tux.ps >> $@'
23 echo ' cat bounding-box >> $@ && rm bounding-box'
25 # Finished rings are precious!
26 echo .SECONDARY
: ring1.ps ring2.ps ring3.ps ring4.ps
28 # Rings 1 and 4 are all thrown together.
29 echo RING1_DEPS
:=`find $RING1 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
30 echo RING4_DEPS
:=`find $RING4 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
32 # Other rings are divided into dirs.
33 echo RING2_DEPS
:=`for d in $RING2; do echo $d-ring2.ps; done`
34 echo RING3_DEPS
:=`for d in $RING3; do echo $d-ring3.ps; done`
37 # First ring starts at inner radius.
38 echo 'ring1.ps: $(RING1_DEPS)'
39 echo " @echo Making Ring 1"
40 echo " @echo /angle 0 def > \$@"
41 echo " @../draw_arrangement $FILE_SCRUNCH 0 360 $INNER_RADIUS \$(RING1_DEPS) >> \$@"
42 echo " @echo Done Ring 1"
44 # Second ring starts at end of above ring (assume it's circular, so
46 echo 'ring2.ps: ring1.ps $(RING2_DEPS)'
47 echo " @echo Making Ring 2"
48 echo " @echo /angle 0 def > \$@"
49 echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING2; do echo $f-ring2.ps $f-ring2.angle; done` '>> $@'
50 echo " @echo Done Ring 2"
52 # Third ring starts at end of second ring.
53 echo 'ring3.ps: ring2.ps $(RING3_DEPS)'
54 echo " @echo Making Ring 3"
55 echo " @echo /angle 0 def > \$@"
56 echo " @../rotary_arrange.sh $DIR_SPACING" `for f in $RING3; do echo $f-ring3.ps $f-ring3.angle; done` '>> $@'
57 echo " @echo Done Ring 3"
59 # Outer ring starts at end of fourth ring.
60 # And it's just a big ring of drivers.
61 echo 'ring4.ps: $(RING4_DEPS) ring3.radius'
62 echo " @echo Making Ring 4"
63 echo " @echo /angle 0 def > \$@"
64 echo " @../draw_arrangement $FILE_SCRUNCH 0 360 \`cat ring3.radius\` \$(RING4_DEPS) >> \$@"
65 echo " @echo Done Ring 4"
68 # How to make directory picture: angle file contains start and end angle.
69 # Second ring starts at end of above ring (assume it's circular, so
71 echo "%-ring2.ps: %-ring2.angle ring1.radius"
72 echo " @echo Rendering \$@"
73 echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring1.radius\` \`find \$* -name '*-all.ps'\` > \$@"
75 echo "%-ring3.ps: %-ring3.angle ring2.radius"
76 echo " @echo Rendering \$@"
77 echo " @../draw_arrangement $FILE_SCRUNCH 0 \`cat \$<\` \`cat ring2.radius\` \`find \$* -name '*-all.ps'\` > \$@"
79 # How to extract radii
81 echo ' @echo scale=2\; `tail -1 $< | sed "s/^.* //"` + '$RING_SPACING' | bc > $@'
84 # How to make angle. Need total angle for that directory, and weight.
85 echo "%-ring2.angle: %-ring2.weight ring2.weight"
86 echo ' @echo "scale=2; ( 360 - ' `echo $RING2 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring2.weight`" | bc > $@'
88 echo "%-ring3.angle: %-ring3.weight ring3.weight"
89 echo ' @echo "scale=2; ( 360 - ' `echo $RING3 | wc -w` ' * ' $DIR_SPACING ') * `cat $<` / `cat ring3.weight`" | bc > $@'
91 # How to make ring weights (sum directory totals).
92 echo "ring2.weight:" `for d in $RING2; do echo $d-ring2.weight; done`
93 echo ' @cat $^ | ../tally > $@'
94 echo "ring3.weight:" `for d in $RING3; do echo $d-ring3.weight; done`
95 echo ' @cat $^ | ../tally > $@'
97 # How to make a wieght.
98 echo "%-ring2.weight:" `find $RING2 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
99 echo ' @../total_area.pl `find $* -name \*-all.ps` > $@'
100 echo "%-ring3.weight:" `find $RING3 -name '*.c.*' | sed 's/\.c.*/-all.ps/' | sort | uniq`
101 echo ' @../total_area.pl `find $* -name \*-all.ps` > $@'
104 # Now rule to make the graphs of a function.
106 #echo ' @../function2ps `echo $< | sed '\''s/^.*\.\([^.]*\)\.\+.*$$/\1/'\''` > $@ $<'
111 # Rule to make all from constituent parts.
113 echo " @echo Rendering \$*.c"
114 echo " @../conglomerate_functions.pl $FUNCTION_SCRUNCH $BOX_SCRUNCH \$^ > \$@"
119 # Generating outline, requires all the angles.
120 echo outline.ps
: ..
/make-outline.sh ring1.ps ring2.ps ring3.ps ring4.ps
`for f in $RING2; do echo $f-ring2.angle; done` `for f in $RING3; do echo $f-ring3.angle; done`
121 echo " ../make-outline.sh $INNER_RADIUS $DIR_SPACING $RING_SPACING \"$RING1\" > \$@"
124 # Now all the rules to make each function.
125 for d
in `find . -type d`; do
126 for f
in `cd $d; ls *+.ps 2>/dev/null | sed 's/\.c\..*$//' | uniq`; do
127 echo $d/$f-all.ps
: `cd $d; ls $f.c.* | sed -e "s?^?$d/?"`